dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 76c1bacedcc0df33588c9160d0c152ecb13b70c1
parent 63b6ea3f123f4105207b0642e8b0a492e770ec65
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sat, 25 Mar 2023 18:34:43 -0400

Add icons/wifi/sound to spectrwm bar

Diffstat:
M.config/spectrwm/spectrwm.conf | 13+++++++------
M.local/bin/bar-action | 30+++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/.config/spectrwm/spectrwm.conf b/.config/spectrwm/spectrwm.conf @@ -1,10 +1,11 @@ # Bar -bar_border_width = 0 -bar_font = IBM Plex Mono:size=10:style=Regular -bar_format = +L(+M) +C +|C+A +|R%A, %d-%b-%Y, %H:%M -bar_action = bar-action -bar_color = grey -bar_font_color = black +bar_border_width = 0 +bar_font = IBM Plex Mono:size=10:style=Regular,TerminessTTF Nerd Font Mono:size=16:style=Medium +bar_format = +L(+M) +C +|C+A +|R%A, %d-%b-%Y, %H:%M +bar_action = bar-action +bar_color = grey +bar_font_color = black +bar_action_expand = 1 workspace_indicator = listall,markcurrent,markurgent,markactive,markempty,noindexes workspace_limit = 6 diff --git a/.local/bin/bar-action b/.local/bin/bar-action @@ -2,13 +2,33 @@ while :; do vmstats=$(vmstat -c2 | tail -1) - cpu=$(echo $vmstats | awk '{print 100-$NF}') + cpu="$(echo $vmstats | awk '{print 100-$NF}')"% mem=$(echo $vmstats | awk '{print $3}') dsk=$(df -h /home | tail -1 | awk '{print $5}') - bat=$(apm -l) - if (sysctl hw.sensors.acpibat0 | grep raw0=2); then - echo "cpu: $cpu% | mem: $mem | dsk: $dsk | bat: $bat%+" + bat="$(apm -l)" + if [ $bat -gt 90 ]; then + baticon="" + elif [ $bat -gt 60 ]; then + baticon="" + elif [ $bat -gt 30 ]; then + baticon="" + elif [ $bat -gt 10 ]; then + baticon="" else - echo "cpu: $cpu% | mem: $mem | dsk: $dsk | bat: $bat%" + baticon="" fi + if [ "$(apm -b)" = "3" ]; then + bat="$bat+" + fi + if [ "$(ifconfig iwm0 | grep status | awk '{print $2}')" = "active" ]; then + net="直" + else + net="睊" + fi + if [ "$(sndioctl output.mute | cut -d'=' -f2)" = "1" ]; then + snd="" + else + snd="" + fi + echo "+@fn=1;+@fn=0; $cpu | +@fn=1;+@fn=0; $mem | +@fn=1;+@fn=0; $dsk | +@fn=1;$baticon+@fn=0; $bat% | +@fn=1;$net+@fn=0; | +@fn=1;$snd+@fn=0;" done