dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit a5524043b074bb8073ccee63605254eeff68e0b7
parent 053d7cda92d811f02cfcd9d7a321174f624f7a8a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Fri, 17 Apr 2020 16:23:24 +0200

Add symbol for active screenrecording in sysstatus

Diffstat:
M.local/bin/sysstatus | 64++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/.local/bin/sysstatus b/.local/bin/sysstatus @@ -2,73 +2,73 @@ separator="|" +# screenrecord +[ -f /tmp/screenrecord.pid ] && printf ' R %s' "$separator" + # mail -printf "%s" "$(mailstatus | sed "s/^/ /;s/\$/ $separator/;s/ |//")" +printf '%s' "$(mailstatus | sed "s/^/ /;s/\$/ $separator/;s/ |//")" # music -printf "%s" "$(mpc status | sed 1q | sed 's/^volume:.*$//;s/^/ /;s/$/ |/;s/ |//')" +printf '%s' "$(mpc status | sed 1q | sed 's/^volume:.*$//;s/^/ /;s/$/ |/;s/ |//')" # keymap -printf " %s $separator" "$(setxkbmap -print | sed -n '5s/^.*pc+//;5s/+.*$//;5p')" +printf ' %s %s' "$(setxkbmap -print | sed -n '5s/^.*pc+//;5s/+.*$//;5p')" "$separator" # audio volume if type mixerctl >/dev/null 2>&1; then if [ "$(mixerctl -n outputs.master.mute)" = "off" ]; then - printf " vol " + printf ' vol ' else - printf " M " + printf ' M ' fi - printf "%s" "$(echo $(mixerctl -n outputs.master | \ + printf '%s' "$(echo $(mixerctl -n outputs.master | \ sed 's/,.*//')/255*100 | bc -l | sed 's/\..*//')%" elif type amixer >/dev/null 2>&1; then - printf " vol %s" "$(amixer get Master | grep -o "[0-9]*%\|\[off\]")" + printf ' vol %s' "$(amixer get Master | grep -o "[0-9]*%\|\[off\]")" elif type pulsemixer >/dev/null 2>&1; then - printf " vol %s" "$(pulsemixer --get-volume | cut -d' ' -f1)%" + printf ' vol %s' "$(pulsemixer --get-volume | cut -d' ' -f1)%" fi -printf " $separator" +printf ' %s' "$separator" # cpu -printf " " +printf ' ' if type sensors >/dev/null 2>&1; then - printf "%s " "$(sensors | grep -n 'Core 0:' | awk '{print $3}')" + printf '%s ' "$(sensors | grep -n 'Core 0:' | awk '{print $3}')" elif type sysctl >/dev/null 2>&1; then - printf "%s " "$(sysctl hw.sensors.cpu0.temp0 | \ + printf '%s ' "$(sysctl hw.sensors.cpu0.temp0 | \ sed 's/.*=//;s/\.[0-9]* deg/°/')" fi if [ -f /proc/loadavg ]; then - printf "%s" "$(cut -f 1 -d' ' /proc/loadavg)" + printf '%s' "$(cut -f 1 -d' ' /proc/loadavg)" else - printf "%s" "$(uptime | sed 's/.*: \([0-9]*\.[0-9]*\),.*/\1/')" + printf '%s' "$(uptime | sed 's/.*: \([0-9]*\.[0-9]*\),.*/\1/')" fi -printf " $separator" +printf ' %s' "$separator" # battery if type apm >/dev/null 2>&1; then - printf " %s" "$(apm | grep -o -E "[0-9]+%")" - printf "%s" "$(apm | grep -o -E " [0-9]+ min")" - printf " $separator" + printf ' %s' "$(apm | grep -o -E "[0-9]+%")" + printf '%s' "$(apm | grep -o -E " [0-9]+ min")" + printf ' %s' "$separator" elif [ -d "/sys/class/power_supply/BAT0" ]; then - batstatus=$(sed -n 's/Charging/+/;s/Discharging/-/' \ - /sys/class/power_supply/${battery}/status | sed 's/Unknown//') - batlvl=$(cat /sys/class/power_supply/${battery}/capacity) - batremain=$(acpi -b | sed 1q |\ - sed -n 's/.*\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9].*$/\1/p') - printf " %s" "$(echo "${batstatus}${batlvl}% ${batremain}" | sed 's/ $//')" - printf " $separator" + batstatus="$(sed -n 's/Charging/+/;s/Discharging/-/' \ + /sys/class/power_supply/${battery}/status | sed 's/Unknown//')" + batlvl="$(cat /sys/class/power_supply/${battery}/capacity)" + batremain="$(acpi -b | sed 1q |\ + sed -n 's/.*\([0-9][0-9]:[0-9][0-9]\):[0-9][0-9].*$/\1/p')" + printf ' %s %s' "$(echo "${batstatus}${batlvl}% ${batremain}" | sed 's/ $//')" "$separator" fi # wlan if type ifconfig >/dev/null 2>&1; then - printf " %s" "$(ifconfig iwn0 | grep join | cut -f 3,8 -d' ')" - printf " $separator" + printf ' %s %s' "$(ifconfig iwn0 | grep join | cut -f 3,8 -d' ')" "$separator" elif type iwgetid >/dev/null 2>&1; then wlandev="$(find /sys/class/net/ -type l -name 'wlp*' -exec basename {} \;)" - printf " %s" "$(iwgetid -r $wlandev)" - printf " %s" "$(echo \ + printf ' %s' "$(iwgetid -r $wlandev)" + printf ' %s %s' "$(echo \ "0$(grep $wlandev /proc/net/wireless | awk '{print $3}')/70 * 100" |\ - bc -l | sed 's/\..*$//')%" - printf " $separator" + bc -l | sed 's/\..*$//')%" "$separator" fi # date -printf " %s" "$(date +'%F %a %T')" +printf ' %s' "$(date +'%F %a %T')"