dotfiles/.config/polybar/scripts/switch_window_state

23 lines
293 B
Plaintext
Raw Normal View History

2021-08-07 17:07:54 +00:00
#!/usr/bin/env bash
set -e
[ -z "$1" ] && exit 1
active_window=$(xdotool getactivewindow)
window=$(xdotool search --name "$1")
[ "$?" -ne 0 ] && exit 1
if [ "$active_window" = "$window" ]; then
xdotool windowminimize "$window"
else
xdotool windowactivate "$window"
fi
exit 0