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
|
# set the following quirk in .config/spectrwm/spectrwm.conf
|
||||||
# quirk[scratchpad] = FLOAT + ANYWHERE + FOCUSPREV
|
# quirk[scratchpad] = FLOAT + ANYWHERE + FOCUSPREV
|
||||||
|
|
||||||
|
# get scratchpad window id
|
||||||
WID=$(wmctrl -x -l scratchpad | fgrep '.scratchpad' | cut -d" " -f1)
|
WID=$(wmctrl -x -l scratchpad | fgrep '.scratchpad' | cut -d" " -f1)
|
||||||
|
|
||||||
if [ -z "$WID" ]
|
if [ -z "$WID" ]
|
||||||
then
|
then
|
||||||
st -c scratchpad -g 128x38+250+150 &
|
st -c scratchpad -g 128x38+250+150 &
|
||||||
else
|
else
|
||||||
wmctrl -i -r $WID -b toggle,hidden
|
# check if window is iconfified or on another WS (or both)
|
||||||
if xwininfo -id 0x01800005 | fgrep -q IsViewable
|
if xwininfo -id $WID | fgrep -q IsUnMapped
|
||||||
then
|
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
|
wmctrl -i -R $WID
|
||||||
|
else
|
||||||
|
# window is visible => hide
|
||||||
|
wmctrl -i -r $WID -b add,hidden
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user