diff options
| author | spl3g <spleefer6@yandex.ru> | 2025-04-15 22:44:04 +0300 |
|---|---|---|
| committer | spl3g <spleefer6@yandex.ru> | 2025-05-01 14:59:18 +0300 |
| commit | ba1f63c6c5137dc9a7c8550ff2f1f052377a0091 (patch) | |
| tree | eee3c5159119b8359d03cd97a1bd8b7a41dec13e /home-manager/homeModules/attachments/hypr-scripts/hshot.sh | |
| parent | 841ee4137d95f7ed5aafd7f8e29c94e12e712665 (diff) | |
feat(hyprland): cleanup scripts
Diffstat (limited to 'home-manager/homeModules/attachments/hypr-scripts/hshot.sh')
| -rwxr-xr-x | home-manager/homeModules/attachments/hypr-scripts/hshot.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/home-manager/homeModules/attachments/hypr-scripts/hshot.sh b/home-manager/homeModules/attachments/hypr-scripts/hshot.sh new file mode 100755 index 0000000..0d02b9c --- /dev/null +++ b/home-manager/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[*]}" |
