From 9bba7b5da5b8657c361547bb763ead1f8387019d Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Thu, 4 Jul 2024 11:05:48 -0400 Subject: [PATCH] feat(hyprland): update configuration for ags, swaybg, hypridle, and hyprlock --- modules/hyprland.nix | 4 ++ user/modules/hyprland.nix | 129 +++++++++++++++++++++++++++++++++++--- 2 files changed, 125 insertions(+), 8 deletions(-) diff --git a/modules/hyprland.nix b/modules/hyprland.nix index b4d32fe..2b4275c 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -37,6 +37,10 @@ in { gnome.gnome-dictionary gnome.gnome-font-viewer gnome.gnome-system-monitor + monophony # music player + + # Nvim clipboard + wl-clipboard ]; # Required for Nautilus to work outside GNOME diff --git a/user/modules/hyprland.nix b/user/modules/hyprland.nix index 4d801a9..d1069b5 100644 --- a/user/modules/hyprland.nix +++ b/user/modules/hyprland.nix @@ -5,19 +5,21 @@ }: { imports = [ inputs.hyprland.homeManagerModules.default - ./ironbar ./wofi.nix ]; home.packages = with pkgs; [ pavucontrol - swaynotificationcenter + swaybg ]; wayland.windowManager.hyprland = { enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; - settings = { + settings = let + # No gaps or border when only one window + no_gaps_when_only = 1; + in { "$mod" = "SUPER"; general = { gaps_in = 5; @@ -26,9 +28,17 @@ input = { follow_mouse = 2; }; + dwindle = { + inherit no_gaps_when_only; + }; + master = { + inherit no_gaps_when_only; + }; exec-once = [ "hyprctl setcursor Adwaita 24" - "swaync" + "ags" + "swaybg -i /home/michael/Photos/wallpaper.jpg" + "hypridle" ]; bind = [ @@ -71,19 +81,24 @@ # will switch to a submap called resize bind=$mod,R,submap,resize - # will start a submap called "resize" + # media controls + bindel=, XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ + bindel=, XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- + bindl=, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle + + # will start a submap called "resize" submap=resize - # sets repeatable binds for resizing the active window + # sets repeatable binds for resizing the active window binde=,h,resizeactive,-10 0 binde=,j,resizeactive,0 10 binde=,k,resizeactive,0 -10 binde=,l,resizeactive,10 0 - # use reset to go back to the global submap + # use reset to go back to the global submap bind=,escape,submap,reset - # will reset the submap, meaning end the current one and return to the global one + # will reset the submap, meaning end the current one and return to the global one submap=reset ''; }; @@ -107,4 +122,102 @@ package = pkgs.gnome.adwaita-icon-theme; size = 24; }; + + programs.hyprlock = { + enable = true; + settings = { + general = { + no_fade_in = false; + grace = 0; + disable_loading_bar = true; + }; + background = { + monitor = ""; + path = "~/Photos/wallpaper.jpg"; + blur_passes = 3; + contrast = 0.8916; + brightness = 0.8172; + vibrancy = 0.1696; + vibrancy_darkness = 0.0; + }; + input-field = { + monitor = ""; + size = "250, 60"; + outline_thickness = 2; + dots_size = 0.2; # Scale of input-field height, 0.2 - 0.8 + dots_spacing = 0.2; # Scale of dots' absolute size, 0.0 - 1.0 + dots_center = true; + outer_color = "rgba(0, 0, 0, 0)"; + inner_color = "rgba(0, 0, 0, 0.5)"; + font_color = "rgb(200, 200, 200)"; + fade_on_empty = false; + font_family = "Inter"; + placeholder_text = "Enter Password"; + hide_input = false; + position = "0, 375"; + halign = "center"; + valign = "bottom"; + }; + label = [ + # Time + { + monitor = ""; + text = "cmd[update:1000] echo \"$(date +\"%-I:%M %P\")\""; + color = "rgba(255, 255, 255, 0.6)"; + font_size = 120; + font_family = "Inter ExtraBold"; + position = "0, -300"; + halign = "center"; + valign = "top"; + } + # User + { + monitor = ""; + text = "Michael Thomas"; + color = "rgba(255, 255, 255, 0.6)"; + font_size = 24; + font_family = "Inter Semibold"; + position = "0, 450"; + halign = "center"; + valign = "bottom"; + } + ]; + }; + }; + + 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 = [ + # Dim screen + { + timeout = 150; # 2.5 min + on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + on-resume = "brightnessctl -r"; # monitor backlight restore. + } + # Lock + { + timeout = 300; # 5 min + on-timeout = "loginctl lock-session"; + } + # Turn off screen + { + timeout = 330; # 5.5 min + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + # Suspend + { + timeout = 1800; # 30 min + on-timeout = "systemctl suspend"; + } + ]; + }; + }; }