From 864c1afe326d95979002bcaec4d8fd17dfde1b7a Mon Sep 17 00:00:00 2001 From: notohh Date: Thu, 7 Mar 2024 03:54:42 -0500 Subject: [PATCH] wayland: add hypridle & hyprlock --- home/wayland/default.nix | 6 +- home/wayland/programs/hyprlock.nix | 70 ++++++++++++++++++++++++ home/wayland/{ => services}/greetd.nix | 0 home/wayland/services/hypridle.nix | 24 ++++++++ home/wayland/{ => services}/wlsunset.nix | 0 5 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 home/wayland/programs/hyprlock.nix rename home/wayland/{ => services}/greetd.nix (100%) create mode 100644 home/wayland/services/hypridle.nix rename home/wayland/{ => services}/wlsunset.nix (100%) diff --git a/home/wayland/default.nix b/home/wayland/default.nix index 5676a23..17646ec 100644 --- a/home/wayland/default.nix +++ b/home/wayland/default.nix @@ -14,7 +14,7 @@ ''; }; in { - imports = [./greetd.nix]; + imports = [./services/greetd.nix]; environment = { systemPackages = with pkgs; [ dbus-hyprland-environment @@ -25,8 +25,6 @@ in { satty wl-clipboard wlr-randr - swayidle - swaylock-effects hyprpicker swww ]; @@ -60,7 +58,7 @@ in { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-gtk - inputs.hyprland.packages.${system}.xdg-desktop-portal-hyprland + inputs.xdg-portal-hyprland.packages.${pkgs.system}.default ]; config = { common.default = "*"; diff --git a/home/wayland/programs/hyprlock.nix b/home/wayland/programs/hyprlock.nix new file mode 100644 index 0000000..170b0d6 --- /dev/null +++ b/home/wayland/programs/hyprlock.nix @@ -0,0 +1,70 @@ +_: { + programs.hyprlock = { + enable = true; + backgrounds = let + wallpaperPath = "/home/notoh/Pictures/wallpapers/cweam.png"; + in [ + { + monitor = "DP-1"; + path = wallpaperPath; + } + { + monitor = "DP-2"; + path = wallpaperPath; + } + { + monitor = "DP-3"; + path = wallpaperPath; + } + { + monitor = "HDMI-A-1"; + path = wallpaperPath; + } + ]; + general = { + disable_loading_bar = false; + hide_cursor = false; + no_fade_in = false; + }; + input-fields = [ + { + monitor = "DP-2"; + size = { + width = 300; + height = 50; + }; + outline_thickness = 2; + + outer_color = "rgb(1e1e2e)"; + inner_color = "rgb(1e1e2e)"; + font_color = "rgb(cdd6f4)"; + placeholder_text = '' + Password... + ''; + fade_on_empty = false; + dots_spacing = 0.3; + dots_center = true; + } + ]; + labels = [ + { + monitor = "DP-2"; + text = "Hi, $USER"; + color = "rgb(1e1e2e)"; + valign = "center"; + halign = "center"; + } + { + monitor = "DP-2"; + text = "$TIME"; + color = "rgb(1e1e2e)"; + position = { + x = 0; + y = 120; + }; + valign = "center"; + halign = "center"; + } + ]; + }; +} diff --git a/home/wayland/greetd.nix b/home/wayland/services/greetd.nix similarity index 100% rename from home/wayland/greetd.nix rename to home/wayland/services/greetd.nix diff --git a/home/wayland/services/hypridle.nix b/home/wayland/services/hypridle.nix new file mode 100644 index 0000000..e10ac45 --- /dev/null +++ b/home/wayland/services/hypridle.nix @@ -0,0 +1,24 @@ +{ + pkgs, + config, + lib, + ... +}: { + services.hypridle = { + enable = true; + ignoreDbusInhibit = false; + lockCmd = lib.getExe config.programs.hyprlock.package; + beforeSleepCmd = "${pkgs.systemd}/bin/loginctl lock-session"; + listeners = [ + { + timeout = 500; + onTimeout = "${lib.getExe config.programs.hyprlock.package}"; + } + { + timeout = 560; + onTimeout = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; + onResume = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; + } + ]; + }; +} diff --git a/home/wayland/wlsunset.nix b/home/wayland/services/wlsunset.nix similarity index 100% rename from home/wayland/wlsunset.nix rename to home/wayland/services/wlsunset.nix