mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-09-01 08:07:14 +02:00
feat(shoukei): enable wluma ambient-light auto brightness
- read Asahi aop-sensors ALS via iio and drive eDP-1 backlight - drop PrivateUsers for wluma so it can reach the real user D-Bus session - remove hypridle 10min screen-dim listener: its brightnessctl writes fight wluma and get learned as manual adjustments
This commit is contained in:
@@ -4,7 +4,10 @@ let
|
|||||||
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ../../linux/gui.nix ];
|
imports = [
|
||||||
|
../../linux/gui.nix
|
||||||
|
./12kingdoms-shoukei/wluma.nix
|
||||||
|
];
|
||||||
|
|
||||||
programs.ssh.settings."github.com".IdentityFile = "${config.home.homeDirectory}/.ssh/${hostName}";
|
programs.ssh.settings."github.com".IdentityFile = "${config.home.homeDirectory}/.ssh/${hostName}";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{ ... }:
|
||||||
|
# Automatic brightness for shoukei (the only host with an ambient light
|
||||||
|
# sensor: aop-sensors-als, exposed through iio-sensor-proxy).
|
||||||
|
#
|
||||||
|
# wluma learns brightness preferences from manual adjustments (the QuickShell
|
||||||
|
# slider counts as training data), then adjusts the backlight automatically
|
||||||
|
# based on ambient light + screen contents.
|
||||||
|
#
|
||||||
|
# gamma = false keeps color temperature handled by noctalia's NightLight
|
||||||
|
# (zwlr-gamma-control is an exclusive protocol, wluma and noctalia cannot
|
||||||
|
# both own it). Other hosts keep the existing time-based NightLight setup.
|
||||||
|
#
|
||||||
|
# No extra udev rules or ACLs are needed: the sysfs brightness node is
|
||||||
|
# root-owned, so wluma falls back to the systemd-logind D-Bus API
|
||||||
|
# (org.freedesktop.login1.Session.SetBrightness), which authorizes active
|
||||||
|
# sessions. Verified working inside Home Manager's default PrivateUsers
|
||||||
|
# sandbox; do not "fix" it by disabling the sandbox.
|
||||||
|
{
|
||||||
|
services.wluma = {
|
||||||
|
enable = true;
|
||||||
|
# Exactly one top-level ALS section is mandatory in wluma's config.
|
||||||
|
# The als.iio path scans /sys/bus/iio/devices and picks up the AOP
|
||||||
|
# ambient light sensor (aop-sensors-als) exported via iio-sensor-proxy.
|
||||||
|
settings.als.iio = {
|
||||||
|
path = "/sys/bus/iio/devices";
|
||||||
|
thresholds = {
|
||||||
|
"0" = "night";
|
||||||
|
"20" = "dark";
|
||||||
|
"80" = "dim";
|
||||||
|
"250" = "normal";
|
||||||
|
"500" = "bright";
|
||||||
|
"800" = "outdoors";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
settings.output.backlight = [
|
||||||
|
{
|
||||||
|
name = "eDP-1";
|
||||||
|
path = "/sys/class/backlight/apple-panel-bl";
|
||||||
|
gamma = false;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -13,11 +13,11 @@ listener {
|
|||||||
on-resume = brightnessctl --restore --device=kbd_backlight # turn on keyboard backlight.
|
on-resume = brightnessctl --restore --device=kbd_backlight # turn on keyboard backlight.
|
||||||
}
|
}
|
||||||
|
|
||||||
listener {
|
# NOTE: intentionally no 10min screen-dim listener here. Writing brightnessctl
|
||||||
timeout = 600 # 10min.
|
# directly fights the ambient-light auto-brightness daemon (wluma on shoukei):
|
||||||
on-timeout = brightnessctl -s set 10 # set monitor backlight to minimum, avoid 0 on OLED monitor.
|
# wluma is adaptive, and hypridle's periodic brightness writes get learned as if
|
||||||
on-resume = brightnessctl -r # monitor backlight restore.
|
# the user had made those adjustments. niri (26.04) has no built-in idle timers,
|
||||||
}
|
# so hypridle stays responsible for keyboard backlight, dpms and locking below.
|
||||||
|
|
||||||
listener {
|
listener {
|
||||||
timeout = 1200 # 20 minutes
|
timeout = 1200 # 20 minutes
|
||||||
|
|||||||
Reference in New Issue
Block a user