From 5b14aadea1a182093e04f267cd5f5f33a4ae5a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 10:35:27 +0800 Subject: [PATCH 1/7] xmobar: update tomorrow events --- nix/configurations/vanadium/home/xmobar/xmobar.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix/configurations/vanadium/home/xmobar/xmobar.hs b/nix/configurations/vanadium/home/xmobar/xmobar.hs index 42755533..88837948 100644 --- a/nix/configurations/vanadium/home/xmobar/xmobar.hs +++ b/nix/configurations/vanadium/home/xmobar/xmobar.hs @@ -76,7 +76,8 @@ config = , "--target", "2025-09-16=snip snip" , "--target", "2025-10-13=no teef" , "--target", "2025-10-31=dragon book" - , "--target", "2025-12-22=escape my fate" + , "--target", "2025-11-29=à deux" + , "--target", "2025-12-30=seule" ] "" (60 &minute) From 14bc70c00a51936a78caed037ec2746d95283d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 17:45:45 +0800 Subject: [PATCH 2/7] vanadium/display: lower orchid brightness --- nix/configurations/vanadium/nixos/display.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index 6737924a..01003036 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -160,21 +160,13 @@ configs.allOff (configs.enableOrchid name) ]; + # seems like this display doesn't support DDC hooks.postswitch = lib.mkMerge [ (switches.setDPI {dpi = 100;}) (switches.setSoftwareBrightness { device = name; - brightness = 1; + brightness = 0.8; }) - # # seems like this display doesn't support DDC - # (switches.setDDCBrightness { - # modelName = "VG27AQL3A"; - # brightness = 0; - # }) - # (switches.setDDCContrast { - # modelName = "VG27AQL3A"; - # contrast = 0.5; - # }) ]; }; in From 7ffc11106acfb03794bc3e7ef228bf9264ff404f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 21:13:42 +0800 Subject: [PATCH 3/7] nixos/xscreensaver: add service to handle events --- nix/nixosModules/common/xscreensaver.nix | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 nix/nixosModules/common/xscreensaver.nix diff --git a/nix/nixosModules/common/xscreensaver.nix b/nix/nixosModules/common/xscreensaver.nix new file mode 100644 index 00000000..2359f830 --- /dev/null +++ b/nix/nixosModules/common/xscreensaver.nix @@ -0,0 +1,48 @@ +# +# This module provides a service react to xscreensaver events +# +{ + config, + lib, + ... +}: let + cfg = config.services.xscreensaver; +in { + options = { + services.xscreensaver.hooks = lib.mkOption { + type = with lib.types; attrsOf str; + description = "An attrset of events mapped a block of shell command to be run"; + default = {}; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.user.services = { + "xscreensaver-hooks" = { + description = "Run commands on xscreensaver events"; + after = ["graphical-session.target" "xscreensaver.service"]; + partOf = ["graphical-session.target"]; + wantedBy = ["graphical-session.target"]; + script = let + handlers = + lib.concatMapAttrsStringSep "\n" (event: action: '' + "${event}") + ( ${action} + ) + ;; + '') + cfg.hooks; + in '' + xscreensaver-command -watch | while read event rest; do + case $event in + ${handlers} + esac + done + ''; + path = [ + cfg.package # contains xscreensaver-command + ]; + }; + }; + }; +} From eb41cbc94a8f0ff3334c8b09ba8e0aeeda63c207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 21:14:04 +0800 Subject: [PATCH 4/7] vanadium/xscreensaver: configure event handler --- nix/configurations/vanadium.nix | 1 + nix/configurations/vanadium/nixos/gui.nix | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/nix/configurations/vanadium.nix b/nix/configurations/vanadium.nix index e34f3c58..c9e02c13 100644 --- a/nix/configurations/vanadium.nix +++ b/nix/configurations/vanadium.nix @@ -107,6 +107,7 @@ in ../nixosModules/common/network.nix ../nixosModules/common/sudo-conf.nix ../nixosModules/common/system-nixconf.nix + ../nixosModules/common/xscreensaver.nix ../nixosModules/extra/zram.nix ../nixosModules/extra/leana.nix diff --git a/nix/configurations/vanadium/nixos/gui.nix b/nix/configurations/vanadium/nixos/gui.nix index 7c0091f2..b96b9a65 100644 --- a/nix/configurations/vanadium/nixos/gui.nix +++ b/nix/configurations/vanadium/nixos/gui.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: { services.xserver.windowManager.xmonad = { enable = true; enableContribAndExtras = true; @@ -20,7 +24,15 @@ }; }; - services.xscreensaver.enable = true; + services.xscreensaver = { + enable = true; + hooks = { + # Reset display setting on login + "UNBLANK" = '' + ${lib.getExe pkgs.autorandr} --change --ignore-lid + ''; + }; + }; services.picom = { enable = true; From 1635fdc3a3efe574cee978ce74f995a7ab1ddad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 21:44:34 +0800 Subject: [PATCH 5/7] vanadium/autorandr: delay software brightness setting --- nix/configurations/vanadium/nixos/display.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index 01003036..b309b82f 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -61,7 +61,11 @@ device, # obtain with `xrandr` brightness, # [0..1] }: + # Hack: + # xrandr would consider the display being connected before we can change its brightness + # For that reason, we can't base our delay on its output, sadly. singleton "10_xrandr_brightness" '' + sleep 10 xrandr --output ${device} --brightness ${toString brightness} ''; From 0d557542729ea8fb203c61bd15cd8636d52a78a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 21:48:42 +0800 Subject: [PATCH 6/7] vanadium/autorandr: reference programs directly in hooks --- nix/configurations/vanadium/nixos/display.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index b309b82f..0de06ce0 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -51,7 +51,7 @@ switches = { setDPI = {dpi}: - singleton "10_xrdb-dpi" "xrdb -merge ${pkgs.writeText "xrdb-dpi-config" '' + singleton "10_xrdb-dpi" "${lib.getExe pkgs.xorg.xrdb} -merge ${pkgs.writeText "xrdb-dpi-config" '' Xcursor.size: 64 Xft.dpi: ${toString dpi} ''}"; @@ -66,7 +66,7 @@ # For that reason, we can't base our delay on its output, sadly. singleton "10_xrandr_brightness" '' sleep 10 - xrandr --output ${device} --brightness ${toString brightness} + ${lib.getExe pkgs.xorg.xrandr} --output ${device} --brightness ${toString brightness} ''; # Is scoped to an output device, no need to be called on built-in display @@ -75,7 +75,7 @@ brightness, # [0..1] }: singleton "10_ddc_brightness" '' - ddcutil --model ${modelName} setvcp 10 ${toString (builtins.floor (brightness * 100))} + ${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 10 ${toString (builtins.floor (brightness * 100))} ''; setDDCContrast = { @@ -83,7 +83,7 @@ contrast, # [0..1] }: singleton "10_ddc_contrast" '' - ddcutil --model ${modelName} setvcp 12 ${toString (builtins.floor (contrast * 100))} + ${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 12 ${toString (builtins.floor (contrast * 100))} ''; }; From 1727b0d121d36353354c117df6106dfd4dfc3d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 21 Oct 2025 22:00:05 +0800 Subject: [PATCH 7/7] vanadium/autorandr: update orchid brightness --- nix/configurations/vanadium/nixos/display.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index 0de06ce0..fbc65165 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -169,7 +169,7 @@ (switches.setDPI {dpi = 100;}) (switches.setSoftwareBrightness { device = name; - brightness = 0.8; + brightness = 0.7; }) ]; };