dotfiles/.bin/sp

28 lines
819 B
Bash
Executable File

#!/bin/sh
# set the following quirk in .config/spectrwm/spectrwm.conf
# quirk[scratchpad] = FLOAT + ANYWHERE
# get scratchpad window id
WID=$(wmctrl -x -l scratchpad | fgrep '.scratchpad' | cut -d" " -f1)
if [ -z "$WID" ]
then
sterm -c scratchpad -g 150x40+130+80 &
else
# check if window is iconfified or on another WS (or both)
if xwininfo -id $WID | fgrep -q IsUnMapped
then
# move window to current workspace
#wmctrl -i -r $WID -t $(xprop -root _NET_CURRENT_DESKTOP | cut -d'=' -f2)
wmctrl -i -r $WID -t $(wmctrl -d | grep '*' | cut -d ' ' -f '1')
# remove hidden flag
wmctrl -i -r $WID -b remove,hidden
# activate (give focus)
wmctrl -i -a $WID
else
# window is visible => hide
wmctrl -i -r $WID -b add,hidden
fi
fi