diff --git a/flake.lock b/flake.lock index db3fdbb..7fa3f83 100644 --- a/flake.lock +++ b/flake.lock @@ -671,6 +671,62 @@ "type": "github" } }, + "niri-flake": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_3", + "nixpkgs-stable": "nixpkgs-stable_2", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1740690416, + "narHash": "sha256-ZVyJvL/sEkBuxNh1+Y5K3XXzYowIz5UUyOqrzK2rkdc=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "18a5c6286802a8ef1109760d61740b6f321c810c", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1740117926, + "narHash": "sha256-mTTHA0RAaQcdYe+9A3Jx77cmmyLFHmRoZdd8RpWa+m8=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "b94a5db8790339cf9134873d8b490be69e02ac71", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.02", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1740683787, + "narHash": "sha256-Q3ZqUR1xVG9MuHxInsLfqytgqCZKICYpWDIz8L11av8=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "311f3be5d861bfb12ee8b3d7241bd1d1fcb5110b", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nixgl": { "inputs": { "flake-utils": "flake-utils_3", @@ -736,6 +792,22 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1740603184, + "narHash": "sha256-t+VaahjQAWyA+Ctn2idyo1yxRIYpaDxMgHkgCNiMJa4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f44bd8ca21e026135061a0a57dcf3d0775b67a49", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1736701207, @@ -753,6 +825,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1740560979, + "narHash": "sha256-Vr3Qi346M+8CjedtbyUevIGDZW8LcA1fTG0ugPY/Hic=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5135c59491985879812717f4c9fea69604e7f26f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1740603184, "narHash": "sha256-t+VaahjQAWyA+Ctn2idyo1yxRIYpaDxMgHkgCNiMJa4=", @@ -768,7 +856,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1710272261, "narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", @@ -844,8 +932,9 @@ "home-manager": "home-manager", "lix": "lix", "marleyvim": "marleyvim", + "niri-flake": "niri-flake", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nur": "nur", "rofi-themes": "rofi-themes", "rose-pine": "rose-pine", @@ -891,7 +980,7 @@ "rose-pine-hyprcursor": { "inputs": { "hyprlang": "hyprlang", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "utils": "utils" }, "locked": { @@ -1162,6 +1251,39 @@ "type": "github" } }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1739246919, + "narHash": "sha256-/hBM43/Gd0/tW+egrhlWgOIISeJxEs2uAOIYVpfDKeU=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "44590a416d4a3e8220e19e29e0b6efe64a80315d", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.5.1", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1739246919, + "narHash": "sha256-/hBM43/Gd0/tW+egrhlWgOIISeJxEs2uAOIYVpfDKeU=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "44590a416d4a3e8220e19e29e0b6efe64a80315d", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, "zlib": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 51d023d..141e968 100644 --- a/flake.nix +++ b/flake.nix @@ -19,10 +19,12 @@ lix.overlays.default nur.overlays.default marleyvim.overlays.default + niri-flake.overlays.niri ]; systems.modules.nixos = with inputs; [ rose-pine.nixosModules.rose-pine + niri-flake.nixosModules.niri ]; systems.modules.darwin = with inputs; [ @@ -85,6 +87,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + niri-flake.url = "github:sodiboo/niri-flake"; + # Rose pine themes that aren't included in the above flake: # TODO: Integrate these to punkfairie/rose-pine-nix. rose-pine-amfora = { diff --git a/homes/x86_64-linux/marley@nyx/default.nix b/homes/x86_64-linux/marley@nyx/default.nix index e52f59a..dd4ff87 100644 --- a/homes/x86_64-linux/marley@nyx/default.nix +++ b/homes/x86_64-linux/marley@nyx/default.nix @@ -4,14 +4,16 @@ in { marleyos = { bundles.desktop = enabled; - wayland.hyprland = { - enable = true; - monitors = { - "DP-1" = "desc:Apple Computer Inc LED Cinema 2A91946Z0K0, 1920x1200, 0x0, 1"; - "HDMI-A-1" = "desc:Lenovo Group Limited LT2252p Wide 6V8ACF74, 1680x1050, 1920x0, 1"; - }; - mainMonitor = "DP-1"; - }; + # wayland.hyprland = { + # enable = true; + # monitors = { + # "DP-1" = "desc:Apple Computer Inc LED Cinema 2A91946Z0K0, 1920x1200, 0x0, 1"; + # "HDMI-A-1" = "desc:Lenovo Group Limited LT2252p Wide 6V8ACF74, 1680x1050, 1920x0, 1"; + # }; + # mainMonitor = "DP-1"; + # }; + + wayland.niri = enabled; }; home.stateVersion = "24.05"; diff --git a/modules/home/programs/wayland/fuzzel/default.nix b/modules/home/programs/wayland/fuzzel/default.nix new file mode 100644 index 0000000..6b79b60 --- /dev/null +++ b/modules/home/programs/wayland/fuzzel/default.nix @@ -0,0 +1,20 @@ +{ + lib, + config, + ... +}: let + cfg = config.marleyos.programs.fuzzel; +in { + options.marleyos.programs.fuzzel.enable = lib.mkEnableOption "fuzzel"; + + config = lib.mkIf cfg.enable { + marleyos.apps.launcher = { + inherit (config.programs.fuzzel) package; + command = ""; + }; + + programs.fuzzel = { + enable = true; + }; + }; +} diff --git a/modules/home/programs/hyprland/hyprlock/default.nix b/modules/home/programs/wayland/hyprlock/default.nix similarity index 100% rename from modules/home/programs/hyprland/hyprlock/default.nix rename to modules/home/programs/wayland/hyprlock/default.nix diff --git a/modules/home/programs/hyprland/waybar/default.nix b/modules/home/programs/wayland/waybar/default.nix similarity index 89% rename from modules/home/programs/hyprland/waybar/default.nix rename to modules/home/programs/wayland/waybar/default.nix index a9d4c1d..1fe4417 100644 --- a/modules/home/programs/hyprland/waybar/default.nix +++ b/modules/home/programs/wayland/waybar/default.nix @@ -8,12 +8,6 @@ in { options.marleyos.programs.waybar = { enable = lib.mkEnableOption "waybar"; - - keybindings-script = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = ""; - description = "The keybindings to use for a cheatsheet."; - }; }; config = lib.mkIf cfg.enable { @@ -22,28 +16,7 @@ in { programs.wlogout.enable = true; }; - programs.waybar = let - keybindings-script = - pkgs.writeShellScript "keybindings-cheatsheet-wayland" - # bash - '' - ${lib.getExe pkgs.yad} \ - --width=800 \ - --height=650 \ - --center \ - --fixed \ - --title="Keybindings" \ - --no-buttons \ - --list \ - --column=Key: \ - --column=Description: \ - --column=Command: \ - --timeout=90 \ - --timeout-indicator=right \ - ${lib.concatStringsSep "\\\n" cfg.keybindings-script} \ - "" - ''; - in { + programs.waybar = { enable = true; # https://gitlab.com/Zaney/zaneyos/-/blob/main/config/waybar.nix @@ -62,7 +35,6 @@ in { ]; modules-center = ["hyprland/workspaces"]; modules-right = [ - "custom/hyprbindings" "custom/notifications" "custom/exit" "battery" @@ -170,12 +142,6 @@ in { in "sleep 0.1 && ${lib.getExe launcher.package} ${launcher.command}"; }; - "custom/hyprbindings" = { - tooltip = false; - format = "󱕴"; - on-click = "sleep 0.1 && ${keybindings-script}"; - }; - "idle_inhibitor" = { format = "{icon}"; format-icons = { @@ -334,7 +300,7 @@ in { border-radius: 0 0 40px 0; } - #custom-hyprbindings, #network, #battery, #custom-notifications, + #network, #battery, #custom-notifications, #tray, #custom-exit { font-weight: bold; background: @seven; diff --git a/modules/home/programs/hyprland/wlogout/default.nix b/modules/home/programs/wayland/wlogout/default.nix similarity index 100% rename from modules/home/programs/hyprland/wlogout/default.nix rename to modules/home/programs/wayland/wlogout/default.nix diff --git a/modules/home/programs/hyprland/wlogout/hibernate.png b/modules/home/programs/wayland/wlogout/hibernate.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/hibernate.png rename to modules/home/programs/wayland/wlogout/hibernate.png diff --git a/modules/home/programs/hyprland/wlogout/lock.png b/modules/home/programs/wayland/wlogout/lock.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/lock.png rename to modules/home/programs/wayland/wlogout/lock.png diff --git a/modules/home/programs/hyprland/wlogout/logout.png b/modules/home/programs/wayland/wlogout/logout.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/logout.png rename to modules/home/programs/wayland/wlogout/logout.png diff --git a/modules/home/programs/hyprland/wlogout/reboot.png b/modules/home/programs/wayland/wlogout/reboot.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/reboot.png rename to modules/home/programs/wayland/wlogout/reboot.png diff --git a/modules/home/programs/hyprland/wlogout/shutdown.png b/modules/home/programs/wayland/wlogout/shutdown.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/shutdown.png rename to modules/home/programs/wayland/wlogout/shutdown.png diff --git a/modules/home/programs/hyprland/wlogout/suspend.png b/modules/home/programs/wayland/wlogout/suspend.png similarity index 100% rename from modules/home/programs/hyprland/wlogout/suspend.png rename to modules/home/programs/wayland/wlogout/suspend.png diff --git a/modules/home/programs/hyprland/wofi/default.nix b/modules/home/programs/wayland/wofi/default.nix similarity index 100% rename from modules/home/programs/hyprland/wofi/default.nix rename to modules/home/programs/wayland/wofi/default.nix diff --git a/modules/home/wayland/hyprland/default.nix b/modules/home/wayland/hyprland/default.nix index d9887b4..abd699f 100644 --- a/modules/home/wayland/hyprland/default.nix +++ b/modules/home/wayland/hyprland/default.nix @@ -288,25 +288,5 @@ in { ]; }; }; - - marleyos.programs.waybar.keybindings-script = [ - ''" = SUPER" "modifier key" ""'' - ''" + ENTER" "launch terminal" ""'' - ''" + r" "launcher" ""'' - ''" + q" "kill focused window" "killactive"'' - ''" + SHIFT + E" "exit hyprland" "exit"'' - ''" + SHIFT + SPACE" "toggle floating" "togglefloating"'' - ''" + e" "toggle split direction" "togglesplit"'' - ''" + h" "move focus left" "movefocus, l"'' - ''" + j" "move focus down" "movefocus, d"'' - ''" + k" "move focus up" "movefocus, u"'' - ''" + l" "move focus right" "movefocus, r"'' - ''" + 1-0" "move to workspace 1-10" "workspace, #"'' - ''" + SHIFT + 1-0" "move window to workspace 1-10" "movetoworkspace, #"'' - ''" + MOUSE UP" "move to next workspace" "workspace, e+1"'' - ''" + MOUSE DOWN" "move to prev workspace" "workspace, e-1"'' - ''" + LMB" "move/drag window" "movewindow"'' - ''" + RMB" "resize window" "resizewindow"'' - ]; }; } diff --git a/modules/home/wayland/niri/default.nix b/modules/home/wayland/niri/default.nix new file mode 100644 index 0000000..ec9c11b --- /dev/null +++ b/modules/home/wayland/niri/default.nix @@ -0,0 +1,162 @@ +{ + lib, + config, + ... +}: let + cfg = config.marleyos.wayland.niri; +in { + options.marleyos.wayland.niri = { + enable = lib.mkEnableOption "niri"; + + monitors = lib.mkOption { + description = "Monitor configuration."; + type = with lib.types; attrsOf str; + }; + + mainMonitor = lib.mkOption { + description = "Which monitor to treat as the main for workspace assignment"; + type = with lib.types; str; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = + if cfg ? monitors + then cfg ? mainMonitor + else true; + message = '' + You have defined monitors but not selected the main monitor. Please + define marleyos.wayland.niri.mainMonitor. + ''; + } + ]; + + marleyos = { + programs = { + waybar.enable = true; + wlogout.enable = true; + fuzzel.enable = true; + }; + services = { + swaync.enable = true; + }; + }; + + programs.niri = { + # Auto-enabled by the nixos module + # enable = true; + + settings = { + layout = { + gaps = 16; + center-focused-column = "never"; + + preset-column-widths = [ + {proportion = 0.33333;} + {proportion = 0.5;} + {proportion = 0.66667;} + ]; + + default-column-width = {proportion = 0.5;}; + + focus-ring = { + width = 4; + active = {color = "#7fc8ff";}; + inactive = {color = "#505050";}; + }; + + border = { + width = 4; + active = {color = "#ffc87f";}; + inactive = {color = "#505050";}; + }; + + shadow = { + softness = 30; + spread = 5; + + offset = { + x = 0; + y = 5; + }; + + color = "#0007"; + }; + }; + + screenshot-path = "~/pictures/screenshots/%Y-%m-%d %H-%M-%S.png"; + + window-rules = [ + { + matches = [{app-id = "^org\.wezfurlong\.wezterm$";}]; + default-column-width = {}; + } + { + matches = [ + { + app-id = "firefox$"; + title = "^Picture-in-Picture$"; + } + ]; + open-floating = true; + } + ]; + + binds = with config.lib.niri.actions; { + "Mod+Shift+Slash".action = show-hotkey-overlay; + "Mod+Return".action = spawn (lib.getExe config.marleyos.apps.terminal); + "Mod+R".action = spawn (lib.getExe config.programs.fuzzel.package); + "Mod+Q".action = close-window; + "Mod+H".action = focus-column-left; + "Mod+J".action = focus-window-down; + "Mod+K".action = focus-window-up; + "Mod+L".action = focus-column-right; + "Mod+Shift+H".action = move-column-left; + "Mod+Shift+J".action = move-window-down; + "Mod+Shift+K".action = move-window-up; + "Mod+Shift+L".action = move-column-right; + "Mod+Home".action = focus-column-first; + "Mod+End".action = focus-column-last; + "Mod+Shift+Home".action = move-column-to-first; + "Mod+Shift+End".action = move-column-to-last; + "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+Shift+Page_Down".action = move-column-to-workspace-down; + "Mod+Shift+Page_Up".action = move-column-to-workspace-up; + "Mod+Ctrl+Page_Down".action = move-workspace-up; + "Mod+Ctrl+Page_Up".action = move-workspace-down; + "Mod+BracketLeft".action = consume-or-expel-window-left; + "Mod+BracketRight".action = consume-or-expel-window-right; + "Mod+Comma".action = consume-window-into-column; + "Mod+Period".action = expel-window-from-column; + "Mod+P".action = switch-preset-column-width; + "Mod+Shift+P".action = switch-preset-window-height; + "Mod+Ctrl+P".action = reset-window-height; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+Ctrl+F".action = expand-column-to-available-width; + "Mod+C".action = center-column; + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Equal".action = set-column-width "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Equal".action = set-window-height "+10%"; + "Mod+V".action = toggle-window-floating; + "Mod+Shift+V".action = switch-focus-between-floating-and-tiling; + "Mod+T".action = toggle-column-tabbed-display; + "Print".action = screenshot; + "Ctrl+Print".action = screenshot-screen; + "Alt+Print".action = screenshot-window; + "Mod+Escape".action = toggle-keyboard-shortcuts-inhibit; + "Mod+Shift+E".action = quit; + "Ctrl+Alt+Delete".action = quit; + }; + }; + }; + }; +} diff --git a/modules/home/wayland/niri/wallpaper.png b/modules/home/wayland/niri/wallpaper.png new file mode 100644 index 0000000..730d721 Binary files /dev/null and b/modules/home/wayland/niri/wallpaper.png differ diff --git a/modules/nixos/wayland/niri/default.nix b/modules/nixos/wayland/niri/default.nix new file mode 100644 index 0000000..3f42caa --- /dev/null +++ b/modules/nixos/wayland/niri/default.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + ... +}: let + cfg = config.marleyos.wayland.niri; +in { + options.marleyos.wayland.niri.enable = lib.mkEnableOption "niri"; + + config = lib.mkIf cfg.enable { + programs.niri = { + enable = true; + }; + }; +} diff --git a/systems/x86_64-linux/nyx/default.nix b/systems/x86_64-linux/nyx/default.nix index 3717567..83cda74 100644 --- a/systems/x86_64-linux/nyx/default.nix +++ b/systems/x86_64-linux/nyx/default.nix @@ -17,7 +17,7 @@ in { bundles.desktop = enabled; - wayland.hyprland = enabled; + wayland.niri = enabled; services = { ly = enabled; };