Browse Source

Merge pull request #5 from geistesk/bar-loadavg

Add dwm_loadavg to display the average system load
main
Joe Standring 4 years ago
committed by GitHub
parent
commit
ad14dce207
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 1 deletions
  1. +6
    -0
      README.md
  2. +26
    -0
      bar-functions/dwm_loadavg.sh
  3. +2
    -1
      dwm_bar.sh

+ 6
- 0
README.md View File

@ -22,6 +22,7 @@ A modular statusbar for dwm
- [dwm_ccurse](#dwm_ccurse)
- [dwm_transmission](#dwm_transmission)
- [dwm_backlight](#dwm_backlight)
- [dwm_loadavg](#dwm_loadavg)
- [Installation](#installation)
- [Reccomendations](#reccomendations)
- [Usage](#usage)
@ -140,6 +141,11 @@ Displays the current backlight level with xbacklight
[☀ 80]
```
Dependencies: ```xbacklight```
### dwm_loadavg
Displays the average system load
```
[⏱ 0.14 0.17 0.18]
```
## Installation
1. Clone and enter the repository:
```


+ 26
- 0
bar-functions/dwm_loadavg.sh View File

@ -0,0 +1,26 @@
#!/bin/sh
# A dwm_bar function to read the average system load
# Alvar Penning <post@0x21.biz>
# GNU GPLv3
dwm_loadavg () {
# LOAD_FIELDS specifies the load average values to be displayed. Values
# within 1-3 are allowed, passed as a range (-) or comma-separated.
# - 1: load average within the last minute
# - 2: load average within the last five minutes
# - 3: load average within the last fifteen minutes
LOAD_FIELDS=1,2,3
LOAD_AVG=$(cut -d " " -f ${LOAD_FIELDS} /proc/loadavg)
printf "%s" "$SEP1"
if [ "$IDENTIFIER" = "unicode" ]; then
printf "⏱ %s" "$LOAD_AVG"
else
printf "AVG %s" "$LOAD_AVG"
fi
printf "%s\n" "$SEP2"
}
dwm_loadavg

+ 2
- 1
dwm_bar.sh View File

@ -40,10 +40,11 @@ export SEP2="]"
. "$DIR/bar-functions/dwm_keyboard.sh"
. "$DIR/bar-functions/dwm_ccurse.sh"
. "$DIR/bar-functions/dwm_date.sh"
. "$DIR/bar-functions/dwm_loadavg.sh"
# Update dwm status bar every second
while true
do
xsetroot -name "$(dwm_countdown)$(dwm_alarm.sh)$(dwm_transmission)$(dwm_cmus)$(dwm_mpc)$(dwm_spotify)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_backlight)$(dwm_alsa)$(dwm_pulse)$(dwm_weather)$(dwm_vpn)$(dwm_networkmanager)$(dwm_keyboard)$(dwm_ccurse)$(dwm_date)"
xsetroot -name "$(dwm_countdown)$(dwm_alarm.sh)$(dwm_transmission)$(dwm_cmus)$(dwm_mpc)$(dwm_spotify)$(dwm_resources)$(dwm_battery)$(dwm_mail)$(dwm_backlight)$(dwm_alsa)$(dwm_pulse)$(dwm_weather)$(dwm_vpn)$(dwm_networkmanager)$(dwm_keyboard)$(dwm_ccurse)$(dwm_date)$(dwm_loadavg)"
sleep 1
done

Loading…
Cancel
Save