From 03648b3d9f177227df40129bed22558f6924b91c Mon Sep 17 00:00:00 2001 From: spl3g Date: Wed, 18 Mar 2026 18:01:41 +0300 Subject: so.. v2 i guess --- .../homeModules/attachments/hypr-scripts/hshot.sh | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 modules/homeModules/attachments/hypr-scripts/hshot.sh (limited to 'modules/homeModules/attachments/hypr-scripts/hshot.sh') diff --git a/modules/homeModules/attachments/hypr-scripts/hshot.sh b/modules/homeModules/attachments/hypr-scripts/hshot.sh new file mode 100755 index 0000000..0d02b9c --- /dev/null +++ b/modules/homeModules/attachments/hypr-scripts/hshot.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +declare -a cmd + +usage() { + echo -e "-m | monitor\n-s | slurp\n-w | active window\n-c | add copy" +} + +monitor() { + cmd=("grim -o \"\$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')\"") +} + +slurp() { + cmd=("grim -g \"\$(slurp)\"") +} + +window() { + cmd=("grim -g \"\$(hyprctl activewindow -j | jq -j '\"\(.at | .[0]),\(.at | .[1]) \(.size | .[0])x\(.size | .[1])\"')\"") +} + +copy() { + if [[ -n ${cmd[0]} ]]; then + cmd+=("- | wl-copy") + else + usage + fi +} + +while getopts ":mswc" opt; do + case ${opt} in + m) monitor;; + s) slurp;; + w) window;; + c) copy;; + *) usage + exit 1;; + esac +done + +if [[ -z $1 ]]; then + usage + exit 1 +fi + +bash -c "${cmd[*]}" -- cgit v1.2.3