Commit c5e6b0badd70

Vincent Demeester <vincent@sbr.pm>
2026-03-12 13:26:27
feat(org-capture): raffi template picker and fix select buffer
Added display-buffer-alist rule to show *Org Select* in the same window instead of splitting. Added raffi script filter (keyword: cap) that lists capture templates and opens capture directly with the selected template, bypassing the Org Select buffer entirely.
1 parent aa8da5d
Changed files (3)
dots
dots/config/emacs/init.el
@@ -2044,6 +2044,11 @@ Link: %a"
   ;;                (file+datetree ,org-meeting-notes-file)
   ;;                (file ,(concat user-emacs-directory "/etc/orgmode/meeting-notes.org"))))
   
+  ;; Make *Org Select* use the full window instead of splitting
+  (add-to-list 'display-buffer-alist
+               '("\\*Org Select\\*"
+                 (display-buffer-same-window)))
+
   (defun vde/window-delete-popup-frame (&rest _)
     "Kill selected selected frame if it has parameter `prot-window-popup-frame'.
 Use this function via a hook."
dots/config/raffi/scripts/org-capture-raffi
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# List org-capture templates for raffi script filter.
+# Outputs Alfred Script Filter JSON format.
+# Usage: org-capture-raffi [query]
+set -euo pipefail
+
+query="${1:-}"
+
+# Get capture templates from running Emacs
+templates=$(emacsclient --eval '
+(mapconcat
+ (lambda (tpl)
+   (let ((key (car tpl))
+         (desc (cadr tpl))
+         (selectable (> (length tpl) 2)))
+     (when selectable
+       (format "%s\t%s" key desc))))
+ org-capture-templates "\n")
+' 2>/dev/null | sed 's/^"//;s/"$//' | sed 's/\\n/\n/g')
+
+items="[]"
+while IFS=$'\t' read -r key desc; do
+    [[ -z "$key" ]] && continue
+    [[ -z "$desc" ]] && continue
+
+    if [[ -n "$query" ]] && ! echo "$key $desc" | grep -qi "$query"; then
+        continue
+    fi
+
+    items=$(jq --arg key "$key" --arg desc "$desc" \
+        '. + [{"title": $desc, "subtitle": "Capture template: \($key)", "arg": $key}]' <<< "$items")
+done <<< "$templates"
+
+jq -n --argjson items "$items" '{"items": $items}'
dots/config/raffi/raffi.yaml
@@ -86,6 +86,11 @@ addons:
     command: ~/.config/raffi/scripts/niri-windows-raffi
     icon: window-close
     action: niri msg action close-window --id {value}
+  - name: Org Capture
+    keyword: cap
+    command: ~/.config/raffi/scripts/org-capture-raffi
+    icon: emacs
+    action: emacsclient -c -F '((name . "capture") (width . 150) (height . 90) (vde/window-popup-frame . t))' -e '(org-capture nil "{value}")' &
   - name: Bluetooth
     keyword: bt
     command: ~/.config/raffi/scripts/bluetooth-raffi