mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
Compare commits
7 commits
d638f445e3
...
1727b0d121
| Author | SHA1 | Date | |
|---|---|---|---|
| 1727b0d121 | |||
| 0d55754272 | |||
| 1635fdc3a3 | |||
| eb41cbc94a | |||
| 7ffc11106a | |||
| 14bc70c00a | |||
| 5b14aadea1 |
5 changed files with 75 additions and 17 deletions
|
|
@ -107,6 +107,7 @@ in
|
||||||
../nixosModules/common/network.nix
|
../nixosModules/common/network.nix
|
||||||
../nixosModules/common/sudo-conf.nix
|
../nixosModules/common/sudo-conf.nix
|
||||||
../nixosModules/common/system-nixconf.nix
|
../nixosModules/common/system-nixconf.nix
|
||||||
|
../nixosModules/common/xscreensaver.nix
|
||||||
|
|
||||||
../nixosModules/extra/zram.nix
|
../nixosModules/extra/zram.nix
|
||||||
../nixosModules/extra/leana.nix
|
../nixosModules/extra/leana.nix
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,8 @@ config =
|
||||||
, "--target", "2025-09-16=snip snip"
|
, "--target", "2025-09-16=snip snip"
|
||||||
, "--target", "2025-10-13=no teef"
|
, "--target", "2025-10-13=no teef"
|
||||||
, "--target", "2025-10-31=dragon book"
|
, "--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)
|
(60 &minute)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
switches = {
|
switches = {
|
||||||
setDPI = {dpi}:
|
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
|
Xcursor.size: 64
|
||||||
Xft.dpi: ${toString dpi}
|
Xft.dpi: ${toString dpi}
|
||||||
''}";
|
''}";
|
||||||
|
|
@ -61,8 +61,12 @@
|
||||||
device, # obtain with `xrandr`
|
device, # obtain with `xrandr`
|
||||||
brightness, # [0..1]
|
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" ''
|
singleton "10_xrandr_brightness" ''
|
||||||
xrandr --output ${device} --brightness ${toString brightness}
|
sleep 10
|
||||||
|
${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
|
# Is scoped to an output device, no need to be called on built-in display
|
||||||
|
|
@ -71,7 +75,7 @@
|
||||||
brightness, # [0..1]
|
brightness, # [0..1]
|
||||||
}:
|
}:
|
||||||
singleton "10_ddc_brightness" ''
|
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 = {
|
setDDCContrast = {
|
||||||
|
|
@ -79,7 +83,7 @@
|
||||||
contrast, # [0..1]
|
contrast, # [0..1]
|
||||||
}:
|
}:
|
||||||
singleton "10_ddc_contrast" ''
|
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))}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -160,21 +164,13 @@
|
||||||
configs.allOff
|
configs.allOff
|
||||||
(configs.enableOrchid name)
|
(configs.enableOrchid name)
|
||||||
];
|
];
|
||||||
|
# seems like this display doesn't support DDC
|
||||||
hooks.postswitch = lib.mkMerge [
|
hooks.postswitch = lib.mkMerge [
|
||||||
(switches.setDPI {dpi = 100;})
|
(switches.setDPI {dpi = 100;})
|
||||||
(switches.setSoftwareBrightness {
|
(switches.setSoftwareBrightness {
|
||||||
device = name;
|
device = name;
|
||||||
brightness = 1;
|
brightness = 0.7;
|
||||||
})
|
})
|
||||||
# # seems like this display doesn't support DDC
|
|
||||||
# (switches.setDDCBrightness {
|
|
||||||
# modelName = "VG27AQL3A";
|
|
||||||
# brightness = 0;
|
|
||||||
# })
|
|
||||||
# (switches.setDDCContrast {
|
|
||||||
# modelName = "VG27AQL3A";
|
|
||||||
# contrast = 0.5;
|
|
||||||
# })
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
services.xserver.windowManager.xmonad = {
|
services.xserver.windowManager.xmonad = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableContribAndExtras = 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 = {
|
services.picom = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
48
nix/nixosModules/common/xscreensaver.nix
Normal file
48
nix/nixosModules/common/xscreensaver.nix
Normal file
|
|
@ -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
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue