From ae2e509ec58d4fb17e4bface8dd6147354634316 Mon Sep 17 00:00:00 2001 From: krolyxon Date: Tue, 27 Jan 2026 22:12:48 +0530 Subject: hyprland: add screenshot keybind --- .config/hypr/source/keybinds.conf | 3 ++- .local/bin/hypr/hypr_screenshot.sh | 17 +++++++++++++++++ .local/bin/screenshot | 17 ----------------- 3 files changed, 19 insertions(+), 18 deletions(-) create mode 100755 .local/bin/hypr/hypr_screenshot.sh delete mode 100755 .local/bin/screenshot diff --git a/.config/hypr/source/keybinds.conf b/.config/hypr/source/keybinds.conf index 4ae2eb9..20099e7 100644 --- a/.config/hypr/source/keybinds.conf +++ b/.config/hypr/source/keybinds.conf @@ -24,7 +24,8 @@ bind = $mainMod, escape, exec, sysact # Applications bind = $mainMod, W, exec, $browser -bind = ,PRINT, exec, screenshot +bind = ,PRINT, exec, hypr_screenshot.sh +bind = $mainMod SHIFT, P, exec, hypr_screenshot.sh # Music Controls bind = $mainMod, m, exec, $terminal -e zsh -i -c "ncmpcpp" diff --git a/.local/bin/hypr/hypr_screenshot.sh b/.local/bin/hypr/hypr_screenshot.sh new file mode 100755 index 0000000..ac497d6 --- /dev/null +++ b/.local/bin/hypr/hypr_screenshot.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +ocr_cmd="wl-copy" + +case "$(printf "a selected area (copy)\ncurrent window (copy)\nfull screen (copy)\na selected area\ncurrent window\nfull screen\na selected area (OCR)" | fuzzel -d -l 7 -i -p "Screenshot which area?")" in + "a selected area (copy)") hyprshot -m region --clipboard-only ;; + "current window (copy)") hyprshot -m window --clipboard-only ;; + "full screen (copy)") hyprshot -m output --clipboard-only ;; + + "a selected area") hyprshot -m region -o ~/pix/ss -f "pic-selected-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; + "current window") hyprshot -m window -o ~/pix/ss -f "pic-window-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; + "full screen") hyprshot -m output -o ~/pix/ss -f "pic-full-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; + + "a selected area (OCR)") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && \ + slurp | grim -g - - | tesseract stdin stdout -l eng | wl-copy +esac + diff --git a/.local/bin/screenshot b/.local/bin/screenshot deleted file mode 100755 index ac497d6..0000000 --- a/.local/bin/screenshot +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -ocr_cmd="wl-copy" - -case "$(printf "a selected area (copy)\ncurrent window (copy)\nfull screen (copy)\na selected area\ncurrent window\nfull screen\na selected area (OCR)" | fuzzel -d -l 7 -i -p "Screenshot which area?")" in - "a selected area (copy)") hyprshot -m region --clipboard-only ;; - "current window (copy)") hyprshot -m window --clipboard-only ;; - "full screen (copy)") hyprshot -m output --clipboard-only ;; - - "a selected area") hyprshot -m region -o ~/pix/ss -f "pic-selected-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; - "current window") hyprshot -m window -o ~/pix/ss -f "pic-window-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; - "full screen") hyprshot -m output -o ~/pix/ss -f "pic-full-$(uuidgen | awk -F- '{printf $2}')-$(date '+%y-%m-%d').png" ;; - - "a selected area (OCR)") tmpfile=$(mktemp /tmp/ocr-XXXXXX.png) && \ - slurp | grim -g - - | tesseract stdin stdout -l eng | wl-copy -esac - -- cgit v1.2.3