saving position of sticky tiling window
loosefish-scapegrace opened this issue · 1 comments
loosefish-scapegrace commented
hi,
a common occurrence for me when using bspwm is that moving between desktops with a tiling sticky window open does not preserve the tree position of the window, which messes with the existing layout when switching back. i tried to create a script which saves the last position in a receptacle but it didn't really work. any ideas?
loosefish-scapegrace commented
update: after asking for help on the IRC, i ended up with this script which seems to work perfectly:
#!/bin/sh
# deal with sticky windows when moving workspaces.
test -z "$1" && exit
# path format: desktop/stickywindow: parent
bspc query -N -n '.local.leaf.!hidden.sticky' | while read -r wid; do
[ "$(bsp_countwindows)" = 1 ] && break
dir="$HOME/run/bspsticky/$(bspc query -D -d focused)"
mkdir -p "$dir"
bspc node "$wid" -i
bspc query -N "$wid" -n '@brother.leaf.!window' > "${dir}/${wid}"
done
bspc desktop -f "$1"
bspc query -N -n '.local.leaf.!hidden.sticky' | while read -r wid; do
dir="$HOME/run/bspsticky/$(bspc query -D -d focused)"
[ "$(bsp_countwindows)" = 1 ] && break
stdir="${dir}/${wid}"
if [ -s "$stdir" ]; then
recep="$(cat "$stdir")"
bspc node "$wid" -n "$recep"
rm "$stdir"
fi
done