From f26cbc1aec37d0fc92e990a6fda2652df8b02324 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 3 Sep 2024 16:10:02 -0400 Subject: [PATCH] meta: Move hyprlock / hypridle to separate modules Makes it possible to use the hyprland module without using hypridle and hyprlock. --- home/hypridle.nix | 34 +++++++++++++++++++++++ home/hyprland.nix | 71 ----------------------------------------------- home/hyprlock.nix | 39 ++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 71 deletions(-) create mode 100644 home/hypridle.nix create mode 100644 home/hyprlock.nix diff --git a/home/hypridle.nix b/home/hypridle.nix new file mode 100644 index 00000000..7e749cfe --- /dev/null +++ b/home/hypridle.nix @@ -0,0 +1,34 @@ +{ + services.hypridle = { + enable = true; + + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + + listener = [ + { + timeout = 150; + on-timeout = "brightnessctl set 0 --save && brightnessctl --device=tpacpi::kbd_backlight set 0 --save"; + on-resume = "brightnessctl --restore && brightnessctl --device=tpacpi::kbd_backlight --restore"; + } + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 380; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 1800; + on-timeout = "systemctl suspend"; + } + ]; + }; + }; +} diff --git a/home/hyprland.nix b/home/hyprland.nix index 372c35a0..a366ed44 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -334,78 +334,7 @@ in }; }; - programs.hyprlock = { - enable = true; - - settings = { - general = { - hide_cursor = true; - grace = 2; - }; - - background = { - color = "rgba(25, 20, 20, 1.0)"; - path = "screenshot"; - blur_passes = 2; - brightness = 0.5; - }; - - label = { - text = "パスワードをご入力ください"; - color = "rgba(222, 222, 222, 1.0)"; - font_size = 50; - font_family = "Noto Sans CJK JP"; - position = "0, 70"; - halign = "center"; - valign = "center"; - }; - - input-field = { - size = "50, 50"; - dots_size = 0.33; - dots_spacing = 0.15; - outer_color = "rgba(25, 20, 20, 0)"; - inner_color = "rgba(25, 20, 20, 0)"; - font_color = "rgba(222, 222, 222, 1.0)"; - placeholder_text = "パスワード"; - }; - }; - }; - services = { - hypridle = { - enable = true; - - settings = { - general = { - lock_cmd = "pidof hyprlock || hyprlock"; - before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch dpms on"; - }; - - listener = [ - { - timeout = 150; - on-timeout = "brightnessctl set 0 --save && brightnessctl --device=tpacpi::kbd_backlight set 0 --save"; - on-resume = "brightnessctl --restore && brightnessctl --device=tpacpi::kbd_backlight --restore"; - } - { - timeout = 300; - on-timeout = "loginctl lock-session"; - } - { - timeout = 380; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - { - timeout = 1800; - on-timeout = "systemctl suspend"; - } - ]; - }; - }; - batsignal.enable = true; swaync.enable = true; swayosd.enable = true; diff --git a/home/hyprlock.nix b/home/hyprlock.nix new file mode 100644 index 00000000..9fb38687 --- /dev/null +++ b/home/hyprlock.nix @@ -0,0 +1,39 @@ +{ + programs.hyprlock = { + enable = true; + + settings = { + general = { + hide_cursor = true; + grace = 2; + }; + + background = { + color = "rgba(25, 20, 20, 1.0)"; + path = "screenshot"; + blur_passes = 2; + brightness = 0.5; + }; + + label = { + text = "パスワードをご入力ください"; + color = "rgba(222, 222, 222, 1.0)"; + font_size = 50; + font_family = "Noto Sans CJK JP"; + position = "0, 70"; + halign = "center"; + valign = "center"; + }; + + input-field = { + size = "50, 50"; + dots_size = 0.33; + dots_spacing = 0.15; + outer_color = "rgba(25, 20, 20, 0)"; + inner_color = "rgba(25, 20, 20, 0)"; + font_color = "rgba(222, 222, 222, 1.0)"; + placeholder_text = "パスワード"; + }; + }; + }; +}