merger of bin

This commit is contained in:
Luke Smith
2019-11-23 16:16:30 -05:00
parent 85d353d796
commit a5e66ac4f4
14 changed files with 160 additions and 96 deletions

19
.local/bin/i3cmds/ddspawn Executable file
View File

@@ -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

2
.local/bin/i3cmds/dropdowncalc Executable file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env sh
ifinstalled bc && echo "Welcome to the Calculator." && bc -lq

14
.local/bin/i3cmds/hover Executable file
View File

@@ -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

27
.local/bin/i3cmds/i3resize Executable file
View File

@@ -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

4
.local/bin/i3cmds/tmuxdd Executable file
View File

@@ -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