From 2f4be43611f50d64ea09e29e2391c72110a4bd05 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Thu, 18 Jun 2015 17:26:58 +0200 Subject: Tweaked bar colours, dwm-statusbar is now parch version, bear that in mind --- dwm | Bin 36504 -> 36412 bytes dwm-statusbar | 100 ++++++++++++---------------------------------------------- dwm.c | 2 +- dwm.o | Bin 41964 -> 41816 bytes 4 files changed, 21 insertions(+), 81 deletions(-) diff --git a/dwm b/dwm index 87fad03..b1cb907 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm-statusbar b/dwm-statusbar index def1fd3..341c9fc 100755 --- a/dwm-statusbar +++ b/dwm-statusbar @@ -1,7 +1,5 @@ #!/usr/bin/env bash # -# ~/scripts/dwm-statusbar -# # Status bar for dwm. Adapted from: # https://github.com/w0ng/bin/blob/master/dwm-statusbar @@ -22,7 +20,7 @@ print_date() { print_time() { time_local="$(date "+%H:%M")" time_us="$(TZ='US/Central' date "+%H:%M")" - + echo -ne "${colour_neutral}\uE3D2${colour_normal}${time_local}${colour_faded}${time_us}" } @@ -52,55 +50,23 @@ print_volume() { echo -ne "${icon_colour}${icon}${vol_colour}${volume}%" } -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) +print_sda1_free() { + # floppy E0C3 + sda1_free=$(df -kh / | awk 'NR==2 {print $4}') + sda1_percent=$(df -kh / | awk 'NR==2 {print $5}' | sed 's/%//g') - if [ $ac_status -eq 1 ]; then - icon_colour=$colour_neutral - 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 + if [ $sda1_percent -gt 90 ]; then + icon_colour=$colour_critical + sda1_colour=$colour_critical + elif [ $sda1_percent -gt 75 ]; then + icon_colour=$colour_warning + sda1_colour=$colour_warning else - 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}%" + icon_colour=$colour_neutral + sda1_colour=$colour_normal fi - echo -ne "${icon_colour}${icon}${bat_colour}${bat_capacity}" -} - -print_sda1_free() { - sda1_free=$(df -kh /) - - - - echo -ne "${sda1_free}" + echo -ne "${icon_colour}\uE0C3${sda1_colour}${sda1_free}" } print_mem_free() { @@ -120,14 +86,14 @@ print_mem_free() { } print_cpu_temp() { - cpu_temp=$(sensors | awk 'NR==3 {print $3}' | sed -r 's/\+([0-9]+).*/\1/') + cpu_temp=$(sensors -u | awk '/Core 0/ {getline; print $2}' | sed -r 's/([0-9]*)\.[0-9]*/\1/') temp_colour=$colour_normal icon_colour=$colour_neutral - if [ $cpu_temp -gt 80 ]; then + if [ $cpu_temp -gt 83 ]; then temp_colour=$colour_critical icon_colour=$colour_critical - elif [ $cpu_temp -gt 60 ]; then + elif [ $cpu_temp -gt 99 ]; then temp_colour=$colour_warning icon_colour=$colour_warning fi @@ -140,37 +106,11 @@ print_cpu_used() { echo -ne "${colour_neutral}\uE3AF${colour_normal}${cpu_used}%" } -print_wifi() { - wifi_status=$(ip addr show dev wlan0 | awk 'NR==1 {print $9}') - - if [ "$wifi_status" == "UP" ]; then - let wifi_strength="10 * $(cat /proc/net/wireless | awk 'NR==3 {print substr($3, 1, 2)}') / 7" - if [ $wifi_strength -lt 25 ]; then - icon_colour=${colour_critical} - wifi_colour=${colour_critical} - elif [ $wifi_strength -lt 50 ]; then - icon_colour=${colour_warning} - wifi_colour=${colour_warning} - else - icon_colour=${colour_neutral} - wifi_colour=${colour_normal} - fi - - wifi_strength="${wifi_strength}%" - wifi_ip=$(ip addr show dev wlan0 | awk 'NR==3 {print $2}' | sed -r 's/\/.*/, /') - - else - icon_colour=${colour_faded} - fi - - echo -ne "${icon_colour}\uE401${wifi_colour}${wifi_ip}${wifi_strength}" -} - print_eth() { - eth_status=$(ip addr show dev enp3s0 | awk 'NR==1 {print $9}') + eth_status=$(ip addr show dev enp4s0 | awk 'NR==1 {print $9}') if [ "$eth_status" == "UP" ]; then - eth_ip=$(ip addr show dev enp3s0 | awk 'NR==3 {print $2}' | sed -r 's/\/.*//') + eth_ip=$(ip addr show dev enp4s0 | awk 'NR==3 {print $2}' | sed -r 's/\/.*//') icon_colour=${colour_neutral} eth_colour=${colour_normal} else @@ -188,7 +128,7 @@ while true; do let cpu_used="100 * ($cpu_interval - ($cpu_idle_now-${cpu_idle_old:-0})) / $cpu_interval" # Pipe to status bar - xsetroot -name "$(print_eth)${space}$(print_wifi)${space}$(print_cpu_used)${space}$(print_cpu_temp)${space}$(print_mem_free)${space}$(print_battery)${space}$(print_volume)${space}$(print_time)$(print_date)" + xsetroot -name "$(print_eth)${space}$(print_sda1_free)${space}$(print_cpu_used)${space}$(print_cpu_temp)${space}$(print_mem_free)${space}$(print_volume)${space}$(print_time)$(print_date)" # reset old rate cpu_idle_old=$cpu_idle_now diff --git a/dwm.c b/dwm.c index 6e90d4c..fb39eee 100644 --- a/dwm.c +++ b/dwm.c @@ -937,7 +937,7 @@ drawtab(Monitor *m) { if(i >= m->ntabs) break; if(m->tab_widths[i] > maxsize) m->tab_widths[i] = maxsize; dc.w = m->tab_widths[i]; - col = (c == m->sel) ? 1 : (c->isurgent ? 2 : 0); + col = (c == m->sel) ? 1 : (c->isurgent ? 2 : 4); drawtext(dc.tabdrawable, c->name, col, True); dc.x += dc.w; ++i; diff --git a/dwm.o b/dwm.o index 7b71e0f..330ba89 100644 Binary files a/dwm.o and b/dwm.o differ -- cgit v1.2.3