aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/i3/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home-manager/i3/scripts')
-rwxr-xr-xmodules/home-manager/i3/scripts/exit.sh20
-rwxr-xr-xmodules/home-manager/i3/scripts/image_upload.sh7
-rwxr-xr-xmodules/home-manager/i3/scripts/monitor-config.sh23
-rwxr-xr-xmodules/home-manager/i3/scripts/rofi-passmenu27
-rwxr-xr-xmodules/home-manager/i3/scripts/workspaces.sh7
-rw-r--r--modules/home-manager/i3/scripts/workspaces.txt11
6 files changed, 95 insertions, 0 deletions
diff --git a/modules/home-manager/i3/scripts/exit.sh b/modules/home-manager/i3/scripts/exit.sh
new file mode 100755
index 0000000..6e1f492
--- /dev/null
+++ b/modules/home-manager/i3/scripts/exit.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+choice=$(echo -e "Sleep\nLock\nLock and sleep\nExit i3" | rofi -dmenu -i -p "What do you want to do")
+case $choice in
+ "Sleep")
+ systemctl suspend
+ ;;
+ "Lock")
+ i3lock -eti /usr/share/backgrounds/lockscreen.png
+ ;;
+ "Lock and sleep")
+ i3lock -eti /usr/share/backgrounds/lockscreen.png
+ systemctl suspend
+ ;;
+ "Exit i3")
+ i3-msg exit
+ ;;
+ *)
+ notify-send "Canceling"
+ ;;
+esac
diff --git a/modules/home-manager/i3/scripts/image_upload.sh b/modules/home-manager/i3/scripts/image_upload.sh
new file mode 100755
index 0000000..ea327ad
--- /dev/null
+++ b/modules/home-manager/i3/scripts/image_upload.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+image_name=$(rofi -dmenu -l 0 -p "Image name")
+xclip -selection clipboard -t image/png -o > ~/Documents/tehbox-files/$image_name
+eval $(ssh-agent)
+rsync ~/Documents/tehbox-files/$image_name boss@tehbox.org:/srv/files
+notify-send "uploaded https://files.tehbox.org/$image_name"
+echo -n "https://files.tehbox.org/$image_name" | xclip -i -selection clipboard
diff --git a/modules/home-manager/i3/scripts/monitor-config.sh b/modules/home-manager/i3/scripts/monitor-config.sh
new file mode 100755
index 0000000..8f17660
--- /dev/null
+++ b/modules/home-manager/i3/scripts/monitor-config.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+choice=$(echo -e "One monitor\nTwo monitors" | rofi -dmenu -i -p "What monitor setup to use")
+
+monitor1=$(xrandr | grep -E "eDP(-1(-1)?)?" | awk '{print $1 }')
+monitor2=$(xrandr | grep -E "HDMI(-A-0)?(-1(-1)?)?" | awk '{print $1 }')
+
+case $choice in
+ "One monitor")
+ xrandr --output $monitor1 --primary --mode 1920x1080 --rate 144 --pos 0x0 --rotate normal --output $monitor2 --off
+ sleep 1
+ i3-msg restart
+ ;;
+ "Two monitors")
+ xrandr --output $monitor1 --primary --mode 1920x1080 --rate 144 --pos 0x0 --rotate normal --output $monitor2 --mode 1920x1080 --rate 144 --pos 1920x0 --rotate normal
+ sleep 1
+ i3-msg restart
+ ;;
+ *)
+ notify-send "Invalid response, canceling"
+ ;;
+esac
+
diff --git a/modules/home-manager/i3/scripts/rofi-passmenu b/modules/home-manager/i3/scripts/rofi-passmenu
new file mode 100755
index 0000000..798961b
--- /dev/null
+++ b/modules/home-manager/i3/scripts/rofi-passmenu
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+shopt -s nullglob globstar
+
+typeit=1
+
+if [[ -n $WAYLAND_DISPLAY ]]; then
+ rofi=rofi-wl
+ xdotool="ydotool type --file -"
+elif [[ -n $DISPLAY ]]; then
+ rofi=rofi
+ xdotool="xdotool type --clearmodifiers --file -"
+else
+ echo "Error: No Wayland or X11 display detected" >&2
+ exit 1
+fi
+
+prefix=${PASSWORD_STORE_DIR-~/.password-store}
+password_files=( "$prefix"/**/*.gpg )
+password_files=( "${password_files[@]#"$prefix"/}" )
+password_files=( "${password_files[@]%.gpg}" )
+
+password=$(printf '%s\n' "${password_files[@]}" | "$rofi" -dmenu "$@")
+
+[[ -n $password ]] || exit
+
+pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool
diff --git a/modules/home-manager/i3/scripts/workspaces.sh b/modules/home-manager/i3/scripts/workspaces.sh
new file mode 100755
index 0000000..3ad68ef
--- /dev/null
+++ b/modules/home-manager/i3/scripts/workspaces.sh
@@ -0,0 +1,7 @@
+choice=$(cat ~/.i3_commands/workspaces.txt | rofi -dmenu -i -p "Which workspace to switch to")
+if [[ $1 == "move" ]]
+then
+ i3-msg move container to workspace \"$choice\"
+else
+ i3-msg workspace \"$choice\"
+fi
diff --git a/modules/home-manager/i3/scripts/workspaces.txt b/modules/home-manager/i3/scripts/workspaces.txt
new file mode 100644
index 0000000..84b3bf0
--- /dev/null
+++ b/modules/home-manager/i3/scripts/workspaces.txt
@@ -0,0 +1,11 @@
+1: 
+2: 󰑴
+3: 
+4: 
+5: 
+6: 
+7: 󰑴
+8: 
+9: 
+10: 
+S: 