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

View file

@ -17,6 +17,7 @@
langs
emacs
swaync
shikane
];
home = {
@ -137,18 +138,6 @@
XCURSOR_SIZE = 32;
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!

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]]
name = "desk-dual"
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]]
name = "projector"
[[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"
name = "misc"
exec = ["notify-send shikane \"Profile $SHIKANE_PROFILE_NAME has been applied\""]
[[profile.output]]
enable = true

View file

@ -155,6 +155,8 @@ password=${config.sops.placeholder.filez}
xwayland-satellite
xwayland-run
cifs-utils
ddcutil
ddcui
];
# Bootloader.
@ -165,6 +167,7 @@ password=${config.sops.placeholder.filez}
efi.canTouchEfiVariables = true;
};
kernelPackages = pkgs.linuxPackages_latest;
kernelModules = [ "i2c-dev" "ddcci_backlight" ];
initrd.systemd.enable = true;
initrd.kernelModules = [
"nvidia"
@ -190,6 +193,8 @@ password=${config.sops.placeholder.filez}
};
hardware = {
i2c.enable = true;
openrazer = {
enable = true;
users = [ "emenel" ];
@ -258,10 +263,16 @@ password=${config.sops.placeholder.filez}
services.udev = {
extraRules = ''
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 = [
pkgs.via
pkgs.vial
pkgs.ddcutil
(pkgs.writeTextFile {
name = "on-battery";
text = ''
@ -680,6 +691,7 @@ password=${config.sops.placeholder.filez}
"cups"
"openrazer"
"plugdev"
"i2c-dev"
];
packages = with pkgs; [
git

View file

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

View file

@ -7,51 +7,33 @@
general = {
lock_cmd = "pidof hyprlock || hyprlock";
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 = [
# 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";
on-timeout = "systemd-ac-power || light -O && loginctl lock-session && niri msg action power-off-monitors";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
on-timeout = "systemd-ac-power || lock-power-off-monitors";
}
{
timeout = "300";
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";
on-timeout = "systemd-ac-power || lock-suspend";
}
# 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";
on-timeout = "systemd-ac-power && loginctl lock-session";
on-resume = "light -I && light -s razer/0003:1532:02B6.0003/backlight -S 40";
}
{
timeout = "300";
on-timeout = "systemd-ac-power && light -O && loginctl lock-session && niri msg action power-off-monitors";
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";
timeout = "600";
on-timeout = "systemd-ac-power && loginctl lock-session && systemctl suspend";
}
];

View file

@ -13,7 +13,7 @@ in {
spawn-at-startup = [
{ command = ["maestral_qt"]; }
{ command = ["clipse" "-listen"]; }
# { command = ["waybar"]; }
{ command = ["waybar"]; }
{ command = [ "systemctl" "--user" "restart" "xwayland-satellite.service" ]; }
];
@ -179,10 +179,10 @@ in {
}
];
# switch-events = with config.lib.niri.actions; {
# lid-close.action = spawn "niri msg output eDP-1 off && shikanectl switch desk-clam";
# lid-open.action = spawn "niri msg output eDP-1 on";
# };
switch-events = with config.lib.niri.actions; {
lid-close.action = spawn "shikanectl switch desk-clam";
lid-open.action = spawn "niri msg output eDP-1 on";
};
binds = with config.lib.niri.actions; let
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
# moving the mouse or pressing any other key.
"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 = {
enable = true;
package = pkgs.waybar;
systemd.enable = true;
systemd.enable = false;
style = ''
* {
border: none;