config: use uwsm for Hyprland

This commit is contained in:
Anthony Rodriguez 2024-12-25 10:29:38 +01:00
parent 61bc1ea56d
commit fdefee324e
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
4 changed files with 24 additions and 14 deletions

View file

@ -9,6 +9,7 @@
main = { main = {
terminal = lib.getExe pkgs.foot; terminal = lib.getExe pkgs.foot;
layer = "overlay"; layer = "overlay";
launch-prefix = "uwsm app --";
}; };
}; };
}; };

View file

@ -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 = { wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER"; "$mod" = "SUPER";
bind = [ bind = [
"$mod, Return, exec, foot" "$mod, Return, exec, ${run "foot"}"
"$mod, n, exec, neovide" "$mod, n, exec, ${run "neovide"}"
"$mod, w, exec, firefox" "$mod, w, exec, ${run "firefox"}"
", Print, exec, grimblast --notify copy output" ", Print, exec, ${runOnce "grimblast"} --notify --cursor copysave output"
"$mod, q, killactive" "$mod, q, killactive"
"$mod SHIFT, q, exit" "$mod SHIFT, q, exec, uwsm stop"
"$mod, Space, exec, fuzzel" "$mod, Space, exec, ${toggle "fuzzel"}"
"CTRL, Print, exec, grimblast --notify --freeze copy area" "CTRL, Print, exec, ${runOnce "grimblast"} --notify --cursor --freeze copysave area"
"$mod, h, movefocus, l" "$mod, h, movefocus, l"
"$mod, j, movefocus, d" "$mod, j, movefocus, d"
@ -49,9 +56,11 @@ _: {
"$mod, e, togglespecialworkspace, file_manager_tui" "$mod, e, togglespecialworkspace, file_manager_tui"
"$mod SHIFT, e, togglespecialworkspace, file_manager_gui" "$mod SHIFT, e, togglespecialworkspace, file_manager_gui"
", XF86PowerOff, exec, ${toggle "wlogout"}"
]; ];
binde = [ bindel = [
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, 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" ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
@ -59,7 +68,8 @@ _: {
", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5" ", XF86MonBrightnessUp, exec, brillo -q -u 300000 -A 5"
", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5" ", XF86MonBrightnessDown, exec, brillo -q -u 300000 -U 5"
", XF86AudioMedia, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center" ", XF86AudioMedia, exec, XDG_CURRENT_DESKTOP=gnome gnome-control-center"
", XF86PowerOff, exec, wlogout" ];
binde = [
"$mod Alt, l, exec, loginctl lock-session" "$mod Alt, l, exec, loginctl lock-session"
]; ];
}; };

View file

@ -28,10 +28,8 @@
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
systemd = {
enable = true; systemd.enable = false;
variables = ["--all"];
};
settings = { settings = {
xwayland = { xwayland = {

View file

@ -9,6 +9,7 @@
enable = true; enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland; package = inputs.hyprland.packages.${pkgs.system}.hyprland;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-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 # copied from https://github.com/linyinfeng/dotfiles/blob/91b0363b093303f57885cbae9da7f8a99bbb4432/nixos/profiles/graphical/niri/default.nix#L17-L29