From 4d550731afd2805c11426f5d758484e949880d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Tue, 3 Feb 2026 21:23:26 +0100 Subject: [PATCH] niri, ashell --- .gitignore | 1 + flake.nix | 12 ++- modules/niri/default.nix | 7 ++ packages/ashell.nix | 48 ++++++++++++ packages/niri/default.nix | 159 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 modules/niri/default.nix create mode 100644 packages/ashell.nix create mode 100644 packages/niri/default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.nix b/flake.nix index 0e21f56..db60dd8 100644 --- a/flake.nix +++ b/flake.nix @@ -28,14 +28,24 @@ zsh = modules/zsh.nix; git = modules/git.nix; udiskie = modules/udiskie.nix; + niri = modules/niri; }; overlays.default = final: prev: { vim-kmein = prev.callPackage packages/vim { }; + ashell-kmein = import packages/ashell.nix { + inherit (inputs) wrappers; + pkgs = prev; + }; git-kmein = import packages/git.nix { inherit (inputs) wrappers; pkgs = prev; }; + niri-kmein = import packages/niri { + inherit (inputs) wrappers; + pkgs = final; + lib = inputs.nixpkgs.lib; + }; }; packages = eachSupportedSystem ( @@ -47,7 +57,7 @@ }; in { - inherit (pkgs) vim-kmein git-kmein; + inherit (pkgs) vim-kmein git-kmein niri-kmein; } ); diff --git a/modules/niri/default.nix b/modules/niri/default.nix new file mode 100644 index 0000000..2543be6 --- /dev/null +++ b/modules/niri/default.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + programs.niri = { + enable = true; + package = pkgs.niri-kmein; + }; +} diff --git a/packages/ashell.nix b/packages/ashell.nix new file mode 100644 index 0000000..3d13567 --- /dev/null +++ b/packages/ashell.nix @@ -0,0 +1,48 @@ +{ wrappers, pkgs }: +let + config = { + clock.format = "%Y-%m-%d (%j %a %W) %H:%M"; + modules = { + center = [ "Clock" ]; + left = [ + "Workspaces" + [ "WindowTitle" ] + ]; + right = [ + "KeyboardLayout" + [ + "Tray" + "SystemTray" + "Settings" + ] + ]; + }; + settings.indicators = [ + "IdleInhibitor" + "PowerProfile" + "Audio" + "Bluetooth" + "Network" + "Vpn" + "Battery" + ]; + system_info.indicators = [ + "Cpu" + "Memory" + { "Disk" = "/"; } + ]; + workspaces = { + disable_special_workspaces = true; + enable_workspace_filling = false; + visibility_mode = "MonitorSpecific"; + }; + }; + configFile = (pkgs.formats.toml { }).generate "config.toml" config; +in +wrappers.lib.wrapPackage { + inherit pkgs; + package = pkgs.ashell; + flags = { + "--config-path" = toString configFile; + }; +} diff --git a/packages/niri/default.nix b/packages/niri/default.nix new file mode 100644 index 0000000..c24eab5 --- /dev/null +++ b/packages/niri/default.nix @@ -0,0 +1,159 @@ +{ + wrappers, + pkgs, + lib, + screenshotPath ? "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png", + fileManager ? lib.getExe pkgs.pcmanfm, + browser ? lib.getExe pkgs.firefox, + terminal ? lib.getExe pkgs.alacritty, + runnerCommand ? "${lib.getExe pkgs.rofi} -show run", + locker ? lib.getExe pkgs.swaylock, +}: +let + colors = { + active-color = "#7fc8ff"; + inactive-color = "#505050"; + shadow-color = "#0007"; + }; + + niri = wrappers.wrapperModules.niri.apply { + inherit pkgs; + settings = { + input = { + keyboard = { + xkb.layout = "de"; + numlock = null; + }; + mouse = null; + trackpoint = null; + warp-mouse-to-focus = null; + focus-follows-mouse = null; + }; + layout = { + gaps = 8; + center-focused-column = "never"; + preset-column-widths = [ + { proportion = 1. / 3.; } + { proportion = 1. / 2.; } + { proportion = 2. / 3.; } + ]; + default-column-width = { + proportion = 1. / 2.; + }; + focus-ring = { + width = 2; + active-color = colors.active-color; + inactive-color = colors.inactive-color; + }; + shadow = { + on = null; + draw-behind-window = true; + softness = 30; + spread = 5; + color = colors.shadow-color; + }; + }; + spawn-at-startup = [ + (lib.getExe pkgs.ashell-kmein) + ]; + hotkey-overlay.skip-at-startup = null; + prefer-no-csd = null; + screenshot-path = screenshotPath; + animations.slowdown = 0.5; # twice as fast + binds = + let + wpctl = lib.getExe' pkgs.wireplumber "wpctl"; + in + { + "Mod+Shift+Slash".show-hotkey-overlay = null; + "Mod+Y".spawn = browser; + "Mod+T".spawn = fileManager; + "Mod+Return".spawn = terminal; + "Mod+D".spawn-sh = runnerCommand; + "Mod+Shift+W".spawn = locker; + + # TODO allow-when-locked + "XF86AudioRaiseVolume".spawn-sh = "${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; + "XF86AudioLowerVolume".spawn-sh = "${wpctl} set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; + "XF86AudioMute".spawn-sh = "${wpctl} set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "XF86AudioMicMute".spawn-sh = "${wpctl} set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + "XF86AudioPlay".spawn-sh = "${lib.getExe pkgs.playerctl} play-pause"; + "XF86AudioStop".spawn-sh = "${lib.getExe pkgs.playerctl} stop"; + "XF86AudioPrev".spawn-sh = "${lib.getExe pkgs.playerctl} previous"; + "XF86AudioNext".spawn-sh = "${lib.getExe pkgs.playerctl} next"; + "XF86MonBrightnessUp".spawn-sh = "${lib.getExe pkgs.brightnessctl} --class=backlight set +10%"; + "XF86MonBrightnessDown".spawn-sh = "${lib.getExe pkgs.brightnessctl} --class=backlight set 10%-"; + + # TODO repeat=false + "Mod+O".toggle-overview = null; + "Mod+Shift+Q".close-window = null; + + "Mod+H".focus-column-left = null; + "Mod+J".focus-window-or-workspace-down = null; + "Mod+K".focus-window-or-workspace-up = null; + "Mod+L".focus-column-right = null; + "Mod+Shift+H".move-column-left = null; + "Mod+Shift+J".move-window-down-or-to-workspace-down = null; + "Mod+Shift+K".move-window-up-or-to-workspace-up = null; + "Mod+Shift+L".move-column-right = null; + "Mod+Home".focus-column-first = null; + "Mod+End".focus-column-last = null; + "Mod+Shift+Home".move-column-to-first = null; + "Mod+Shift+End".move-column-to-last = null; + + # TODO cooldown-ms=150 + "Mod+WheelScrollDown".focus-workspace-down = null; + "Mod+WheelScrollUp".focus-workspace-up = null; + "Mod+Shift+WheelScrollDown".move-column-to-workspace-down = null; + "Mod+Shift+WheelScrollUp".move-column-to-workspace-up = null; + + "Mod+WheelScrollRight".focus-column-right = null; + "Mod+WheelScrollLeft".focus-column-left = null; + "Mod+Shift+WheelScrollRight".move-column-right = null; + "Mod+Shift+WheelScrollLeft".move-column-left = null; + + "Mod+1".focus-workspace = 1; + "Mod+2".focus-workspace = 2; + "Mod+3".focus-workspace = 3; + "Mod+4".focus-workspace = 4; + "Mod+5".focus-workspace = 5; + "Mod+6".focus-workspace = 6; + "Mod+7".focus-workspace = 7; + "Mod+8".focus-workspace = 8; + "Mod+9".focus-workspace = 9; + "Mod+Shift+1".move-window-to-workspace = 1; + "Mod+Shift+2".move-window-to-workspace = 2; + "Mod+Shift+3".move-window-to-workspace = 3; + "Mod+Shift+4".move-window-to-workspace = 4; + "Mod+Shift+5".move-window-to-workspace = 5; + "Mod+Shift+6".move-window-to-workspace = 6; + "Mod+Shift+7".move-window-to-workspace = 7; + "Mod+Shift+8".move-window-to-workspace = 8; + "Mod+Shift+9".move-window-to-workspace = 9; + "Mod+Tab".focus-workspace-previous = null; + "Mod+Comma".consume-window-into-column = null; + "Mod+Period".expel-window-from-column = null; + "Mod+R".switch-preset-column-width = null; + "Mod+F".maximize-column = null; + "Mod+Shift+F".fullscreen-window = null; + "Mod+Ctrl+F".expand-column-to-available-width = null; + "Mod+Minus".set-column-width = "-10%"; + "Mod+Plus".set-column-width = "+10%"; + + "Mod+V".toggle-window-floating = null; + "Mod+Shift+V".switch-focus-between-floating-and-tiling = null; + + "Print".screenshot = null; + "Ctrl+Print".screenshot-screen = null; + "Alt+Print".screenshot-window = null; + + # allow-inhibiting=false + "Mod+Escape".toggle-keyboard-shortcuts-inhibit = null; + + "Mod+Shift+E".quit = null; + "Ctrl+Alt+Delete".quit = null; + }; + }; + }; +in +niri.wrapper