summaryrefslogtreecommitdiffstats
path: root/.scripts/i3cmds
diff options
context:
space:
mode:
Diffstat (limited to '.scripts/i3cmds')
-rwxr-xr-x.scripts/i3cmds/bottomleft9
-rwxr-xr-x.scripts/i3cmds/camtoggle2
-rwxr-xr-x.scripts/i3cmds/ddspawn1
-rwxr-xr-x.scripts/i3cmds/displayselect2
-rwxr-xr-x.scripts/i3cmds/samedir14
-rwxr-xr-x.scripts/i3cmds/showclip1
-rwxr-xr-x.scripts/i3cmds/winresize2
7 files changed, 13 insertions, 18 deletions
diff --git a/.scripts/i3cmds/bottomleft b/.scripts/i3cmds/bottomleft
index 5f05beb..be12b63 100755
--- a/.scripts/i3cmds/bottomleft
+++ b/.scripts/i3cmds/bottomleft
@@ -1,7 +1,6 @@
-#!/bin/bash
+#!/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
@@ -9,9 +8,9 @@ current=$(xdotool getwindowfocus)
newwidth=$(($(xdotool getdisplaygeometry | awk '{print $2}') / 3))
newheight=$(($(xdotool getdisplaygeometry | awk '{print $1}') / 3))
-xdotool windowsize $(xdotool getwindowfocus) $newheight $newwidth
+xdotool windowsize "$(xdotool getwindowfocus)" $newheight $newwidth
-newsize=$(xdotool getwindowgeometry $(xdotool getwindowfocus) | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
+newsize=$(xdotool getwindowgeometry "$(xdotool getwindowfocus)" | grep Geometry | sed -e 's/x/ /g' | awk '{print $3}')
height=$(($(xdotool getdisplaygeometry | awk '{print $2}') - newsize))
-xdotool windowmove $current 0 $height
+xdotool windowmove "$current" 0 $height
diff --git a/.scripts/i3cmds/camtoggle b/.scripts/i3cmds/camtoggle
index 1e39dec..05679c0 100755
--- a/.scripts/i3cmds/camtoggle
+++ b/.scripts/i3cmds/camtoggle
@@ -1,2 +1,2 @@
-#!/bin/bash
+#!/bin/sh
pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0
diff --git a/.scripts/i3cmds/ddspawn b/.scripts/i3cmds/ddspawn
index aedcd18..0871a59 100755
--- a/.scripts/i3cmds/ddspawn
+++ b/.scripts/i3cmds/ddspawn
@@ -12,7 +12,6 @@
# bindsym $mod+a exec --no-startup-id ddspawn dropdowncalc -f mono:pixelsize=24
# Similar to above but with `dropdowncalc` and the other args are interpretated as for my terminal emulator (to increase font)
-
[ -z "$1" ] && exit
if xwininfo -tree -root | grep "(\"$1\" ";
diff --git a/.scripts/i3cmds/displayselect b/.scripts/i3cmds/displayselect
index e36d214..a8cf2f5 100755
--- a/.scripts/i3cmds/displayselect
+++ b/.scripts/i3cmds/displayselect
@@ -43,7 +43,5 @@ esac
# Fix feh background if screen size/arangement has changed.
feh --bg-scale "$HOME/.config/wall.png"
-# Polybar users will want to uncomment this line, which reactivates polybar on all new displays:
-#polybar_launch
# Re-remap keys if keyboard added (for laptop bases)
remaps
diff --git a/.scripts/i3cmds/samedir b/.scripts/i3cmds/samedir
index 1bc1701..7d65838 100755
--- a/.scripts/i3cmds/samedir
+++ b/.scripts/i3cmds/samedir
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=$TERMINAL
@@ -8,20 +8,20 @@ CWD=''
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
-PID=$(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3)
+PID=$(xprop -id "$ID" | grep -m 1 PID | cut -d " " -f 3)
# Get last child process (shell, vim, etc)
if [ -n "$PID" ]; then
- TREE=$(pstree -lpA $PID | tail -n 1)
- PID=$(echo $TREE | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
+ TREE=$(pstree -lpA "$PID" | tail -n 1)
+ PID=$(echo "$TREE" | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')
# If we find the working directory, run the command in that directory
if [ -e "/proc/$PID/cwd" ]; then
- CWD=$(readlink /proc/$PID/cwd)
+ CWD=$(readlink /proc/"$PID"/cwd)
fi
fi
if [ -n "$CWD" ]; then
- cd $CWD && $CMD
+ cd "$CWD" && "$CMD"
else
- $CMD
+ "$CMD"
fi
diff --git a/.scripts/i3cmds/showclip b/.scripts/i3cmds/showclip
index f34addc..7b3aeee 100755
--- a/.scripts/i3cmds/showclip
+++ b/.scripts/i3cmds/showclip
@@ -7,7 +7,6 @@
clip=$(xclip -o -selection clipboard)
-
prim=$(xclip -o -selection primary)
[ "$prim" != "" ] && notify-send "<b>Clipboard:</b>
diff --git a/.scripts/i3cmds/winresize b/.scripts/i3cmds/winresize
index df4b75c..090bbf3 100755
--- a/.scripts/i3cmds/winresize
+++ b/.scripts/i3cmds/winresize
@@ -1,2 +1,2 @@
#!/bin/sh
-echo | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"
+echo "📐" | dmenu -p "Give width and height:" | xargs xdotool windowsize "$(xdotool getwindowfocus)"