summaryrefslogtreecommitdiff
path: root/keyboard
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2022-11-28 07:45:30 -0600
committerTimmy Keller <tjk@tjkeller.xyz>2022-11-28 07:45:30 -0600
commit4a38bb5e2b157dce33dd6a5058dece371a9e7161 (patch)
tree95097dd80b2e48afcbeeac494f1e97e1d4a578af /keyboard
parent521bc70d8a81334945a498c1ff09de45554c0fe9 (diff)
downloadscripts-4a38bb5e2b157dce33dd6a5058dece371a9e7161.tar.xz
scripts-4a38bb5e2b157dce33dd6a5058dece371a9e7161.zip
asdf
Diffstat (limited to 'keyboard')
-rwxr-xr-xkeyboard/bl13
-rwxr-xr-xkeyboard/shutdownprompt11
-rwxr-xr-xkeyboard/volcon2
3 files changed, 24 insertions, 2 deletions
diff --git a/keyboard/bl b/keyboard/bl
index 34ea0b0..75a0b4b 100755
--- a/keyboard/bl
+++ b/keyboard/bl
@@ -6,7 +6,8 @@ bl_min=0
bl_max=100
# DDC/CI stuff
-ddcutil="ddcutil --sleep-less --noverify --enable-capabilities-cache --sleep-multiplier $sleep_multiplier" # Make sure user is in group i2c
+ddcutil="ddcutil --sleep-less --noverify --sleep-multiplier $sleep_multiplier" # Make sure user is in group i2c
+#ddcutil="ddcutil --sleep-less --noverify --enable-capabilities-cache --sleep-multiplier $sleep_multiplier" # Make sure user is in group i2c
max() { [ $1 -gt $2 ] && echo $1 || echo $2; }
min() { [ $1 -lt $2 ] && echo $1 || echo $2; }
@@ -17,9 +18,19 @@ ddc_dec() { ddc_set $(max $(( `ddc_get` - $1 )) $bl_min) $2; }
forall() { for d in $(seq `xrandr | grep ' connected' | wc -l`); do ($1 $2 $d); done; }
+i2c_group() {
+ sudo=${SUDO:-sudo}
+ ! $sudo -n true && echo "Please try again with root permissions!" && exit
+ grep '^i2c' /etc/groups && echo "i2c group already exists!" && exit
+ $sudo groupadd --system i2c && \
+ $sudo cp /usr/share/ddcutil/data/45-ddcutil-i2c.rules /etc/udev/rules.d && \
+ echo "i2c group successfully added! Now add your user to it"
+}
+
case $1 in
set) forall ddc_set $2 ;;
get) forall ddc_get && echo '%' ;;
inc) forall ddc_inc $2 ;;
dec) forall ddc_dec $2 ;;
+ i2c-groupadd) i2c_group ;;
esac
diff --git a/keyboard/shutdownprompt b/keyboard/shutdownprompt
index b56268d..7654f2f 100755
--- a/keyboard/shutdownprompt
+++ b/keyboard/shutdownprompt
@@ -1,6 +1,17 @@
#!/bin/sh
dmenucolors='-nb #AA0000 -nf #FFF -sb #FF0000 -sf #FFF'
[ -n "$1" ] && option="$1" || option=$(echo "Cancel\nSuspend\nShutdown\nRestart" | dmenu -p "Power Menu " $dmenucolors || exit)
+
+warn_process_names="ffmpeg obs dnf xbps-install xbps-remove emerge apt pacman"
+
+for process_name in $warn_process_names; do
+ if pgrep $process_name >/dev/null; then
+ cancel=$(echo "Cancel\nProceed" | dmenu -p "Are you sure you want to shut down while $process_name is still running?" $dmenucolors)
+ [ "$cancel" = "Proceed" ] && continue
+ exit
+ fi
+done
+
case $option in
Suspend) launch zzz ;;
Shutdown) launch off ;;
diff --git a/keyboard/volcon b/keyboard/volcon
index 1891929..9940c67 100755
--- a/keyboard/volcon
+++ b/keyboard/volcon
@@ -1,3 +1,3 @@
#!/bin/sh
-amixer -M sset Master $1 > /dev/null
+amixer -D pipewire sset Master $1 > /dev/null
dwmsbup 10