summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-03-10 16:48:51 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-03-10 16:48:51 (EST)
commit5c1dc577453a8ea922b7c315f0f074ef51c8167c (patch)
tree3cf664655b529e5cf94e1113ef60754e5a34c6ae
parentb920a869d85771ef08127a4f916c35f602458b1a (diff)
downloadfluxbox-5c1dc577453a8ea922b7c315f0f074ef51c8167c.zip
fluxbox-5c1dc577453a8ea922b7c315f0f074ef51c8167c.tar.gz
fluxbox-5c1dc577453a8ea922b7c315f0f074ef51c8167c.tar.bz2
Add external battery and volume applet programs
-rw-r--r--.config/fbpanel/taskbar15
-rwxr-xr-x.gitignore.d/fluxbox3
-rwxr-xr-xbin/batmon44
-rwxr-xr-xbin/volmon10
4 files changed, 71 insertions, 1 deletions
diff --git a/.config/fbpanel/taskbar b/.config/fbpanel/taskbar
index ed24f19..6bc6688 100644
--- a/.config/fbpanel/taskbar
+++ b/.config/fbpanel/taskbar
@@ -58,7 +58,20 @@ Plugin {
expand = false
padding = 0
config {
- command = amixer get Master,0 | sed -n 's/^.*Playback [0-9]* \[\([0-9]*%\)\].*$/\1 ₎)/p'
+ command = /home/pj/bin/batmon
+ textsize = 10240
+ textcolor = #F3F3F5
+ pollingtime = 1
+ maxtextlength = 6
+ }
+}
+
+Plugin {
+ type = genmon
+ expand = false
+ padding = 0
+ config {
+ command = /home/pj/bin/volmon
textsize = 10240
textcolor = #F3F3F5
pollingtime = 1
diff --git a/.gitignore.d/fluxbox b/.gitignore.d/fluxbox
index 5185b48..a03616a 100755
--- a/.gitignore.d/fluxbox
+++ b/.gitignore.d/fluxbox
@@ -12,6 +12,9 @@
!/.config/
!/.config/fbpanel/
!/.config/fbpanel/*
+!/bin/
+!/bin/batmon
+!/bin/volmon
!/.fehbg
!/.gitignore.d/
!/.gitignore.d/fluxbox
diff --git a/bin/batmon b/bin/batmon
new file mode 100755
index 0000000..fec22b7
--- /dev/null
+++ b/bin/batmon
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+bat()
+{
+ eval "$(cat /sys/class/power_supply/BAT0/uevent | grep -E \
+ '^POWER_SUPPLY_(STATUS|ENERGY_)')"
+ percentage=$(printf 'scale = 0; %d * 100 / %d;\n' \
+ ${POWER_SUPPLY_ENERGY_NOW} ${POWER_SUPPLY_ENERGY_FULL} | bc)
+ case "${POWER_SUPPLY_STATUS}" in
+ 'Unknown')
+ status='?'
+ ;;
+ 'Charging')
+ status='⚡'
+ ;;
+ 'Discharging')
+ status='🔋'
+ ;;
+ 'Not charging')
+ status='!'
+ ;;
+ 'Full')
+ status='🔌'
+ ;;
+ esac
+ printf '%s%3d%%\n' "${status}" ${percentage}
+}
+
+ac()
+{
+ status='🔌'
+ printf '%s\n' "${status}"
+}
+
+main()
+{
+ if [ -e /sys/class/power_supply/BAT0/uevent ]; then
+ bat
+ else
+ ac
+ fi
+}
+
+main "${@}"
diff --git a/bin/volmon b/bin/volmon
new file mode 100755
index 0000000..0b1b87e
--- /dev/null
+++ b/bin/volmon
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+main()
+{
+ vol="$(amixer get Master,0 | \
+ sed -n 's/^.*Playback [0-9]* \[\([0-9]*\)%\].*$/\1/p')"
+ printf '🔉%3d%%\n' ${vol}
+}
+
+main "${@}"