aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2016-10-11 17:32:05 +0200
committerEduardo Pedroni <e.pedroni91@gmail.com>2016-10-11 17:32:05 +0200
commit27747d4a0fe84e415fcc4563a3a27b003250051e (patch)
tree33a4732756e9aae709ed3b63c6e998a579f22c9d
parent1c3692c7858d8cda08ba920fcf12135a41e327a1 (diff)
Added brightness display to dwm-statusbar, brightness keys to config.h (not necessary if acpi works properly)
-rw-r--r--config.h7
-rwxr-xr-xdwm-statusbar12
2 files changed, 18 insertions, 1 deletions
diff --git a/config.h b/config.h
index dec68c3..4071be1 100644
--- a/config.h
+++ b/config.h
@@ -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