From c2082e942edc5f0ab72dbd2f396b890ba3bf6f63 Mon Sep 17 00:00:00 2001 From: Jelle Spreeuwenberg Date: Tue, 5 May 2026 20:56:09 +0200 Subject: [PATCH] feat: add walker and general launcher config --- modules/capabilities/niri/_bindings.nix | 43 ++---------------------- modules/capabilities/niri/_shortcuts.nix | 37 +++----------------- modules/capabilities/niri/default.nix | 1 + modules/capabilities/vicinae.nix | 27 +++++++++++++++ modules/capabilities/walker.nix | 33 ++++++++++++++++++ modules/lib/schema.nix | 35 +++++++++++++++++++ modules/profiles/workstation-base.nix | 2 +- 7 files changed, 105 insertions(+), 73 deletions(-) create mode 100644 modules/capabilities/walker.nix diff --git a/modules/capabilities/niri/_bindings.nix b/modules/capabilities/niri/_bindings.nix index 5282306..350f98d 100644 --- a/modules/capabilities/niri/_bindings.nix +++ b/modules/capabilities/niri/_bindings.nix @@ -1,5 +1,6 @@ { browserCommand, + launcherCommands, shortcutCommands, terminalCommand, }: @@ -15,10 +16,7 @@ }; "Mod+Space" = { repeat = false; - action.spawn = [ - "vicinae" - "toggle" - ]; + action.spawn = launcherCommands.open; hotkey-overlay.title = "App Launcher"; }; "Mod+E" = { @@ -43,10 +41,7 @@ }; "Mod+Ctrl+F" = { repeat = false; - action.spawn = [ - shortcutCommands.vicinaeCommand - "files" - ]; + action.spawn = launcherCommands.files; hotkey-overlay.title = "Find Files"; }; "Mod+V" = { @@ -54,38 +49,6 @@ action.spawn = shortcutCommands.clipboardHistory; hotkey-overlay.title = "Clipboard History"; }; - "Mod+Ctrl+N" = { - repeat = false; - action.spawn = [ - shortcutCommands.vicinaeCommand - "nix-options" - ]; - hotkey-overlay.title = "NixOS Options"; - }; - "Mod+Ctrl+H" = { - repeat = false; - action.spawn = [ - shortcutCommands.vicinaeCommand - "home-manager-options" - ]; - hotkey-overlay.title = "Home Manager Options"; - }; - "Mod+Ctrl+P" = { - repeat = false; - action.spawn = [ - shortcutCommands.vicinaeCommand - "nix-packages" - ]; - hotkey-overlay.title = "Nix Packages"; - }; - "Mod+Ctrl+W" = { - repeat = false; - action.spawn = [ - shortcutCommands.vicinaeCommand - "niri-windows" - ]; - hotkey-overlay.title = "Windows"; - }; "Mod+Ctrl+C" = { repeat = false; action.spawn = shortcutCommands.pickColor; diff --git a/modules/capabilities/niri/_shortcuts.nix b/modules/capabilities/niri/_shortcuts.nix index 693720a..43196bc 100644 --- a/modules/capabilities/niri/_shortcuts.nix +++ b/modules/capabilities/niri/_shortcuts.nix @@ -6,6 +6,9 @@ }: let nixosConfigDir = repo.account.nixosConfigurationPath; + launcherDmenuCommand = + lib.concatMapStringsSep " " lib.escapeShellArg + config.meta.desktop.launcher.commands.dmenu; mkTerminalScript = { name, @@ -122,45 +125,15 @@ rec { ''; }; - vicinaeCommand = pkgs.writeShellApplication { - name = "niri-shortcut-vicinae-command"; - runtimeInputs = [ config.programs.vicinae.package ]; - text = '' - case "''${1:-}" in - files) - link="vicinae://extensions/sameoldlab/fuzzy-files/find" - ;; - nix-options) - link="vicinae://extensions/knoopx/nix/options" - ;; - home-manager-options) - link="vicinae://extensions/knoopx/nix/home-manager-options" - ;; - nix-packages) - link="vicinae://extensions/knoopx/nix/packages" - ;; - niri-windows) - link="vicinae://extensions/knoopx/niri/windows" - ;; - *) - printf 'unknown Vicinae command target: %s\n' "''${1:-}" >&2 - exit 64 - ;; - esac - - exec vicinae deeplink "$link" - ''; - }; - clipboardHistory = pkgs.writeShellApplication { name = "niri-shortcut-clipboard-history"; runtimeInputs = [ pkgs.cliphist - config.programs.vicinae.package + config.meta.desktop.launcher.package pkgs.wl-clipboard ]; text = '' - selection="$(cliphist list | vicinae dmenu --navigation-title Clipboard --placeholder 'Search clipboard' --no-metadata)" + selection="$(cliphist list | ${launcherDmenuCommand})" if [ -z "$selection" ]; then exit 0 fi diff --git a/modules/capabilities/niri/default.nix b/modules/capabilities/niri/default.nix index d24ed84..30d5966 100644 --- a/modules/capabilities/niri/default.nix +++ b/modules/capabilities/niri/default.nix @@ -164,6 +164,7 @@ in binds = import ./_bindings.nix { browserCommand = config.meta.desktop.browser.command; + launcherCommands = config.meta.desktop.launcher.commands; terminalCommand = config.meta.desktop.terminal.command; shortcutCommands = shortcuts.commands; }; diff --git a/modules/capabilities/vicinae.nix b/modules/capabilities/vicinae.nix index 15ec1fa..5ba23e3 100644 --- a/modules/capabilities/vicinae.nix +++ b/modules/capabilities/vicinae.nix @@ -5,13 +5,16 @@ in { flake.modules.homeManager.vicinae = { + config, pkgs, inputs, + lib, ... }: let repoTheme = repo.theme.kanagawa; palette = repoTheme.palette; + launcherCommand = lib.getExe config.programs.vicinae.package; in { programs.vicinae = { @@ -70,5 +73,29 @@ in ssh ]; }; + + meta.desktop.launcher = { + package = config.programs.vicinae.package; + commands = { + open = [ + launcherCommand + "toggle" + ]; + files = [ + launcherCommand + "deeplink" + "vicinae://extensions/sameoldlab/fuzzy-files/find" + ]; + dmenu = [ + launcherCommand + "dmenu" + "--navigation-title" + "Clipboard" + "--placeholder" + "Search clipboard" + "--no-metadata" + ]; + }; + }; }; } diff --git a/modules/capabilities/walker.nix b/modules/capabilities/walker.nix new file mode 100644 index 0000000..fefc726 --- /dev/null +++ b/modules/capabilities/walker.nix @@ -0,0 +1,33 @@ +{ + flake.modules.homeManager.walker = + { config, lib, ... }: + let + launcherCommand = lib.getExe config.services.walker.package; + in + { + services.walker = { + enable = true; + systemd.enable = true; + }; + + meta.desktop.launcher = { + package = config.services.walker.package; + commands = { + open = [ launcherCommand ]; + files = [ + launcherCommand + "--query" + "/" + "--placeholder" + "Find files" + ]; + dmenu = [ + launcherCommand + "--dmenu" + "--placeholder" + "Search clipboard" + ]; + }; + }; + }; +} diff --git a/modules/lib/schema.nix b/modules/lib/schema.nix index 7d0ace7..6c0bc32 100644 --- a/modules/lib/schema.nix +++ b/modules/lib/schema.nix @@ -108,6 +108,37 @@ let } ); + launcherType = lib.types.submodule ( + { config, ... }: + { + options = { + package = lib.mkOption { + type = lib.types.package; + }; + + command = lib.mkOption { + type = lib.types.str; + default = lib.getExe config.package; + defaultText = lib.literalExpression "lib.getExe config.package"; + }; + + commands = { + open = lib.mkOption { + type = lib.types.listOf lib.types.str; + }; + + files = lib.mkOption { + type = lib.types.listOf lib.types.str; + }; + + dmenu = lib.mkOption { + type = lib.types.listOf lib.types.str; + }; + }; + }; + } + ); + displayType = lib.types.submodule ( { ... }: { @@ -236,6 +267,10 @@ in type = desktopApplicationType; }; + options.meta.desktop.launcher = lib.mkOption { + type = launcherType; + }; + options.meta.pinentry.package = lib.mkOption { type = lib.types.package; }; diff --git a/modules/profiles/workstation-base.nix b/modules/profiles/workstation-base.nix index 1b27ed6..32abe5f 100644 --- a/modules/profiles/workstation-base.nix +++ b/modules/profiles/workstation-base.nix @@ -58,7 +58,7 @@ in homeModules.primary-terminal-kitty homeModules.terminal-foot homeModules.theme - homeModules.vicinae + homeModules.walker homeModules.noctalia { programs.discord = {