From 1a40104856ddfa50b78628edf7e1c3b3a2f3d15c Mon Sep 17 00:00:00 2001 From: Tobias Reisinger Date: Mon, 20 May 2024 18:59:26 +0200 Subject: [PATCH] Add colorpicker --- .bin/colorpicker | 6 ++++++ .bin/screenshot | 2 +- .config/hypr/binds.conf | 2 ++ .config/hypr/handler.sh | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100755 .bin/colorpicker diff --git a/.bin/colorpicker b/.bin/colorpicker new file mode 100755 index 0000000..37440fa --- /dev/null +++ b/.bin/colorpicker @@ -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 diff --git a/.bin/screenshot b/.bin/screenshot index 07e4c40..c182bf6 100755 --- a/.bin/screenshot +++ b/.bin/screenshot @@ -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 ;; diff --git a/.config/hypr/binds.conf b/.config/hypr/binds.conf index 529a58c..d474ce0 100644 --- a/.config/hypr/binds.conf +++ b/.config/hypr/binds.conf @@ -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 diff --git a/.config/hypr/handler.sh b/.config/hypr/handler.sh index faa784f..c861b9b 100755 --- a/.config/hypr/handler.sh +++ b/.config/hypr/handler.sh @@ -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