diff options
Diffstat (limited to '.local/bin/sb-scripts/sb-mouse')
-rwxr-xr-x | .local/bin/sb-scripts/sb-mouse | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/.local/bin/sb-scripts/sb-mouse b/.local/bin/sb-scripts/sb-mouse new file mode 100755 index 0000000..db458d0 --- /dev/null +++ b/.local/bin/sb-scripts/sb-mouse @@ -0,0 +1,26 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) setsid -f solaar >/dev/null 2>&1 ;; + 3) notify-send "🖱️ Mouse module" "\- Shows mouse battery percentage +- Shows ⚡ if charging +- Click to open Solaar +- Middle click to update battery status + " ;; + 8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" >/dev/null 2>&1 ;; +esac + +percentage=$(solaar show 2>/dev/null \ + | awk '/Battery:/ { + percent=$2; status=$3; + gsub(",", "", percent); + gsub("\\.", "", status); + if (status == 1) { + print "🖱️⚡" percent; + } else { + print "🖱️" percent; + } + exit + }') + +echo "$percentage" |