From fdefee324e5c25dddf220163b6615fa6c5404b65 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Wed, 25 Dec 2024 10:29:38 +0100 Subject: [PATCH] config: use uwsm for Hyprland --- config/home-manager/programs/fuzzel.nix | 1 + .../home-manager/programs/hypr/land/binds.nix | 30 ++++++++++++------- .../programs/hypr/land/default.nix | 6 ++-- config/nixos/programs/hyprland.nix | 1 + 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/config/home-manager/programs/fuzzel.nix b/config/home-manager/programs/fuzzel.nix index f6693c5..119e1a4 100644 --- a/config/home-manager/programs/fuzzel.nix +++ b/config/home-manager/programs/fuzzel.nix @@ -9,6 +9,7 @@ main = { terminal = lib.getExe pkgs.foot; layer = "overlay"; + launch-prefix = "uwsm app --"; }; }; }; diff --git a/config/home-manager/programs/hypr/land/binds.nix b/config/home-manager/programs/hypr/land/binds.nix index 5b1f39f..eed7671 100644 --- a/config/home-manager/programs/hypr/land/binds.nix +++ b/config/home-manager/programs/hypr/land/binds.nix @@ -1,15 +1,22 @@ -_: { +_: let + # thanks https://github.com/fufexan/dotfiles/blob/c0b3c77d95ce1f574a87e7f7ead672ca0d951245/home/programs/wayland/hyprland/binds.nix#L16-L20 + toggle = program: let + prog = builtins.substring 0 14 program; + in "pkill ${prog} || uwsm app -- ${program}"; + runOnce = program: "pgrep ${program} || uwsm app -- ${program}"; + run = program: "uwsm app -- ${program}"; +in { wayland.windowManager.hyprland.settings = { "$mod" = "SUPER"; bind = [ - "$mod, Return, exec, foot" - "$mod, n, exec, neovide" - "$mod, w, exec, firefox" - ", Print, exec, grimblast --notify copy output" + "$mod, Return, exec, ${run "foot"}" + "$mod, n, exec, ${run "neovide"}" + "$mod, w, exec, ${run "firefox"}" + ", Print, exec, ${runOnce "grimblast"} --notify --cursor copysave output" "$mod, q, killactive" - "$mod SHIFT, q, exit" - "$mod, Space, exec, fuzzel" - "CTRL, Print, exec, grimblast --notify --freeze copy area" + "$mod SHIFT, q, exec, uwsm stop" + "$mod, Space, exec, ${toggle "fuzzel"}" + "CTRL, Print, exec, ${runOnce "grimblast"} --notify --cursor --freeze copysave area" "$mod, h, movefocus, l" "$mod, j, movefocus, d" @@ -49,9 +56,11 @@ _: { "$mod, e, togglespecialworkspace, file_manager_tui" "$mod SHIFT, e, togglespecialworkspace, file_manager_gui" + + ", XF86PowerOff, exec, ${toggle "wlogout"}" ]; - binde = [ + bindel = [ ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" @@ -59,7 +68,8 @@ _: { ", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5" ", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5" ", XF86AudioMedia, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center" - ", XF86PowerOff, exec, wlogout" + ]; + binde = [ "$mod Alt, l, exec, loginctl lock-session" ]; }; diff --git a/config/home-manager/programs/hypr/land/default.nix b/config/home-manager/programs/hypr/land/default.nix index 6ded509..3bf39c7 100644 --- a/config/home-manager/programs/hypr/land/default.nix +++ b/config/home-manager/programs/hypr/land/default.nix @@ -28,10 +28,8 @@ wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; - systemd = { - enable = true; - variables = ["--all"]; - }; + + systemd.enable = false; settings = { xwayland = { diff --git a/config/nixos/programs/hyprland.nix b/config/nixos/programs/hyprland.nix index 1306a81..cd54895 100644 --- a/config/nixos/programs/hyprland.nix +++ b/config/nixos/programs/hyprland.nix @@ -9,6 +9,7 @@ enable = true; package = inputs.hyprland.packages.${pkgs.system}.hyprland; portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland; + withUWSM = true; }; # copied from https://github.com/linyinfeng/dotfiles/blob/91b0363b093303f57885cbae9da7f8a99bbb4432/nixos/profiles/graphical/niri/default.nix#L17-L29