Commit 4309f0490923

Vincent Demeester <vincent@sbr.pm>
2026-02-25 16:34:55
feat(raffi): add entries, web searches, shpool script filter, and enable icons
- Remove -I flag from niri and sway raffi keybindings to show icons - Add font_family (JetBrains Mono) and font_size (16) to general config - Add app entries: firefox private, profile manager, feishin, slack, dino, mpv clipboard, htop, shpool - Add web searches: google, github, nix packages, youtube, wikipedia - Add shpool-raffi script filter (keyword: sp) to list/create sessions - Change worktree script filter icon to folder-git - Bump vde-scripts 0.9 -> 0.10 for new shpool-raffi script
1 parent e60ef8e
Changed files (5)
dots
config
home
common
desktop
pkgs
dots/config/niri/config.kdl
@@ -198,7 +198,7 @@ binds {
     Mod+Control+Return hotkey-overlay-title="Open Emacs" { spawn "emacs"; }
     Mod+Control+Alt+Return hotkey-overlay-title="Open Emacs Anywhere" { spawn "emacsclient" "-eval" "(vde/type)"; }
     Mod+D hotkey-overlay-title="Run an Application" { spawn "fuzzel"; }
-    Mod+Shift+D hotkey-overlay-title="Run Raffi" { spawn "raffi" "-I"; }
+    Mod+Shift+D hotkey-overlay-title="Run Raffi" { spawn "raffi"; }
     Mod+F3 hotkey-overlay-title="Voice-to-text (Push-to-talk)" { spawn "voxtype" "record" "toggle"; }
     // FIXME do not use nix run, but needs niri configuration
     Mod+Control+D hotkey-overlay-title="Emoji picker" { spawn "rofimoji" "--selector" "fuzzel" "--clipboarder" "wl-copy" "--typer" "wtype" "--action" "type" "copy"; }
dots/config/raffi/raffi.yaml
@@ -1,6 +1,8 @@
 general:
   ui_type: native
   theme: light
+  font_family: "JetBrains Mono"
+  font_size: 16
   theme_colors:
     bg_base: "#faf4ed"
     bg_input: "#f2ece4"
@@ -17,6 +19,50 @@ firefox:
   description: Firefox
   icon: firefox
 
+firefox-private:
+  binary: firefox
+  args: ["--private-window"]
+  description: Firefox Private Window
+  icon: firefox
+
+firefox-profile-manager:
+  binary: firefox
+  args: ["--ProfileManager"]
+  description: Firefox Profile Manager
+  icon: firefox
+
+# Music
+feishin:
+  binary: feishin
+  description: Feishin (Music)
+  icon: feishin
+
+# Chat
+slack:
+  binary: slack
+  description: Slack
+  icon: slack
+
+# Media
+mpv-clipboard:
+  description: Play URL from clipboard (mpv)
+  icon: mpv
+  script: |
+    wl-paste | xargs mpv
+
+# Chat
+dino:
+  binary: dino
+  description: Dino (XMPP)
+  icon: dino
+
+# System
+htop:
+  description: System Monitor
+  icon: htop
+  script: |
+    kitty --title "htop" htop
+
 # Editors
 emacs:
   binary: emacsclient
@@ -118,8 +164,13 @@ addons:
     - name: Worktrees
       keyword: wt
       command: lazyworktree-raffi
-      icon: folder
+      icon: folder-git
       action: "kitty --title Worktrees --directory {value} lazyworktree"
+    - name: Shpool Sessions
+      keyword: sp
+      command: shpool-raffi
+      icon: utilities-terminal
+      action: "kitty --title shpool:{value} shpool attach {value}"
     - name: GitHub Pull Requests
       keyword: pr
       command: ~/src/gitlab.com/chmouel/alfred-pr-workflow/pr.py
@@ -127,3 +178,24 @@ addons:
       icon: github
       action: "xdg-open {value}"
       secondary_action: "echo -n {value} | wl-copy"
+  web_searches:
+    - name: Google
+      keyword: g
+      url: "https://google.com/search?q={query}"
+      icon: google
+    - name: GitHub
+      keyword: gh
+      url: "https://github.com/search?q={query}&type=repositories"
+      icon: github
+    - name: Nix Packages
+      keyword: nix
+      url: "https://search.nixos.org/packages?query={query}"
+      icon: nix
+    - name: YouTube
+      keyword: yt
+      url: "https://www.youtube.com/results?search_query={query}"
+      icon: youtube
+    - name: Wikipedia
+      keyword: wp
+      url: "https://en.wikipedia.org/w/index.php?search={query}"
+      icon: wikipedia
home/common/desktop/sway/default.nix
@@ -287,7 +287,7 @@ in
       ''
         bindcode ${mod}+Control+Shift+Alt+41 exec emacs
         bindcode ${mod}+33 exec "${menu}"
-        bindcode ${mod}+Shift+33 exec "raffi -I"
+        bindcode ${mod}+Shift+33 exec "raffi"
         bindcode ${mod}+Control+33 exec "${pkgs.wofi-emoji}/bin/wofi-emoji -G"
         bindcode ${mod}+Shift+24 kill
         bindcode ${mod}+38 focus parent
pkgs/my/scripts/bin/shpool-raffi
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# List shpool sessions for raffi script filter.
+# Outputs Alfred Script Filter JSON format.
+# Usage: shpool-raffi [query]
+#
+# Always includes a "new session" item. If a query is given that doesn't
+# match any existing session, the new session item uses the query as name.
+
+set -euo pipefail
+
+query="${1:-}"
+
+items="[]"
+
+# Parse existing sessions
+while IFS=$'\t' read -r name started_at status; do
+    [[ "$name" == "NAME" ]] && continue  # skip header
+    [[ -z "$name" ]] && continue
+    items=$(jq --arg n "$name" --arg s "$status" --arg t "$started_at" \
+        '. + [{"title": $n, "subtitle": "\($s) since \($t)", "arg": $n}]' <<< "$items")
+done < <(shpool list 2>/dev/null)
+
+# Add "new session" entry
+if [[ -n "$query" ]]; then
+    new_name="$query"
+else
+    new_name="main"
+fi
+items=$(jq --arg n "$new_name" \
+    '. + [{"title": "➕ New: \($n)", "subtitle": "Create or attach to session \($n)", "arg": $n}]' <<< "$items")
+
+# Filter by query
+if [[ -n "$query" ]]; then
+    items=$(jq --arg q "$query" \
+        '[.[] | select(.title | ascii_downcase | contains($q | ascii_downcase))]' <<< "$items")
+fi
+
+jq -n --argjson items "$items" '{"items": $items}'
pkgs/my/scripts/default.nix
@@ -5,7 +5,7 @@
 
 stdenv.mkDerivation {
   pname = "vde-scripts";
-  version = "0.9";
+  version = "0.10";
 
   src = ./.;