update colorpicker to use kdialog
This commit is contained in:
parent
c256e098ec
commit
146a79063a
1 changed files with 59 additions and 57 deletions
|
|
@ -28,14 +28,14 @@ NO_NOTIFY=0
|
||||||
|
|
||||||
while [ "$1" ]; do
|
while [ "$1" ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
'-h' | '--help' | 'help' | '?' )
|
'-h' | '--help' | 'help' | '?')
|
||||||
showhelp
|
showhelp
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
'clipboard' )
|
'clipboard')
|
||||||
CLIPBOARD=1
|
CLIPBOARD=1
|
||||||
;;
|
;;
|
||||||
'--no-notify' )
|
'--no-notify')
|
||||||
NO_NOTIFY=1
|
NO_NOTIFY=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -45,9 +45,8 @@ done
|
||||||
|
|
||||||
# Check if running under wayland.
|
# Check if running under wayland.
|
||||||
if [ "$WAYLAND_DISPLAY" = "" ]; then
|
if [ "$WAYLAND_DISPLAY" = "" ]; then
|
||||||
zenity --error --width 400 \
|
kdialog --error "This color picker must be run under a valid wayland session." \
|
||||||
--title "No wayland session found." \
|
--title "No wayland session found."
|
||||||
--text "This color picker must be run under a valid wayland session."
|
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -60,19 +59,21 @@ position=$(slurp -b 00000000 -p)
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Store the hex color value using graphicsmagick or imagemagick.
|
# Store the hex color value using graphicsmagick or imagemagick.
|
||||||
if command -v /usr/bin/gm &> /dev/null; then
|
if command -v /usr/bin/gm &>/dev/null; then
|
||||||
color=$(grim -g "$position" -t png - \
|
color=$(
|
||||||
| /usr/bin/gm convert - -format '%[pixel:p{0,0}]' txt:- \
|
grim -g "$position" -t png - |
|
||||||
| tail -n 1 \
|
/usr/bin/gm convert - -format '%[pixel:p{0,0}]' txt:- |
|
||||||
| rev \
|
tail -n 1 |
|
||||||
| cut -d ' ' -f 1 \
|
rev |
|
||||||
| rev
|
cut -d ' ' -f 1 |
|
||||||
|
rev
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
color=$(grim -g "$position" -t png - \
|
color=$(
|
||||||
| convert - -format '%[pixel:p{0,0}]' txt:- \
|
grim -g "$position" -t png - |
|
||||||
| tail -n 1 \
|
convert - -format '%[pixel:p{0,0}]' txt:- |
|
||||||
| cut -d ' ' -f 4
|
tail -n 1 |
|
||||||
|
cut -d ' ' -f 4
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -83,9 +84,10 @@ if [ $CLIPBOARD -eq 1 ]; then
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Display a color picker and store the returned rgb color
|
# Display a color picker and store the returned rgb color
|
||||||
rgb_color=$(zenity --color-selection \
|
rgb_color=$(
|
||||||
|
kdialog --getcolor \
|
||||||
--title="Copy color to Clipboard" \
|
--title="Copy color to Clipboard" \
|
||||||
--color="${color}"
|
--default "${color}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Execute if user didn't click cancel
|
# Execute if user didn't click cancel
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue