summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/cycleKB6
-rwxr-xr-xbin/extra/saveself41
2 files changed, 44 insertions, 3 deletions
diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB
index 402a8f5..8f0de60 100755
--- a/bin/extra/cycleKB
+++ b/bin/extra/cycleKB
@@ -4,7 +4,7 @@ list_layouts()
{
cat <<EOF
us
-colemak -option ctrl:swapcaps,altwin:menu_win
+us -variant colemak -option ctrl:swapcaps,altwin:menu_win
EOF
}
@@ -30,9 +30,9 @@ Layout="$(list_layouts | sed -n "${IndexLayout}p" )"
>&2 printf 'Layout: %s\n' "$Layout"
setxkbmap $Layout &
sed -i "\$s/.*/$Layout/" "$ProgramPath"
-notify-send "_cycleKB" "*${Layout%% -*}" &
+notify-send "_cycleKB" "*${Layout%% -option*}" &
exit
# THIS LINE IS ADDED AUTOMATICALLY
-colemak -option ctrl:swapcaps,altwin:menu_win
+us -variant colemak -option ctrl:swapcaps,altwin:menu_win
diff --git a/bin/extra/saveself b/bin/extra/saveself
new file mode 100755
index 0000000..8906a5f
--- /dev/null
+++ b/bin/extra/saveself
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+Threshold=5
+
+GetBatteryCapacity()
+{
+ File="$(find /sys/class/power_supply \
+ -maxdepth 1 \
+ -type l \
+ -name 'BAT*' |
+ head -n 1)"
+ cat "$File"/capacity
+}
+
+PrevCapacity="$(GetBatteryCapacity)"
+[ "$PrevCapacity" ] || exit 1
+
+while true
+do
+ sleep 5
+ Capacity="$(GetBatteryCapacity)"
+ if [ "$Capacity" -lt "$PrevCapacity" ]
+ then
+ if [ "$Capacity" -le "$Threshold" ]
+ then
+ setsid slock
+ HostName="$(hostname)"
+ if [ "$HostName" = "spring" ]
+ then
+ doas /usr/sbin/zzz -Z
+ elif [ "$HostName" = "winter" ]
+ then
+ systemctl hibernate
+ fi
+ fi
+ PrevCapacity="$Capacity"
+ fi
+done
+
+
+