pointer_modifier software toggle
Sometimes, one of my hands gets busy and I need to use the computer using one hand. In such cases, the mouse looks like an ok option. Today I realized that I can't move or resize unless I press the pointer_modifier. Another scenario where this can be problematic is if a touch screen device is used, which I'm planning to integrate into my workflow.
If there is no existing solution at the moment and if that doesn't sound like too unnecessary, I suggest adding maybe something like bspc node toggle-move-resize? This could be then bound to a button on a bar or whatever.
A workaround I tried is to use xdotool keydown Super_L and xdotool keyup Super_L. But that's too hacky and it can go wrong in many ways.
I am joining your preoccupation. I think the pointer_modifier feature is bad designed. I am not sure it is possible to allow the possibility to resize windows like in a "classic style" like Windows, as it implies than bspwm detect the surroundings of the borders of a window . But I think there is no need for that. Actually, it is enough to allow a bit more of flexibility on the pointer modifier setting. Why not leaving people to :
- have several pointer modifier keys ? So ctrl + click 1 could be different than alt + 1
- toggle a "resize/move" mode as you suggest ?
Waiting for that, I suggest you @Naheel-Azawy, if you don't have found a solution to solve your one hand issue, to have a look at the small script I posted here in this other issue, which allows to change the split ratio of tiled nodes.
To resize and move floating windows, I use personally this script. It does not allow the precision of resizing or moving with the mouse, but do we really need it? Working with a "fixed scale" could be enough, is you configure it according to your workflow.
Resizing floating windows
window=$(bspc query -N -n focused.floating)
[[ -z $window ]] && exit
wsize=$(bspc query -T -n focused | grep -oP "floatingRectangle\K.*?(?=}})" | grep -o '[0-9]\+')
svars=("a" "b" "c" "d"); n=0
for el in $wsize; do
[[ $n -gt 1 ]] && eval s_${svars[$n]}=$(echo $el)
((n++))
done
# Available predefined sizes
min="800:500:560:290"
ml="1200:600:360:240"
mm="1200:800:370:140"
mx="1400:900:260:90"
max="1862:1022:33:48"
# Pick up a new size
sratio=$(($s_c*$s_d))
if [[ $sratio -ge $((1862*1022)) ]]; then
[[ "$1" == "n" ]] && size='' || size="mx"
elif [[ $sratio -ge $((1400*900)) ]]; then
[[ "$1" == "n" ]] && size="max" || size="mm"
elif [[ $sratio -ge $((1200*800)) ]]; then
[[ "$1" == "n" ]] && size="mx" || size="ml"
elif [[ $sratio -ge $((1200*600)) ]]; then
[[ "$1" == "n" ]] && size="mm" || size="min"
elif [[ $sratio -gt $((800*500)) ]]; then
[[ "$1" == "n" ]] && size="ml" || size='min'
elif [[ $sratio -eq $((800*500)) ]]; then
[[ "$1" == "n" ]] && size="ml" || size=''
elif [[ $sratio -lt $((800*500)) ]]; then
[[ "$1" == "n" ]] && size="min" || size=''
fi
# Set the coordinates of the picked up size
[[ -z $size ]] && exit
w=$(echo ${!size} | cut -d: -f1)
h=$(echo ${!size} | cut -d: -f2)
x=$(echo ${!size} | cut -d: -f3)
y=$(echo ${!size} | cut -d: -f4)
# Center/resize the window
xdo resize -w $w -h $h $window
xdo move -x $x -y $y $window
Moving floating windows/swapping tiled windows (with the same keys)
window=$(bspc query -N -n focused.floating)
tiled=$(bspc query -N -n focused.tiled)
[[ -z $window ]] && [[ -z $tiled ]] && exit
_move_right(){
if ((ww <= 900)); then
midpos=$(((1880 - $ww)/2))
if ((xx < midpos)); then
xdo move -x $midpos $window
else
xdo move -x $(($midpos*2 + 5)) $window
fi
else
((xx < X)) && xdo move -x $X $window
fi
}
_move_left(){
if ((ww <= 900)); then
midpos=$(((1880 - $ww)/2))
if ((xx > midpos)); then
xdo move -x $midpos $window
else
xdo move -x 35 $window
fi
else
((xx > 33)) && xdo move -x 35 $window
fi
}
_move_floating(){
mapfile -t wsize < <(bspc query -T -n focused | grep -oP "floatingR
ectangle\K.*?(?=}})" | grep -o '[0-9]\+')
xx=${wsize[0]}
yy=${wsize[1]}
ww=${wsize[2]}
hh=${wsize[3]}
Y=$((1080-20-$hh))
X=$((1920-35-$ww))
case $1 in
l) _move_left;;
r) _move_right;;
u) ((yy > 48)) && xdo move -y 50 $window;;
d) ((yy < Y)) && xdo move -y $Y $window;;
esac
}
_move_tiled(){
case $1 in
l) bspc node -s west;;
r) bspc node -s east;;
u) bspc node -s north;;
d) bspc node -s south;;
esac
}
[[ -n $window ]] && _move_floating $1
[[ -n $tiled ]] && _move_tiled $1