Update 2023-12-30 08:36 OpenBSD/amd64-x13

This commit is contained in:
c0dev0id 2023-12-30 08:36:38 +01:00
parent 4cee9ba420
commit 62360d0f1d

12
.bin/sp
View File

@ -23,15 +23,11 @@ WID=$(wmctrl -x -l scratchpad | fgrep '.scratchpad' | cut -d" " -f1)
if [ -z "$WID" ] if [ -z "$WID" ]
then then
# start terminal (sterm is st.suckless.org) # start terminal (sterm is st.suckless.org)
# XXX st is resized properly when hidden, st takes rows,
# columns as size input. We don't have that so that's just
# what echo $COLUMNS $LINES reports after the resize.
# So on the first start, the windows is "almost" correctly
# sized and we fix it later (when hidden).
sterm -c scratchpad -g 134x29+$GAP+$GAP & sterm -c scratchpad -g 134x29+$GAP+$GAP &
# XXX we cannot resize with wmctrl here, because the window is not # XXX we cannot resize with wmctrl here, because the window is not
# mapped yet. Adding a sleep here and resize then is visually # mapped yet. Adding a sleep here and resize then is visually
# unpleasant. # unpleasant. Therefore st is started with hardcoded dimensions
# and resized when hidden.
else else
# check if window is iconified or on another WS (or both) # check if window is iconified or on another WS (or both)
if xwininfo -id $WID | fgrep -q IsUnMapped if xwininfo -id $WID | fgrep -q IsUnMapped
@ -45,10 +41,12 @@ else
# activate (give focus) # activate (give focus)
wmctrl -i -a $WID wmctrl -i -a $WID
else else
wmctrl -i -r $WID -t 11
# window is visible => hide # window is visible => hide
wmctrl -i -r $WID -b add,hidden wmctrl -i -r $WID -b add,hidden
# correct size while hidden # correct size while hidden
wmctrl -i -r $WID -e 0,$GAP,$GAP,$H,$V wmctrl -i -r $WID -e 0,$GAP,$GAP,$H,$V
# move it beyond the WS limit to completely hide it from the bar
# XXX could also be skip_pager / skip_taskbar?
wmctrl -i -r $WID -t 11
fi fi
fi fi