sway output config/hypridle toggle

This commit is contained in:
janis 2025-09-03 04:32:38 +02:00
parent 6741c7bdf8
commit 1872e44454
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8
3 changed files with 54 additions and 34 deletions

View file

@ -1,44 +1,47 @@
{pkgs, ...}: {
{pkgs, lib, super-config, ...}: {
services.hyprpolkitagent.enable = true;
programs.hyprlock.enable = true;
# services.hypridle = {
# enable = true;
# settings = let
# idle_timeout = "300"; # 5 minutes
# screen_timeout = "600"; # 10 minutes
# suspend_timeout = "900"; # 10 minutes
# lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
# suspend_cmd = "systemctl suspend";
# in{
# general = {
# inherit lock_cmd;
# before_sleep_cmd = "loginctl lock-session";
# };
services.hypridle = lib.optionals (super-config.enableHypridle == true) {
enable = true;
settings = let
idle_timeout = "300"; # 5 minutes
screen_timeout = "600"; # 10 minutes
suspend_timeout = "900"; # 10 minutes
lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
suspend_cmd = "systemctl suspend";
in{
general = {
inherit lock_cmd;
before_sleep_cmd = "loginctl lock-session";
};
# listener = [
# {
# timeout = idle_timeout;
# on-timeout = "loginctl lock-session";
# }
# {
# timeout = screen_timeout;
# on-timeout = "{pkgs.sway}/bin/swaymsg 'output * dpms off'";
# on-resume = "{pkgs.sway}/bin/swaymsg 'output * dpms on'";
# }
# {
# timeout = suspend_timeout;
# on-timeout = suspend_cmd;
# }
# ];
listener = [
{
timeout = idle_timeout;
on-timeout = "loginctl lock-session";
}
{
timeout = screen_timeout;
on-timeout = "{pkgs.sway}/bin/swaymsg 'output * dpms off'";
on-resume = "{pkgs.sway}/bin/swaymsg 'output * dpms on'";
}
{
timeout = suspend_timeout;
on-timeout = suspend_cmd;
}
];
# };
# };
};
};
home.packages = with pkgs; [
hyprlock
# hypridle
];
] ++ (lib.optionals (super-config.enableHypridle == true) [
hypridle
]);
xdg.configFile."hypr/hyprlock.conf" = {
source = "${pkgs.dotfiles}/.config/hypr/hyprlock.conf";

View file

@ -34,6 +34,11 @@ in {
config = {
modifier = "${mod}";
fonts = {
names = ["SF Compact Rounded"];
size = 10.0;
};
seat = {
"*" = {
xcursor_theme = "\"WhiteSur-cursors\" 32";
@ -42,7 +47,7 @@ in {
output = {
"*".scale = "${lib.strings.floatToString super-config.desktop_scale}";
};
}// super-config.extraOutputConfig;
startup = [
{

View file

@ -18,10 +18,22 @@
description = "Enable dark mode for the system.";
};
enableHypridle = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable hypridle for the system.";
};
desktop_scale = lib.mkOption {
type = lib.types.float;
default = 1.0;
description = "HiDpi scale factor for the window manager";
};
extraOutputConfig = lib.mkOption {
type = lib.types.attrsOf (lib.types.attrsOf lib.types.anything);
default = {};
description = "Additional config for sway outputs";
};
};
}