diff options
| author | Tim Keller <tjkeller.xyz> | 2024-11-17 23:34:54 -0600 | 
|---|---|---|
| committer | Tim Keller <tjkeller.xyz> | 2024-11-17 23:34:54 -0600 | 
| commit | 09ada24d4ec23cf24ab136141b354953d1bbc2fa (patch) | |
| tree | 2c41e87c71ad3f3cd67a8bea0c1413efbab4087d /keyboard | |
| parent | 090a3a31683eb08b91351e4d1508a0a73a310a38 (diff) | |
| download | scripts-09ada24d4ec23cf24ab136141b354953d1bbc2fa.tar.xz scripts-09ada24d4ec23cf24ab136141b354953d1bbc2fa.zip  | |
reorganize scripts
Diffstat (limited to 'keyboard')
| -rwxr-xr-x | keyboard/dmenunametag | 30 | ||||
| -rwxr-xr-x | keyboard/dockfanctl | 10 | ||||
| -rwxr-xr-x | keyboard/sinkswitch | 15 | ||||
| -rwxr-xr-x | keyboard/volcon | 3 | ||||
| -rwxr-xr-x | keyboard/wgconnect | 40 | 
5 files changed, 0 insertions, 98 deletions
diff --git a/keyboard/dmenunametag b/keyboard/dmenunametag deleted file mode 100755 index 0458c79..0000000 --- a/keyboard/dmenunametag +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -numtags=9 -rcn="Remove Current Name" -defnames="$rcn\nCode\nCompile\nTest\nDebug\nEdit" -while !([ $tagnum -ge 1 2>/dev/null ] && [ $tagnum -le $numtags ]); do -	tagnum=$(seq $numtags | dmenu -p "Choose tag: ") -	[ "$tagnum" = "" ] && exit -done -name="$(echo -n "$defnames" | dmenu -p "Rename tag $tagnum to: ")" -[ "$name" = "$rcn" ] \ -	&& nametag $tagnum r \ -	|| nametag $tagnum n "$name" - -# Force bar to update by setting the root name to itself since there is currently a bug in the window manager -#xsetroot -name "$(xprop -root WM_NAME | sed -n 's/^WM_NAME(STRING) = \"\(.*\)\"/\1/p')" - -# Old mode -#while [ "$action" != "Rename" ] && [ "$action" != "Remove" ]; do -#	action=$(echo -n "Rename\nRemove" | dmenu -p "Would you like to rename or remove this tag $tagnum's label? ") -#	[ "$action" = "" ] && exit -#done -#case $action in -#	Rename) -#		name="$(echo -n "$defnames" | dmenu -p "Rename tag $tagnum to: ")" -#		[ "$name" = "" ] && exit -#		nametag $tagnum n "$name" -#	;; -#	Remove)	nametag $tagnum r	;; -#	*)	exit			;; -#esac diff --git a/keyboard/dockfanctl b/keyboard/dockfanctl deleted file mode 100755 index f422b3e..0000000 --- a/keyboard/dockfanctl +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -hub=$(doas uhubctl | grep -B3 'Port 3: .* highspeed enable connect .* Lenovo USB2.0 Hub' | grep -o -m1 '[0-9][^ ]*' | head -n1) -! [ "$hub" ] && exit 1 - -echo $hub - -case $1 in -	off) doas uhubctl -a off -p 4 -l $hub ;; -	on)  doas uhubctl -a on  -p 4 -l $hub ;; -esac diff --git a/keyboard/sinkswitch b/keyboard/sinkswitch deleted file mode 100755 index 3046498..0000000 --- a/keyboard/sinkswitch +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -[ $(hostname) != 'T495' ] && echo "Not T495. Exiting" && exit 1 - -status="$(wpctl status)" - -headphones_sink=$(echo "$status" | grep -m1 'ThinkPad USB-C Dock Gen2 USB Audio Analog Stereo \[vol:'                        | grep -m1 -o '[0-9]*') -speakers_sink=$(  echo "$status" | grep -m1 'Raven/Raven2/Fenghuang HDMI/DP Audio Controller Digital Stereo (HDMI 2) \[vol:' | grep -m1 -o '[0-9]*') - -selected_sink=$(echo "$status" | grep -m1 '\*\s*[0-9]*' | grep -o '[0-9]*') - -case $selected_sink in -	$headphones_sink) wpctl set-default $speakers_sink   && echo "Switched to speakers"   ;; -	$speakers_sink)   wpctl set-default $headphones_sink && echo "Switched to headphones" ;; -	*) echo "Cannot find correct sink. Exiting" && exit 1 ;; -esac diff --git a/keyboard/volcon b/keyboard/volcon deleted file mode 100755 index 9940c67..0000000 --- a/keyboard/volcon +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -amixer -D pipewire sset Master $1 > /dev/null -dwmsbup 10 diff --git a/keyboard/wgconnect b/keyboard/wgconnect deleted file mode 100755 index de8f307..0000000 --- a/keyboard/wgconnect +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Connect to/disconnect from wireguard tunnel using dmenu - -sudo="${SUDO:-sudo}" -pass="$(xsudo --get-pass)" - -ssudo() { echo "$pass" | $sudo $@ ; } - -dmenu_confirm_continue() { -	case "$(echo "yes\nno" | dmenu -p "$1")" in -		yes) -		;; -		*) exit 0 ;; -	esac -} - -curtun="$(ssudo wg show | sed 's/interface: //;q')" - -# Ask to disconnect from current interface -if [ -n "$curtun" ]; then -	dmenu_confirm_continue "Currently connected to tunnel $curtun. Disconnect?" - -	output="$(ssudo wg-quick down "$curtun" 2>&1)" -	notify-send "Disconnected from $curtun" "$output" - -	dmenu_confirm_continue "Connect to another interface?" -fi - -# Connect to new interface -tundir=/etc/wireguard - -tun="$tundir/$(ssudo ls "$tundir" | grep "\.conf$" | dmenu -p "Connect to which tunnel?")" - -if ! ssudo cat $tun >/dev/null 2>/dev/null; then -	notify-send "Couldn't connect to tunnel $tun" -	exit 1 -fi - -output="$(ssudo wg-quick up "$tun" 2>&1)" -notify-send "Connected to $tun" "$output"  | 
