From 40084275f5493ca0ad8d4b9d8acf5ab341946ffc Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 30 Mar 2019 00:02:09 -0400 Subject: bottomleft/right combined to hover --- .config/i3/config | 4 ++-- .scripts/i3cmds/bottomleft | 16 ---------------- .scripts/i3cmds/bottomright | 18 ------------------ .scripts/i3cmds/hover | 14 ++++++++++++++ 4 files changed, 16 insertions(+), 36 deletions(-) delete mode 100755 .scripts/i3cmds/bottomleft delete mode 100755 .scripts/i3cmds/bottomright create mode 100755 .scripts/i3cmds/hover 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/bottomright deleted file mode 100755 index 45e46bf..0000000 --- a/.scripts/i3cmds/bottomright +++ /dev/null @@ -1,18 +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}') -newwidth=$(xdotool getwindowgeometry "$current" | grep Geometry | grep -o " [0-9]*") - -vertical=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize)) -horizontal=$(($(xdotool getdisplaygeometry | awk '{print $1}') - newwidth)) -xdotool windowmove "$current" $horizontal $vertical diff --git a/.scripts/i3cmds/hover b/.scripts/i3cmds/hover new file mode 100755 index 0000000..8d03a99 --- /dev/null +++ b/.scripts/i3cmds/hover @@ -0,0 +1,14 @@ +#!/bin/sh +[ -z "$1" ] && exit # If $1 is left, hovers in the bottom left, if right, the bottom right +current=$(xdotool getwindowfocus) +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]*") + +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 -- cgit v1.3.1