blob: db458d0390c2eb57f1d6740ea924be1708e57cb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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"
|