From 40084275f5493ca0ad8d4b9d8acf5ab341946ffc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Mar 2019 00:02:09 -0400 Subject: [PATCH] bottomleft/right combined to hover --- .config/i3/config | 4 ++-- .scripts/i3cmds/bottomleft | 16 ---------------- .scripts/i3cmds/{bottomright => hover} | 14 +++++--------- 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100755 .scripts/i3cmds/bottomleft rename .scripts/i3cmds/{bottomright => hover} (56%) diff --git a/.config/i3/config b/.config/i3/config index fed2942..7d24442 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -155,10 +155,10 @@ bindsym $mod+v exec --no-startup-id $term -e $EDITOR -c "VimwikiIndex" #bindsym $mod+Shift+v bindsym $mod+b bar mode toggle -bindsym $mod+Shift+b floating toggle; sticky toggle; exec --no-startup-id bottomleft +bindsym $mod+Shift+b floating toggle; sticky toggle; exec --no-startup-id hover left bindsym $mod+n exec $term -e newsboat && pkill -RTMIN+6 i3blocks -bindsym $mod+Shift+n floating toggle; sticky toggle; exec --no-startup-id bottomright +bindsym $mod+Shift+n floating toggle; sticky toggle; exec --no-startup-id hover right bindsym $mod+m exec --no-startup-id $term -e ncmpcpp bindsym $mod+Shift+m exec --no-startup-id lmc mute diff --git a/.scripts/i3cmds/bottomleft b/.scripts/i3cmds/bottomleft deleted file mode 100755 index c73a59a..0000000 --- a/.scripts/i3cmds/bottomleft +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This script move the selected window to the bottom left of the screen. -current=$(xdotool getwindowfocus) - -# The window will take up no more than a third of -# the width or height of the screen. -newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) -newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) - -xdotool windowsize "$current" $newheight $newwidth - -newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') - -height=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) -xdotool windowmove "$current" 0 $height diff --git a/.scripts/i3cmds/bottomright b/.scripts/i3cmds/hover similarity index 56% rename from .scripts/i3cmds/bottomright rename to .scripts/i3cmds/hover index 45e46bf..8d03a99 100755 --- a/.scripts/i3cmds/bottomright +++ b/.scripts/i3cmds/hover @@ -1,18 +1,14 @@ #!/bin/sh - -# This script move the selected window to the bottom left of the screen. +[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right current=$(xdotool getwindowfocus) - -# The window will take up no more than a third of -# the width or height of the screen. newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3)) newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3)) - xdotool windowsize "$current" $newheight $newwidth - newsize=$(xdotool getwindowgeometry "$current" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}') newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") -vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) -horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) +case "$1" in + left) horizontal=0; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; + right) horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) ; vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) ;; +esac xdotool windowmove "$current" $horizontal $vertical