Add colorpicker

This commit is contained in:
Tobias Reisinger 2024-05-20 18:59:26 +02:00
parent 6085c9f417
commit 1a40104856
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 10 additions and 2 deletions

6
.bin/colorpicker Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
grim -g "$(slurp -c bd93f9 -p)" -t ppm - \
| convert - -format '%[pixel:p{0,0}]' txt:- \
| grep -o '#[0-9A-F]\{6\}' \
| wl-copy -n

View file

@ -38,7 +38,7 @@ call_screenshot_tool() {
flameshot)
result=$(flameshot gui -r | tee $screenshot_path | wc -c) ;;
grim)
result=$(grim -g "$(slurp)" - | tee $screenshot_path | wc -c) ;;
result=$(grim -g "$(slurp -c bd93f9)" - | tee $screenshot_path | wc -c) ;;
*)
echo "Unknown screenshot tool: $tool"
return 1 ;;

View file

@ -12,8 +12,10 @@ bind = $main_mod, Pause, exec, menu-shutdown
bind = $main_mod, T, exec, ts-control
bind = $main_mod, C, exec, [float] $TERMINAL -e python
# Screenshot / Color picker
bind = $main_mod, Print, exec, screenshot
bind = $main_mod CTRL, Print, exec, screenshot --no-upload
bind = $main_mod ALT, Print, exec, colorpicker
bind = $main_mod SHIFT, R, exec, autostart-manage run-wayland

View file

@ -65,4 +65,4 @@ handle() {
esac
}
socat -U - "UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do handle "$line"; done
socat -U - "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do handle "$line"; done