Window selection magic #416
Replies: 5 comments 1 reply
-
For use in wayshot, this magic command. |
Beta Was this translation helpful? Give feedback.
-
There are two main difficulties making this command, first is that hyprctl doesn't seem to have a way to see whether or not a window is visable. So I have to get the id of the current activewindow(which should be always visable) and compare it to all the other clients. |
Beta Was this translation helpful? Give feedback.
-
Full script. #/usr/bin/env bash
if [ "$(hyprctl activewindow)" = "Invalid" ] ; then
wayshot --stdout | wl-copy
else
if [[ -z "$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == "$(hyprctl activewindow -j | jq -r '.workspace.id')\)" and select(.size == [2560,1440])")" ]];then
hyprctl --batch "keyword decoration:active_opacity 1;keyword decoration:inactive_opacity 1";wayshot -s "$(hyprctl clients -j | jq -r ".[] | select(.workspace.id == "$(hyprctl activewindow -j | jq -r '.workspace.id')\)""| jq -r ".at,.size" | jq -s "add" | jq '_nwise(4)' | jq -r '"\(.[0]),\(.[1]) \(.[2])x\(.[3])"'| slurp -f '%x %y %w %h')" --stdout | wl-copy;hyprctl reload
else
hyprctl --batch "keyword decoration:active_opacity 1;keyword decoration:inactive_opacity 1";wayshot --stdout | wl-copy
fi
fi Mainly the features added are detection for if the window is fullscreen or not |
Beta Was this translation helpful? Give feedback.
-
sick script, how'd you like adding this to the contrib repo |
Beta Was this translation helpful? Give feedback.
-
For those who use multiple monitors and would like a one-liner, here's my modified command. It's basically the same that @JustSimplyKyle wrote, but gets workspace list from
And here's the hyprland bind I use with grim and swappy
|
Beta Was this translation helpful? Give feedback.
-
hyprctl clients -j | jq -r ".[] | select(.workspace.id == "$(hyprctl activewindow -j | jq -r '.workspace.id')\)""| jq -r ".at,.size" | jq -s "add" | jq '_nwise(4)' | jq -r '"\(.[0]),\(.[1]) \(.[2])x\(.[3])"'| slurp
This "simple" command will will do the exact same thing as this on sway!
swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp
I'll admit, it's quite a bit uglier but it works! you can select indiviual windows using just your mouse!
Beta Was this translation helpful? Give feedback.
All reactions