Backlight: Difference between revisions
imported>Samueldr m WIP, cleaning and re-working sections |
imported>Samueldr m Finalizes cleaning and re-working. |
||
Line 1: | Line 1: | ||
{{expansion}} | {{expansion}} | ||
This page documents methods for controlling backlight (aka screen brightness) and tips to control it via hotkeys. | This page documents methods for controlling backlight (aka screen brightness) and tips to control it via hotkeys. | ||
== Kernel native == | |||
Some laptops, using a recent enough kernel, will automatically handle increasing and decreasing the backlight using the hot keys. The following tools will allow scripting or controlling the backlight using other means, if desired. | |||
== Desktop Environment native == | |||
Some desktop environments will handle querying and setting the backlight, including configuring the backlight keys. These include at least: Plasma (KDE) and XFCE. It may be needed to configure or start some desktop environment-specific services. | |||
== <code>xbacklight</code> == | == <code>xbacklight</code> == | ||
Line 34: | Line 42: | ||
=== Key mapping === | === Key mapping === | ||
While controlling the backlight via the command line is useful, it would be preferable to control it using key bindings. This is especially true considering most laptops have backlight control keys. | |||
There are two main choices to add key bindings, using a system-level service like [[actkbd]] or using an X session tool, either provided by your [[Desktop environment]], [[Window manager]] or a tool like [[xbindkeys]]. | |||
Depending on the tools that work for controlling the backlight you will be able to choose one of those options. | |||
== | {| class="wikitable" border="1" | ||
|- | |||
! | |||
| <code>light</code> | |||
| <code>xbacklight</code> | |||
<code> | |- | ||
<code> | ! System service | ||
| Yes | |||
| With hacks | |||
|- | |||
! X session | |||
| Yes | |||
| Yes | |||
|} | |||
Follows, an example mapping for use with actkbd: | |||
{{note|This was verified to work NixOS 18.03 on a Lenovo T440; it may work on other models, but is unconfirmed. See [[actkbd]] for details on finding out the proper key bindings.}} | |||
<syntaxhighlight lang="nix">programs.light.enable = true; | <syntaxhighlight lang="nix"> | ||
services.actkbd = { | programs.light.enable = true; | ||
services.actkbd = { | |||
enable = true; | |||
bindings = [ | |||
{ keys = [ 224 ]; events = [ "key" ]; command = "/run/wrappers/bin/light -A 10"; } | |||
{ keys = [ 225 ]; events = [ "key" ]; command = "/run/wrappers/bin/light -U 10"; } | |||
};</syntaxhighlight> | ]; | ||
}; | |||
</syntaxhighlight> | |||
== See also == | == See also == | ||
* [https://wiki.archlinux.org/index.php/backlight Arch Linux wiki page about the backlight] | * [https://wiki.archlinux.org/index.php/backlight Arch Linux wiki page about the backlight] |