From 0bc1e6afda5f1a26986c3ac3c2c7d32899f2db14 Mon Sep 17 00:00:00 2001 From: Quentin Duchemin Date: Tue, 19 Nov 2019 16:31:30 +0100 Subject: [PATCH] Add a luminosity script (polybar plugin not working) --- .config/i3/config.d/laptop | 10 +++++++--- .config/polybar/config.d/laptop | 7 ++++++- .config/polybar/config_common | 2 +- .config/polybar/scripts/luminosity.sh.laptop | 4 ++++ 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100755 .config/polybar/scripts/luminosity.sh.laptop diff --git a/.config/i3/config.d/laptop b/.config/i3/config.d/laptop index 167bad4..0b8425c 100644 --- a/.config/i3/config.d/laptop +++ b/.config/i3/config.d/laptop @@ -14,9 +14,13 @@ workspace 6 output HDMI-0 bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D hw:PCH -M sset Master 5%+ bindsym XF86AudioLowerVolume exec --no-startup-id aimxer -D hw:PCH -M sset Master 5%- bindsym XF86AudioMute exec --no-startup-id amixer -D hw:PCH -M sset 'Master' toggle -bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause -bindsym XF86AudioPrev exec --no-startup-ip playerctl prev -bindsym XF86AudioNext exec --no-startup-id playerctl next + +# Luminosity on laptop (not xorg-xbacklight but the compatible and working acpilight) +bindsym XF86MonBrightnessDown exec --no-startup-id xbacklight -dec 10 -steps 200 +bindsym XF86MonBrightnessUp exec --no-startup-id xbacklight -inc 10 -steps 200 +bindsym XF86KbdBrightnessDown exec --no-startup-id xbacklight -ctrl asus::kbd_backlight -dec 30 +bindsym XF86KbdBrightnessUp exec --no-startup-id xbacklight -ctrl asus::kbd_backlight -inc 30 + # set DPI along with .Xresources exec xrandr --dpi 160 diff --git a/.config/polybar/config.d/laptop b/.config/polybar/config.d/laptop index 9e36aae..a08dc51 100644 --- a/.config/polybar/config.d/laptop +++ b/.config/polybar/config.d/laptop @@ -4,7 +4,12 @@ height = 54 wireless_interface = wlp2s0 top_left = powermenu system-uptime-pretty battery top_center = xwindow -top_right = system-usb-udev pulseaudio date +top_right = system-usb-udev luminosity pulseaudio date + +[module/luminosity] +type = custom/script +exec = ~/.config/polybar/scripts/luminosity.sh +interval = 1 [module/pulseaudio] type = internal/pulseaudio diff --git a/.config/polybar/config_common b/.config/polybar/config_common index 824dea5..5d13c28 100644 --- a/.config/polybar/config_common +++ b/.config/polybar/config_common @@ -81,7 +81,7 @@ label-maxlen=100 type = internal/network interface = ${variables.wireless_interface} interval = 1 -label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-}%downspeed% %{F#dd7777}%{F-}%upspeed% +label-connected = %{F#ddd}%essid%  %local_ip% %{F#77dd77}%{F-} %downspeed% %{F#dd7777}%{F-} %upspeed% label-disconnected = Ethernet disconnected label-disconnected-foreground = #66 diff --git a/.config/polybar/scripts/luminosity.sh.laptop b/.config/polybar/scripts/luminosity.sh.laptop new file mode 100755 index 0000000..9368159 --- /dev/null +++ b/.config/polybar/scripts/luminosity.sh.laptop @@ -0,0 +1,4 @@ +#!/bin/bash + +lum=$(xbacklight -get) +echo "%{F#77dd77}☀️%{F#ddd} ${lum}%"