Files
fish/functions/lost_window.fish
T

24 lines
632 B
Fish

function lost_window
if not command -q hyprctl
echo "Only works with Hyprland compositor."
return 1
end
if test (count $argv) -lt 1
echo "Usage: lost_window <number>"
return 1
end
if test (count $argv) -lt 2
set addr (hyprctl clients -j \
| jq -r '.[] | select(.workspace.id == '$argv[1]') | .address' \
| head -n1)
test -n "$addr"; or return 1
hyprctl dispatch "hl.dsp.focus({window = 'address:$addr'})"
end
# center the window on its monitor
hyprctl dispatch "hl.dsp.window.center({window = 'address:$addr'})"
end