working on screens and power stuff

This commit is contained in:
Matt Nish-Lapidus 2025-02-14 16:37:28 -05:00
parent 743efa1782
commit 1b06471fa6
11 changed files with 46 additions and 91 deletions

12
flake.lock generated
View file

@ -69,11 +69,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1739552424, "lastModified": 1739553792,
"narHash": "sha256-64bBQo821rZGJ3AT2+7d+aM+JGTJlmeKISVVV7j5258=", "narHash": "sha256-W/VqlGtMXv4cQ1V5j1Sbfu59x8DWntEkTJWJNHo9P+Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "9262057cc86e7512d742a1c1ae9d7d118bb82d48", "rev": "3a93a0a8f94fd52260b39aefc05e7bc667ded0ab",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -323,11 +323,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1739470101, "lastModified": 1739559906,
"narHash": "sha256-NxNe32VB4XI/xIXrsKmIfrcgtEx5r/5s52pL3CpEcA4=", "narHash": "sha256-iK5BXN5uDXVe76ssYTkFHl7oNZe+hhwcO3N7EN9yxqQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "5031c6d2978109336637977c165f82aa49fa16a7", "rev": "9daae9a67af7b4d341e2c806fa274a9c0925d7cf",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -17,6 +17,7 @@
langs langs
emacs emacs
swaync swaync
shikane
]; ];
home = { home = {
@ -137,18 +138,6 @@
XCURSOR_SIZE = 32; XCURSOR_SIZE = 32;
XCURSOR_THEME = "Bibata-Modern-Classic"; XCURSOR_THEME = "Bibata-Modern-Classic";
}; };
# mounts = {
# home-emenel-filez-media = {
# Unit = {
# Description = "Filez:Media (NAS)";
# };
# Mount = {
# What = "/mnt/filez/media";
# Where = "/home/emenel/filez/media";
# };
# };
# };
}; };
# moving files! # moving files!

View file

@ -0,0 +1 @@
#!/usr/bin/env fish

View file

@ -0,0 +1,5 @@
#!/usr/bin/env fish
function lock-power-off-monitors
loginctl lock-session && niri msg action power-off-monitors
end

View file

@ -0,0 +1,5 @@
#!/usr/bin/env fish
function lock-suspend
loginctl lock-session && systemctl suspend
end

View file

@ -1,20 +1,3 @@
[[profile]]
name = "desk-clam"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
[[profile.output]]
enable = false
search = ["m=TL140ADXP04-0", "s=", "v=Thermotrex Corporation"]
[[profile.output]]
enable = true
search = ["m=BenQ PD2725U", "s=N2N00414019", "v=PNP(BNQ)"]
mode = "3840x2160@59.997Hz"
position = "0,0"
scale = 1.0
transform = "normal"
adaptive_sync = false
[[profile]] [[profile]]
name = "desk-dual" name = "desk-dual"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""] exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
@ -51,24 +34,7 @@ exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""
[[profile]] [[profile]]
name = "projector" name = "misc"
[[profile.output]]
enable = true
search = ["m=ViewSonic PJ", "s=0x01010101", "v=ViewSonic Corporation"]
mode = "1920x1200@59.95Hz"
position = "0,0"
scale = 1.0
transform = "normal"
adaptive_sync = false
[[profile.output]]
enable = true
search = ["m=TL140ADXP04-0", "s=", "v=Thermotrex Corporation"]
[[profile]]
name = "laptop-misc"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""] exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
[[profile.output]] [[profile.output]]
enable = true enable = true

View file

@ -155,6 +155,8 @@ password=${config.sops.placeholder.filez}
xwayland-satellite xwayland-satellite
xwayland-run xwayland-run
cifs-utils cifs-utils
ddcutil
ddcui
]; ];
# Bootloader. # Bootloader.
@ -165,6 +167,7 @@ password=${config.sops.placeholder.filez}
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
}; };
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [ "i2c-dev" "ddcci_backlight" ];
initrd.systemd.enable = true; initrd.systemd.enable = true;
initrd.kernelModules = [ initrd.kernelModules = [
"nvidia" "nvidia"
@ -190,6 +193,8 @@ password=${config.sops.placeholder.filez}
}; };
hardware = { hardware = {
i2c.enable = true;
openrazer = { openrazer = {
enable = true; enable = true;
users = [ "emenel" ]; users = [ "emenel" ];
@ -258,10 +263,16 @@ password=${config.sops.placeholder.filez}
services.udev = { services.udev = {
extraRules = '' extraRules = ''
DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660" DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660"
ACTION=="add", SUBSYSTEM=="i2c-dev", ATTR{name}=="AMDGPU DM*", TAG+="ddcci", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="ddcci*", RUN+="${pkgs.coreutils-full}/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="ddcci*", RUN+="${pkgs.coreutils-full}/bin/chmod a+w /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="i2c-dev", ATTR{name}=="NVIDIA i2c adapter*", TAG+="ddcci", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ddcci@$kernel.service"
''; '';
packages = [ packages = [
pkgs.via pkgs.via
pkgs.vial pkgs.vial
pkgs.ddcutil
(pkgs.writeTextFile { (pkgs.writeTextFile {
name = "on-battery"; name = "on-battery";
text = '' text = ''
@ -680,6 +691,7 @@ password=${config.sops.placeholder.filez}
"cups" "cups"
"openrazer" "openrazer"
"plugdev" "plugdev"
"i2c-dev"
]; ];
packages = with pkgs; [ packages = with pkgs; [
git git

View file

@ -174,11 +174,6 @@
swayosd = { swayosd = {
enable = true; enable = true;
}; };
kanshi = {
enable = true;
};
}; };

View file

@ -7,51 +7,33 @@
general = { general = {
lock_cmd = "pidof hyprlock || hyprlock"; lock_cmd = "pidof hyprlock || hyprlock";
before_sleep_cmd = "loginctl lock-session"; before_sleep_cmd = "loginctl lock-session";
ignore_dbus_inhibit = false;
ignore_systemd_inhibit = false;
}; };
# TODO add screen dimming and test configurations with different monitors
listener = [ listener = [
# battery timers # battery timers
{
timeout = "30";
on-timeout = "systemd-ac-power || light -O && light -S 0 && light -s razer/0003:1532:02B6.0003/backlight -S 0";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
}
{ {
timeout = "120"; timeout = "120";
on-timeout = "systemd-ac-power || light -O && loginctl lock-session && niri msg action power-off-monitors"; on-timeout = "systemd-ac-power || lock-power-off-monitors";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
} }
{ {
timeout = "300"; timeout = "300";
on-timeout = "systemd-ac-power || light -O && loginctl lock-session && systemctl suspend"; on-timeout = "systemd-ac-power || lock-suspend";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
} }
# ac power timers # ac power timers
{
timeout = "60";
on-timeout = "systemd-ac-power && light -O && light -S 0 && light -s razer/0003:1532:02B6.0003/backlight -S 0";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
}
{ {
timeout = "180"; timeout = "180";
on-timeout = "systemd-ac-power && loginctl lock-session"; on-timeout = "systemd-ac-power && loginctl lock-session";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
} }
{ {
timeout = "300"; timeout = "600";
on-timeout = "systemd-ac-power && light -O && loginctl lock-session && niri msg action power-off-monitors"; on-timeout = "systemd-ac-power && loginctl lock-session && systemctl suspend";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
}
{
timeout = "900";
on-timeout = "systemd-ac-power && light -O && loginctl lock-session && systemctl suspend";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
} }
]; ];

View file

@ -13,7 +13,7 @@ in {
spawn-at-startup = [ spawn-at-startup = [
{ command = ["maestral_qt"]; } { command = ["maestral_qt"]; }
{ command = ["clipse" "-listen"]; } { command = ["clipse" "-listen"]; }
# { command = ["waybar"]; } { command = ["waybar"]; }
{ command = [ "systemctl" "--user" "restart" "xwayland-satellite.service" ]; } { command = [ "systemctl" "--user" "restart" "xwayland-satellite.service" ]; }
]; ];
@ -179,10 +179,10 @@ in {
} }
]; ];
# switch-events = with config.lib.niri.actions; { switch-events = with config.lib.niri.actions; {
# lid-close.action = spawn "niri msg output eDP-1 off && shikanectl switch desk-clam"; lid-close.action = spawn "shikanectl switch desk-clam";
# lid-open.action = spawn "niri msg output eDP-1 on"; lid-open.action = spawn "niri msg output eDP-1 on";
# }; };
binds = with config.lib.niri.actions; let binds = with config.lib.niri.actions; let
wez = spawn "wezterm" "--config-file" "/home/emenel/.config/wezterm/launcher.lua" "start" "--always-new-process"; wez = spawn "wezterm" "--config-file" "/home/emenel/.config/wezterm/launcher.lua" "start" "--always-new-process";
@ -349,7 +349,7 @@ in {
# Powers off the monitors. To turn them back on, do any input like # Powers off the monitors. To turn them back on, do any input like
# moving the mouse or pressing any other key. # moving the mouse or pressing any other key.
"Mod+Shift+P".action = power-off-monitors; "Mod+Shift+P".action = power-off-monitors;
"Mod+Shift+Alt+P".action = spawn "niri msg output eDP-1 on";
}; };
}; };
}; };

View file

@ -6,7 +6,7 @@ in {
programs.waybar = { programs.waybar = {
enable = true; enable = true;
package = pkgs.waybar; package = pkgs.waybar;
systemd.enable = true; systemd.enable = false;
style = '' style = ''
* { * {
border: none; border: none;