diff options
-rw-r--r-- | config.h | 7 | ||||
-rwxr-xr-x | dwm-statusbar | 12 |
2 files changed, 18 insertions, 1 deletions
@@ -4,6 +4,8 @@ #define VOLDOWN 0x1008FF11 /* Volume control down */ #define VOLMUTE 0x1008FF12 /* Mute sound from the system */ #define VOLUP 0x1008FF13 /* Volume control up */ +#define BLUP 0x1008FF02 /* Monitor brightness up */ +#define BLDOWN 0x1008FF03 /* Monitor brightness down */ /* appearance */ static const char font[] = "DVIcons:size=8"; @@ -105,6 +107,9 @@ static const char *scrotcmd[] = { "scrot", "/home/eddy/screenshots/%Y-%m-%d- static const char *lowervolumecmd[] = { "amixer", "-q", "set", "Master", "2dB-", NULL }; static const char *raisevolumecmd[] = { "amixer", "-q", "set", "Master", "2dB+", NULL }; static const char *mutevolumecmd[] = { "amixer", "-q", "set", "Master", "toggle", NULL }; +static const char *raisebrightness[] = { "xbacklight", "-inc", "5", NULL }; +static const char *lowerbrightness[] = { "xbacklight", "-dec", "5", NULL }; + static Key keys[] = { /* modifier key function argument */ @@ -152,6 +157,8 @@ static Key keys[] = { { 0, VOLUP, spawn, {.v = raisevolumecmd } }, { 0, VOLDOWN, spawn, {.v = lowervolumecmd } }, { 0, VOLMUTE, spawn, {.v = mutevolumecmd } }, + { 0, BLUP, spawn, {.v = raisebrightness } }, + { 0, BLDOWN, spawn, {.v = lowerbrightness } }, { MODKEY|ShiftMask, XK_q, killclient, {0} }, { MODKEY|ShiftMask, XK_e, quit, {0} }, diff --git a/dwm-statusbar b/dwm-statusbar index 453488e..9891a29 100755 --- a/dwm-statusbar +++ b/dwm-statusbar @@ -30,6 +30,7 @@ print_date() { print_time() { time_local="$(date "+%H:%M")" #time_us="$(TZ='US/Central' date "+%H:%M")" + #time_br="$(TZ='America/Sao_Paulo' date "+%H:%M")" #echo -ne "${colour_neutral}\uE3D2${colour_normal}${time_local}${colour_faded}${time_us}" echo -ne "${colour_neutral}\uE3D2${colour_normal}${time_local}" @@ -61,6 +62,15 @@ print_volume() { echo -ne "${icon_colour}${icon}${vol_colour}${volume}%" } +# This is very system-dependent +print_backlight() { + # E3D8 + max_backlight=$(cat /sys/class/backlight/intel_backlight/max_brightness) + let backlight="100 * $(cat /sys/class/backlight/intel_backlight/brightness) / $max_backlight" + + echo -ne "${colour_neutral}\uE3D8${colour_normal}${backlight}%" +} + # This will probably need tweaking print_battery() { # charging E20D, empty E20E, full E20F, 2/3 E210, 1/3 E211 @@ -256,7 +266,7 @@ while true; do # Pipe to status bar # This is where you can adjust what gets shown by adding the desired function calls - xsetroot -name "$(print_eth)${space}$(print_root_free)${space}$(print_home_free)${space}$(print_shared_free)${space}$(print_cpu_used)${space}$(print_cpu_temp)${space}$(print_mem_free)${space}$(print_volume)${space}$(print_time)$(print_date)" + xsetroot -name "$(print_eth)${space}$(print_wlan)${space}$(print_root_free)${space}$(print_home_free)${space}$(print_cpu_used)${space}$(print_cpu_temp)${space}$(print_mem_free)${space}$(print_battery)${space}$(print_backlight)${space}$(print_volume)${space}$(print_time)$(print_date)" # reset old rate cpu_idle_old=$cpu_idle_now |