From 123e0d694b8044d102948a185168de87ba35f192 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sat, 26 Aug 2023 17:08:31 +0200 Subject: [PATCH] pinwheel: Extract `hyprland` module --- hosts/pinwheel/configuration.nix | 1 + hosts/pinwheel/home.nix | 92 ------------------- hosts/pinwheel/modules/hyprland/default.nix | 97 +++++++++++++++++++++ 3 files changed, 98 insertions(+), 92 deletions(-) create mode 100644 hosts/pinwheel/modules/hyprland/default.nix diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 888ea58..3452425 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -17,6 +17,7 @@ ./modules/tmux ./modules/vim ./modules/foot + ./modules/hyprland ./modules/syncthing ./modules/firefox ./modules/calibre diff --git a/hosts/pinwheel/home.nix b/hosts/pinwheel/home.nix index c4fd0a0..954bbce 100644 --- a/hosts/pinwheel/home.nix +++ b/hosts/pinwheel/home.nix @@ -12,98 +12,6 @@ bemenu ]; - wayland.windowManager.hyprland = { - enable = true; - - xwayland = { - enable = true; - }; - - extraConfig = '' - exec-once = waybar - - monitor=eDP-1, 1920x1200@60, 0x0, 1 - env = GDK_DPI_SCALE,1.5 - env = XCURSOR_SIZE,64 - ''; - - settings = { - "$mod" = "SUPER"; - - animations.enabled = false; - - xwayland = { - force_zero_scaling = true; - }; - - input = { - kb_layout = "se"; - - follow_mouse = 0; - touchpad = { - natural_scroll = false; - tap-and-drag = false; - }; - }; - - general = { - gaps_in = 0; # gaps between windows - gaps_out = 0; # gaps between windows and monitor edges - - layout = "dwindle"; - }; - - dwindle = { - force_split = 2; - no_gaps_when_only = 1; - }; - - decoration = { - shadow_offset = "0 5"; - "col.shadow" = "rgba(00000099)"; - }; - - bind = let - ws = x: - let n = if (x + 1) < 10 - then (x + 1) - else 0; - in - builtins.toString n; - - select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; - move = builtins.genList (x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}") 10; - in - select ++ move ++ [ - "$mod, x, exec, ${pkgs.swaylock}/bin/swaylock" - "$mod SHIFT, x, exec, systemctl suspend" - - "$mod, SPACE, exec, bemenu-run --fn 'DejaVuSansM Nerd Font Mono 14'" - - "$mod, ESCAPE, killactive" - - "$mod, f, fullscreen, 1" - "$mod SHIFT, f, togglefloating, active" - - "$mod, h, movefocus, l" - "$mod, j, movefocus, d" - "$mod, k, movefocus, u" - "$mod, l, movefocus, r" - ]; - - bindm = [ - # mouse movements - "$mod, mouse:272, movewindow" # left click - "$mod, mouse:273, resizewindow" # right click - ]; - - misc = { - disable_hyprland_logo = true; - disable_splash_rendering = true; - }; - }; - }; - programs.waybar = { enable = true; diff --git a/hosts/pinwheel/modules/hyprland/default.nix b/hosts/pinwheel/modules/hyprland/default.nix new file mode 100644 index 0000000..64fe9b1 --- /dev/null +++ b/hosts/pinwheel/modules/hyprland/default.nix @@ -0,0 +1,97 @@ +{ home-manager, pkgs, ... }: +{ + home-manager.users.alex = { + wayland.windowManager.hyprland = { + enable = true; + + xwayland = { + enable = true; + }; + + extraConfig = '' + exec-once = waybar + + monitor=eDP-1, 1920x1200@60, 0x0, 1 + env = GDK_DPI_SCALE,1.5 + env = XCURSOR_SIZE,64 + ''; + + settings = { + "$mod" = "SUPER"; + + animations.enabled = false; + + xwayland = { + force_zero_scaling = true; + }; + + input = { + kb_layout = "se"; + + follow_mouse = 0; + + touchpad = { + natural_scroll = false; + tap-and-drag = false; + }; + }; + + general = { + gaps_in = 0; # gaps between windows + gaps_out = 0; # gaps between windows and monitor edges + + layout = "dwindle"; + }; + + dwindle = { + force_split = 2; + no_gaps_when_only = 1; + }; + + decoration = { + shadow_offset = "0 5"; + "col.shadow" = "rgba(00000099)"; + }; + + bind = let + ws = x: + let n = if (x + 1) < 10 + then (x + 1) + else 0; + in + builtins.toString n; + + select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10; + move = builtins.genList (x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}") 10; + in + select ++ move ++ [ + "$mod, x, exec, ${pkgs.swaylock}/bin/swaylock" + "$mod SHIFT, x, exec, systemctl suspend" + + "$mod, SPACE, exec, bemenu-run --fn 'DejaVuSansM Nerd Font Mono 14'" + + "$mod, ESCAPE, killactive" + + "$mod, f, fullscreen, 1" + "$mod SHIFT, f, togglefloating, active" + + "$mod, h, movefocus, l" + "$mod, j, movefocus, d" + "$mod, k, movefocus, u" + "$mod, l, movefocus, r" + ]; + + bindm = [ + # mouse movements + "$mod, mouse:272, movewindow" # left click + "$mod, mouse:273, resizewindow" # right click + ]; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + }; + }; + }; +}