sp: focus when window is mapped
This commit is contained in:
parent
ad214c1050
commit
36500c913d
15
.bin/sp
15
.bin/sp
@ -3,15 +3,26 @@
|
||||
# set the following quirk in .config/spectrwm/spectrwm.conf
|
||||
# quirk[scratchpad] = FLOAT + ANYWHERE + FOCUSPREV
|
||||
|
||||
# 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
|
||||
wmctrl -i -r $WID -b toggle,hidden
|
||||
if xwininfo -id 0x01800005 | fgrep -q IsViewable
|
||||
# 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 }')
|
||||
# move window to current workspace
|
||||
wmctrl -i -r $WID -t $CWID
|
||||
# remove hidden flag
|
||||
wmctrl -i -r $WID -b remove,hidden
|
||||
# activate (give focus)
|
||||
wmctrl -i -R $WID
|
||||
else
|
||||
# window is visible => hide
|
||||
wmctrl -i -r $WID -b add,hidden
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user