From 1872e4445465f006ce6f83a09db92a32681c4fd7 Mon Sep 17 00:00:00 2001 From: janis Date: Wed, 3 Sep 2025 04:32:38 +0200 Subject: [PATCH] sway output config/hypridle toggle --- home/hyprlock_idle.nix | 69 ++++++++++++++++++++++-------------------- home/sway.nix | 7 ++++- options.nix | 12 ++++++++ 3 files changed, 54 insertions(+), 34 deletions(-) diff --git a/home/hyprlock_idle.nix b/home/hyprlock_idle.nix index 93306b8..befda46 100644 --- a/home/hyprlock_idle.nix +++ b/home/hyprlock_idle.nix @@ -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"; diff --git a/home/sway.nix b/home/sway.nix index ff0aed6..c2aef1d 100644 --- a/home/sway.nix +++ b/home/sway.nix @@ -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 = [ { diff --git a/options.nix b/options.nix index 9dd73dd..041eb43 100644 --- a/options.nix +++ b/options.nix @@ -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"; + }; }; }