hyprland/sway/river: hostname aware idle settings

This commit is contained in:
Aly Raffauf 2024-04-21 11:03:24 -04:00
parent c20299ec28
commit da89069f32
3 changed files with 48 additions and 16 deletions

View file

@ -2,6 +2,7 @@
pkgs, pkgs,
lib, lib,
config, config,
osConfig,
... ...
}: { }: {
options = { options = {
@ -46,7 +47,7 @@
listener { listener {
timeout = 900 # 15min timeout = 900 # 15min
on-timeout = [ $(${pkgs.nettools}/bin/hostname) != "mauville" ] && ${pkgs.systemd}/bin/systemctl suspend # suspend pc unless on mauville on-timeout = ${if osConfig.networking.hostName == "mauville" then "" else "${pkgs.systemd}/bin/systemctl suspend"} # suspend pc unless on mauville
} }
''; '';
}; };

View file

@ -2,6 +2,7 @@
pkgs, pkgs,
lib, lib,
config, config,
osConfig,
... ...
}: { }: {
imports = [./randomWallpaper.nix]; imports = [./randomWallpaper.nix];
@ -130,9 +131,29 @@
launcher = pkgs.fuzzel + "/bin/fuzzel"; launcher = pkgs.fuzzel + "/bin/fuzzel";
notifyd = pkgs.mako + "/bin/mako"; notifyd = pkgs.mako + "/bin/mako";
wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg"; wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
idle = pkgs.swayidle + "/bin/swayidle";
logout = pkgs.wlogout + "/bin/wlogout"; logout = pkgs.wlogout + "/bin/wlogout";
lock = pkgs.swaylock + "/bin/swaylock -f -c 000000"; lock = pkgs.swaylock + "/bin/swaylock -f -c 000000";
idled =
if osConfig.networking.hostName == "mauville"
then ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock} \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
before-sleep '${lock}'
''
else ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock}' \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \
before-sleep '${lock}'
'';
riverctl = pkgs.river + "/bin/riverctl"; riverctl = pkgs.river + "/bin/riverctl";
brightness = "${pkgs.swayosd}/bin/swayosd-client"; brightness = "${pkgs.swayosd}/bin/swayosd-client";
@ -332,7 +353,7 @@
${pkgs.swayosd}/bin/swayosd-server & ${pkgs.swayosd}/bin/swayosd-server &
${fileManager} --daemon & ${fileManager} --daemon &
${bar} & ${bar} &
${idle} -w timeout 300 '${lock}' before-sleep '${lock}' & ${idled} &
''; '';
}; };
} }

View file

@ -2,6 +2,7 @@
pkgs, pkgs,
lib, lib,
config, config,
osConfig,
... ...
}: { }: {
imports = [./randomWallpaper.nix]; imports = [./randomWallpaper.nix];
@ -70,9 +71,29 @@
launcher = pkgs.fuzzel + "/bin/fuzzel"; launcher = pkgs.fuzzel + "/bin/fuzzel";
notifyd = pkgs.mako + "/bin/mako"; notifyd = pkgs.mako + "/bin/mako";
wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg"; wallpaperd = pkgs.swaybg + "/bin/swaybg -i ~/.local/share/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
idle = pkgs.swayidle + "/bin/swayidle";
logout = pkgs.wlogout + "/bin/wlogout"; logout = pkgs.wlogout + "/bin/wlogout";
lock = pkgs.swaylock + "/bin/swaylock -f -c 000000"; lock = pkgs.swaylock + "/bin/swaylock -f -c 000000";
idled =
if osConfig.networking.hostName == "mauville"
then ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock} \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
before-sleep '${lock}'
''
else ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${lock}' \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \
before-sleep '${lock}'
'';
brightness = "${pkgs.swayosd}/bin/swayosd-client"; brightness = "${pkgs.swayosd}/bin/swayosd-client";
brightness_up = "${brightness} --brightness=raise"; brightness_up = "${brightness} --brightness=raise";
@ -281,18 +302,7 @@
{command = "${pkgs.swayosd}/bin/swayosd-server";} {command = "${pkgs.swayosd}/bin/swayosd-server";}
{command = "${pkgs.networkmanagerapplet}/bin/nm-applet";} {command = "${pkgs.networkmanagerapplet}/bin/nm-applet";}
{command = "${pkgs.trayscale}/bin/trayscale --hide-window";} {command = "${pkgs.trayscale}/bin/trayscale --hide-window";}
{ {command = "${idled}";}
command = ''
${pkgs.swayidle}/bin/swayidle -w \
timeout 240 '${pkgs.brightnessctl}/bin/brightnessctl -s set 10' \
resume '${pkgs.brightnessctl}/bin/brightnessctl -r' \
timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \
timeout 330 '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms off"' \
resume '${config.wayland.windowManager.sway.package}/bin/swaymsg "output * dpms on"' \
timeout 900 '${pkgs.systemd}/bin/systemctl suspend' \
before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'
'';
}
]; ];
output = { output = {
"BOE 0x095F Unknown" = { "BOE 0x095F Unknown" = {