dotfiles/.bin/sp

29 lines
794 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
st -c scratchpad -g 128x38+250+150 &
else
# check if window is iconfified or on another WS (or both)
if xwininfo -id $WID | fgrep -q IsUnMapped
then
# get current workspace ID
CWID=$(wmctrl -d | awk '{ if ($2 == "*") print $1 }')
# remove hidden flag
wmctrl -i -r $WID -b remove,hidden
# move window to current workspace
wmctrl -i -r $WID -t $CWID
# activate (give focus)
wmctrl -i -R $WID
else
# window is visible => hide
wmctrl -i -r $WID -b add,hidden
fi
fi