summaryrefslogtreecommitdiffstats
path: root/.local/bin/i3cmds
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-11-23 16:16:30 -0500
committerLuke Smith <luke@lukesmith.xyz>2019-11-23 16:16:30 -0500
commita5e66ac4f45322b3665c944ba34d83b7db43ebc5 (patch)
treebed315d0a7f2c180b3eb634ece3a6a2089cdeb6f /.local/bin/i3cmds
parent85d353d7963391cd66f23a3e99a66b8b58045e4c (diff)
downloadeibhear-a5e66ac4f45322b3665c944ba34d83b7db43ebc5.tar.gz
eibhear-a5e66ac4f45322b3665c944ba34d83b7db43ebc5.tar.zst
eibhear-a5e66ac4f45322b3665c944ba34d83b7db43ebc5.zip
merger of bin
Diffstat (limited to '.local/bin/i3cmds')
-rwxr-xr-x.local/bin/i3cmds/ddspawn19
-rwxr-xr-x.local/bin/i3cmds/dropdowncalc2
-rwxr-xr-x.local/bin/i3cmds/hover14
-rwxr-xr-x.local/bin/i3cmds/i3resize27
-rwxr-xr-x.local/bin/i3cmds/tmuxdd4
5 files changed, 66 insertions, 0 deletions
diff --git a/.local/bin/i3cmds/ddspawn b/.local/bin/i3cmds/ddspawn
new file mode 100755
index 0000000..1c4af36
--- /dev/null
+++ b/.local/bin/i3cmds/ddspawn
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+# Toggle floating dropdown terminal in i3, or start if non-existing.
+# $1 is the script run in the terminal.
+# All other args are terminal settings.
+# Terminal names are in dropdown_* to allow easily setting i3 settings.
+
+[ -z "$1" ] && exit
+
+script=$1
+shift
+if xwininfo -tree -root | grep "(\"dropdown_$script\" ";
+then
+ echo "Window detected."
+ i3 "[instance=\"dropdown_$script\"] scratchpad show; [instance=\"dropdown_$script\"] move position center"
+else
+ echo "Window not detected... spawning."
+ i3 "exec --no-startup-id $TERMINAL -n dropdown_$script $@ -e $script"
+fi
diff --git a/.local/bin/i3cmds/dropdowncalc b/.local/bin/i3cmds/dropdowncalc
new file mode 100755
index 0000000..132d8e1
--- /dev/null
+++ b/.local/bin/i3cmds/dropdowncalc
@@ -0,0 +1,2 @@
+#!/usr/bin/env sh
+ifinstalled bc && echo "Welcome to the Calculator." && bc -lq
diff --git a/.local/bin/i3cmds/hover b/.local/bin/i3cmds/hover
new file mode 100755
index 0000000..d02bbbc
--- /dev/null
+++ b/.local/bin/i3cmds/hover
@@ -0,0 +1,14 @@
+#!/usr/bin/env 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
diff --git a/.local/bin/i3cmds/i3resize b/.local/bin/i3cmds/i3resize
new file mode 100755
index 0000000..f89bdb5
--- /dev/null
+++ b/.local/bin/i3cmds/i3resize
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+# This script was made by `goferito` on Github.
+# Some cleanup by Luke.
+
+[ -z "$1" ] && echo "No direction provided" && exit 1
+distanceStr="2 px or 2 ppt"
+
+moveChoice() {
+ i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
+ i3-msg resize "$3" "$4" "$distanceStr"
+}
+
+case $1 in
+ up)
+ moveChoice grow up shrink down
+ ;;
+ down)
+ moveChoice shrink up grow down
+ ;;
+ left)
+ moveChoice shrink right grow left
+ ;;
+ right)
+ moveChoice grow right shrink left
+ ;;
+esac
+
diff --git a/.local/bin/i3cmds/tmuxdd b/.local/bin/i3cmds/tmuxdd
new file mode 100755
index 0000000..c8eccbb
--- /dev/null
+++ b/.local/bin/i3cmds/tmuxdd
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+# This is the script that i3 runs to either start tmux in
+# the dropdown terminal or log into a previous session.
+tmux a || tmux