From a856565ac98611607cda3e5b4d04d85ccf6fe9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 23 Dec 2022 12:39:24 +0100 Subject: [PATCH] update hyprland conf --- flake.nix | 3 ++ modules/programs/hyprland/config.nix | 44 ++++++++++++++++------- modules/programs/hyprland/default.nix | 51 +++++++++++++++++++++------ 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index 5aff38d..8710075 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,8 @@ }; hyprland.url = "github:hyprwm/Hyprland"; + + hyprpaper.url = "github:hyprwm/hyprpaper"; }; outputs = @@ -105,6 +107,7 @@ self.nixosModules.gaming ]; + hosts.nixos-desktop.modules = [ ./hosts/nixos-desktop self.nixosModules.desktop diff --git a/modules/programs/hyprland/config.nix b/modules/programs/hyprland/config.nix index 51562a3..0fcaa86 100644 --- a/modules/programs/hyprland/config.nix +++ b/modules/programs/hyprland/config.nix @@ -3,6 +3,12 @@ , pkgs , ... }: + +with lib; +let + mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}"; + mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules); +in '' # # Please note not all available settings / options are set here. @@ -26,7 +32,7 @@ kb_layout = de,us kb_variant = kb_model = - kb_options = grp:alt_shift_toggle + kb_options = grp:win_space_toggle,caps:escape kb_rules = follow_mouse = 1 @@ -47,29 +53,31 @@ col.active_border = rgba(1affffee) col.inactive_border = rgba(595959aa) + cursor_inactive_timeout = 1 + layout = dwindle } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more - rounding = 5 - inactive_opacity = 0.98 + rounding = 3 blur = yes - blur_size = 8 - blur_passes = 1 + blur_size = 3 + blur_passes = 3 blur_new_optimizations = on drop_shadow = yes - shadow_range = 4 - shadow_render_power = 3 - col.shadow = rgba(1a1a1aee) + shadow_range = 10 + shadow_render_power = 2 + + # col.shadow = rgba(1a1a1aee) } animations { enabled = yes - # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + # Some default Lanimations, see https://wiki.hyprland.org/Configuring/Animations/ for more bezier = myBezier, 0.45, 0, 0.55, 1 @@ -90,6 +98,7 @@ master { # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more no_gaps_when_only = true + new_is_master = false } gestures { @@ -103,13 +112,21 @@ sensitivity = -0.5 } - # Example windowrule v1 - # windowrule = float, ^(kitty)$ # Example windowrule v2 # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ - windowrulev2 = float,class:^([rR]ofi)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + # Firefox Sharing Indicator + ${mkRules ["float" "move 49% 40" "noborder"] ["title:^(.*Sharing Indicator)$"]} + + # Rofi + ${mkRules ["float" "opacity 0.95 0.95"] ["class:^([rR]ofi)$"]} + + windowrulev2 = opacity 0.95 0.95,floating:1 + + # Games + # ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]} + # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER @@ -119,10 +136,11 @@ bind = $mainMod, D, exec, hyprctl keyword general:layout dwindle bind = $mainMod, E, exec, emacsclient -c -a emacs bind = $mainMod, F, togglefloating, + bind = $mainMod SHIFT, F, fullscreen, bind = $mainMod, M, exec, hyprctl keyword general:layout master bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, Q, killactive, - bind = $mainMod, R, exec, rofi -show combi + bind = $mainMod, R, exec, rofi -show combi -normal-window bind = $mainMod, C, exec, rofi -show calc -modi calc -no-show-match -no-sort | xclip -selection clipboard bind = $mainMod, B, exec, rofi-bluetooth bind = $mainMod, RETURN, exec, kitty diff --git a/modules/programs/hyprland/default.nix b/modules/programs/hyprland/default.nix index 42dec13..064c538 100644 --- a/modules/programs/hyprland/default.nix +++ b/modules/programs/hyprland/default.nix @@ -79,9 +79,28 @@ in } ]; }; - # start swayidle as part of hyprland, not sway systemd.user.services.swayidle.Install.WantedBy = lib.mkForce [ "hyprland-session.target" ]; + + xdg.configFile."hypr/hyprpaper.conf" = { + text = + let + setWallpaper = wallpaper: '' + preload = ${wallpaper} + wallpaper = ,${wallpaper} + ''; + in + # setWallpaper "/home/moritz/.config/wallpapers/a_short_walk.png"; + setWallpaper "/home/moritz/.config/wallpapers/mario.gif"; + onChange = "${pkgs.systemd}/bin/systemctl restart --user hyprpaper.service"; + }; + }; + systemd.user.services.hyprpaper = { + enable = true; + path = [ pkgs.hyprpaper ]; + wantedBy = [ "display-manager.service" ]; + after = [ "display-manager.service" ]; + script = "hyprpaper"; }; users.users.moritz.packages = with pkgs; [ @@ -90,6 +109,8 @@ in pamixer playerctl brightnessctl + slurp + grim ]; security.pam.services.swaylock = { }; @@ -120,18 +141,28 @@ in __GL_VRR_ALLOWED = "0"; } else { }); - services.xserver = { - enable = true; - displayManager = { - gdm.enable = true; - autoLogin = { - enable = true; - user = "moritz"; + services = { + dbus.enable = true; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + xserver = { + enable = true; + displayManager = { + gdm.enable = true; + autoLogin = { + enable = true; + user = "moritz"; + }; + defaultSession = "hyprland"; + sessionPackages = [ hyprland ]; }; - defaultSession = "hyprland"; - sessionPackages = [ hyprland ]; }; }; + security.rtkit.enable = true; xdg.portal = { enable = true;