Skip to content

Commit 9a551b8

Browse files
author
micko
authored
fix desktop category, improve grim/slurp routine (#1)
Co-authored-by: 01micko <01micko#gmail.com>
1 parent 5417a91 commit 9a551b8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bin/wly_colpick

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
# (c) Copyright 2024 Mick Amadio <01micko@gmail.com> GPL3
4-
# requires yad, sed, grep, dc, ppmtoxpm, grim, slurp
4+
# requires yad, dc, ppmtoxpm, grim, slurp, expr (coreutils)
55

66
# simple hex to decimal conversion
77
find_color() {
@@ -17,7 +17,7 @@ yad_error() {
1717

1818
# uses pnmtoxpm to make a 1px xpm image
1919
get_col() {
20-
col=$(pos="$(slurp -b FFFFFF00 -p)";sleep 1; grim -g "$pos" -t ppm - | ppmtoxpm | grep -m1 '" c.*"' | sed -e 's/\" c //' -e 's/\".*$//')
20+
col=$(grim -g "$(slurp -p)" -t ppm - | ppmtoxpm | while read -r a b c; do [ "$b" == 'c' ] && echo ${c%\"*}; done)
2121
echo $col
2222
}
2323
@@ -76,8 +76,8 @@ return_gui() {
7676
yad --title="Color Picker" --name="select-color" --form \
7777
--image="$TEMPDIR/col.svg" --text=" Copy and paste color found\n to your application:" \
7878
--field="Color Hex" "$col_in" \
79-
--field="Color rgb" "$ZC" \
80-
--field="Color float" "$ZF" \
79+
--field="Color RGB" "$ZC" \
80+
--field="Color sRGB" "$ZF" \
8181
--button="Ok!gtk-ok":0
8282
return 0
8383
}

src/data/pick-color.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Comment=Pick color
66
Exec=wly_colpick
77
Terminal=false
88
Type=Application
9-
Categories=X-GraphicUtility
9+
Categories=Graphics;2DGraphics
1010
GenericName=Color Picker

0 commit comments

Comments
 (0)