i3pystatus
i3pystatus copied to clipboard
Add light support to backlight module
This PR introduces support to Light (https://github.com/haikarainen/light) support in backlight
module, as a alternative program to control backlight. It uses sysfs files and udev rules instead of through a X protocol like xbacklight
, so it works in non-X environments (for example, in sway
). Also, it seems more reliable and works where xbacklight
does not work (like when using xf86-modesetting
instead of xf86-video-intel
driver).
It is already supported in the official repositories in multiple distros (like Arch, Fedora and NixOS), so it seems to be a much better supported alternative than other programs that do something similar (like https://github.com/wavexx/acpilight/).
Since this needs to be explicitly set by the user now, I removed the check for the binary. If the user sets adjust_method
to either xbacklight
or light
, it just assumes that either xbacklight
or light
is installed. However, setting it wrong does not bring any problems either (except the inability to change brightness, of course).
This PR also allows the user to set format_no_backlight
to empty string and hide backlight module in case the system does not have a backlight (i.e.:, again, in a Desktop). If you set to an empty string nowadays it results the same output as the default one, resulting in something like Brightness: -1 output.
Substitutes PR https://github.com/enkore/i3pystatus/pull/747.
Tested:
- Notebook, with
adjust_method
set toxbacklight
,light
and default (None
). - Desktop, with
format_no_backlight
set to empty string.
@enkore
Can anyone help review/merge this? xbacklight
only works with Intel (according to ArchWiki) so I can't utilize this plugin to adjust my AMD laptop. Thanks!