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