dotfiles/.bin/sp

28 lines
790 B
Plaintext
Raw Normal View History

2023-01-08 17:34:37 +01:00
#!/bin/sh
2023-01-07 21:45:05 +01:00
# set the following quirk in .config/spectrwm/spectrwm.conf
2023-01-08 17:34:37 +01:00
# quirk[scratchpad] = FLOAT + ANYWHERE
2023-01-07 21:45:05 +01:00
2023-01-08 09:17:11 +01:00
# get scratchpad window id
2023-01-07 21:45:05 +01:00
WID=$(wmctrl -x -l scratchpad | fgrep '.scratchpad' | cut -d" " -f1)
if [ -z "$WID" ]
then
2023-03-28 18:19:41 +02:00
sterm -c scratchpad -g 150x40+130+80 &
2023-01-07 21:45:05 +01:00
else
2023-01-08 09:17:11 +01:00
# check if window is iconfified or on another WS (or both)
if xwininfo -id $WID | fgrep -q IsUnMapped
2023-01-07 21:45:05 +01:00
then
2023-01-10 08:20:01 +01:00
# move window to current workspace
2023-04-10 13:00:38 +02:00
#wmctrl -i -r $WID -t $(xprop -root _NET_CURRENT_DESKTOP | cut -d'=' -f2)
wmctrl -i -r $WID -t $_SWM_WS
2023-01-08 09:17:11 +01:00
# remove hidden flag
wmctrl -i -r $WID -b remove,hidden,sicky
2023-01-08 09:17:11 +01:00
# activate (give focus)
2023-01-10 08:20:01 +01:00
wmctrl -i -a $WID
2023-01-08 09:17:11 +01:00
else
# window is visible => hide
wmctrl -i -r $WID -b add,hidden
2023-01-07 21:45:05 +01:00
fi
fi