From a73ec2a0ce44a40796f3a89114d32f017cceffd7 Mon Sep 17 00:00:00 2001 From: VectorKappa Date: Wed, 9 Nov 2022 11:01:34 +0100 Subject: [PATCH] Added Chrysostomus' "gapgrab" script; fixed polybar starting twice on init --- bin/gapgrab | 38 +++++++++++++++++++++++++++++++++++++ bin/workspaces_multimonitor | 4 ++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100755 bin/gapgrab diff --git a/bin/gapgrab b/bin/gapgrab new file mode 100755 index 0000000..26c0f02 --- /dev/null +++ b/bin/gapgrab @@ -0,0 +1,38 @@ +#!/bin/bash +# Credit where credit's due: https://github.com/Chrysostomus/rootmenu + +#intented to allow resizing bspwm windows by dragging them from window gap. Requires rootmenu + + +focused="$(bspc query -N -n focused)"; [ "$focused" ] || exit +IFS=" " read -a window <<< $(wattr whxy $focused) +eval $(xdotool getmouselocation --shell) +# location of each side of focused window +miny=$(expr "${window[3]}" + 20) +maxy=$(expr "${window[3]}" + "${window[1]}" - 20) +minx=$(expr "${window[2]}" + 20) +maxx=$(expr "${window[2]}" + "${window[0]}" - 20) + +# set final position to current or at most within window +XP=$X +[[ $XP -gt $maxx ]] && XP=$maxx +[[ $XP -lt $minx ]] && XP=$minx +YP=$Y +[[ $YP -lt $miny ]] && YP=$miny +[[ $YP -gt $maxy ]] && YP=$maxy + +buttonrelease() { + PAD_ID=$(xinput --list | grep -i -m 1 'touchpad' | grep -o 'id=[0-9]\+' | grep -o '[0-9]\+') + MOUSE_ID=$(xinput --list | grep -i -m 1 'mouse' | grep -o 'id=[0-9]\+' | grep -o '[0-9]\+') + STATE1=$(xinput --query-state $PAD_ID | grep 'button\[' | sort) + while true; do + sleep 0.1 + [[ "$PAD_ID" ]] && xinput --query-state $PAD_ID | grep -q 'button\[1\]=down' && continue + [[ "$MOUSE_ID" ]] && xinput --query-state $MOUSE_ID | grep -q 'button\[1\]=down' && continue + xdotool keyup super mouseup 3 && exit + done +} +xdotool mousemove --sync $XP $YP keydown super mousedown 3 + +buttonrelease + diff --git a/bin/workspaces_multimonitor b/bin/workspaces_multimonitor index 8d5a3c3..454626d 100755 --- a/bin/workspaces_multimonitor +++ b/bin/workspaces_multimonitor @@ -52,8 +52,8 @@ done done fi -##Polybar launch - /home/$USER/.dotfiles/polybar/.config/polybar/launch.sh & +###Polybar launch +# /home/$USER/.dotfiles/polybar/.config/polybar/launch.sh & ##Set wallpaper /home/$USER/.fehbg