diff options
author | Eduardo Pedroni <ep625@york.ac.uk> | 2015-04-12 15:43:33 +0200 |
---|---|---|
committer | Eduardo Pedroni <ep625@york.ac.uk> | 2015-04-12 15:43:33 +0200 |
commit | 98250e6bdac973bcf0c108546e8df51f5be0c5e4 (patch) | |
tree | ce0783d6e940f9ecef9d179011cc45fb32ac5687 | |
parent | 6fb8bcc8569d06e17a8b48341d9386dda7626347 (diff) |
Messing with disk usage in statusbar, fixed a minor bug in dwm.c
-rwxr-xr-x | dwm | bin | 36504 -> 36504 bytes | |||
-rwxr-xr-x | dwm-statusbar | 59 | ||||
-rw-r--r-- | dwm.c | 2 | ||||
-rw-r--r-- | dwm.o | bin | 41964 -> 41964 bytes |
4 files changed, 40 insertions, 21 deletions
Binary files differ diff --git a/dwm-statusbar b/dwm-statusbar index 8e567d5..def1fd3 100755 --- a/dwm-statusbar +++ b/dwm-statusbar @@ -56,31 +56,51 @@ print_battery() { # charging E20D, empty E20E, full E20F, 2/3 E210, 1/3 E211 # 1 or 0 ac_status=$(cat /sys/class/power_supply/AC/online) - bat_capacity=$(cat /sys/class/power_supply/BAT0/capacity) if [ $ac_status -eq 1 ]; then - bat_colour=$colour_normal icon_colour=$colour_neutral - icon="\uE20D" - elif [ $bat_capacity -lt 10 ]; then - bat_colour=$colour_critical - icon_colour=$colour_critical - icon="\uE20E" - elif [ $bat_capacity -lt 33 ]; then - bat_colour=$colour_warning - icon_colour=$colour_warning - icon="\uE211" - elif [ $bat_capacity -lt 66 ]; then - bat_colour=$colour_normal - icon_colour=$colour_neutral - icon="\uE210" + if [ -d "/sys/class/power_supply/BAT0" ]; then + icon="\uE20D" + bat_colour=$colour_normal + bat_capacity="$(cat /sys/class/power_supply/BAT0/capacity)%" + else + icon="\uE257" + fi else - bat_colour=$colour_normal - icon_colour=$colour_neutral - icon="\uE20F" + bat_capacity=$(cat /sys/class/power_supply/BAT0/capacity) + if [ $bat_capacity -lt 10 ]; then + bat_colour=$colour_critical + icon_colour=$colour_critical + icon="\uE20E" + elif [ $bat_capacity -lt 25 ]; then + bat_colour=$colour_warning + icon_colour=$colour_warning + icon="\uE211" + elif [ $bat_capacity -lt 50 ]; then + bat_colour=$colour_normal + icon_colour=$colour_neutral + icon="\uE1FB" + elif [ $bat_capacity -lt 75 ]; then + bat_colour=$colour_normal + icon_colour=$colour_neutral + icon="\uE210" + else + bat_colour=$colour_normal + icon_colour=$colour_neutral + icon="\uE20F" + fi + bat_capacity="${bat_capacity}%" fi - echo -ne "${icon_colour}${icon}${bat_colour}${bat_capacity}%" + echo -ne "${icon_colour}${icon}${bat_colour}${bat_capacity}" +} + +print_sda1_free() { + sda1_free=$(df -kh /) + + + + echo -ne "${sda1_free}" } print_mem_free() { @@ -155,7 +175,6 @@ print_eth() { eth_colour=${colour_normal} else icon_colour=${colour_faded} - eth_colour=${colour_normal} fi echo -ne "${icon_colour}\uE0E4${eth_colour}${eth_ip}" @@ -723,7 +723,7 @@ createmon(void) { m->sellt = 0; m->lt[0] = &layouts[def_layouts[1] % LENGTH(layouts)]; m->lt[1] = &layouts[1 % LENGTH(layouts)]; - strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol); + strncpy(m->ltsymbol, layouts[def_layouts[1]].symbol, sizeof m->ltsymbol); if(!(m->pertag = (Pertag *)calloc(1, sizeof(Pertag)))) die("fatal: could not malloc() %u bytes\n", sizeof(Pertag)); m->pertag->curtag = m->pertag->prevtag = 1; Binary files differ |