aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <ep625@york.ac.uk>2015-04-12 15:43:33 +0200
committerEduardo Pedroni <ep625@york.ac.uk>2015-04-12 15:43:33 +0200
commit98250e6bdac973bcf0c108546e8df51f5be0c5e4 (patch)
treece0783d6e940f9ecef9d179011cc45fb32ac5687
parent6fb8bcc8569d06e17a8b48341d9386dda7626347 (diff)
Messing with disk usage in statusbar, fixed a minor bug in dwm.c
-rwxr-xr-xdwmbin36504 -> 36504 bytes
-rwxr-xr-xdwm-statusbar59
-rw-r--r--dwm.c2
-rw-r--r--dwm.obin41964 -> 41964 bytes
4 files changed, 40 insertions, 21 deletions
diff --git a/dwm b/dwm
index 7898693..87fad03 100755
--- a/dwm
+++ b/dwm
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}"
diff --git a/dwm.c b/dwm.c
index e26df85..6e90d4c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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;
diff --git a/dwm.o b/dwm.o
index 3ff9394..7b71e0f 100644
--- a/dwm.o
+++ b/dwm.o
Binary files differ