Commit c0d0a8b05f3d

Vincent Demeester <vincent@sbr.pm>
2026-02-10 14:08:14
fix(kitty): corrected custom hints keybindings and clipboard API
Fixed keybinding for word definition from kitty_mod+shift+d to kitty_mod+alt+d. Added mkh alias to custom hints for bรฉpo-optimized alphabet. Switched from fast_data_types import to boss API for clipboard.
1 parent 7ef5f2a
Changed files (2)
dots
pi
agent
extensions
home
common
desktop
dots/pi/agent/extensions/jira/index.ts
@@ -535,10 +535,18 @@ export default function (pi: ExtensionAPI) {
 				recentIssues = recentIssues.slice(-20);
 			}
 
+			// Extract summary from output for better heading
+			let title = issueKey;
+			const summaryMatch = result.stdout.match(/^Summary:\s*(.+)$/m);
+			if (summaryMatch && summaryMatch[1]) {
+				const summary = summaryMatch[1].trim();
+				title = `${issueKey} - ${summary}`;
+			}
+
 			// Display result directly
 			pi.sendMessage({
 				customType: "jira-view",
-				content: `## ๐Ÿ” ${issueKey}\n\n_Command: \`jira issue view ${issueKey} --plain\`_\n\n${result.stdout}`,
+				content: `## ๐Ÿ” ${title}\n\n_Command: \`jira issue view ${issueKey} --plain\`_\n\n${result.stdout}`,
 				display: true,
 			});
 		},
@@ -552,9 +560,10 @@ export default function (pi: ExtensionAPI) {
 			const hasTrailingSpace = prefix.endsWith(" ");
 			const trimmed = prefix.trim();
 			
-			// Get the last word
-			const words = trimmed.split(/\s+/);
+			// Get the words
+			const words = trimmed.split(/\s+/).filter((w) => w.length > 0);
 			const lastWord = hasTrailingSpace ? "" : (words[words.length - 1] || "");
+			const previousWord = words.length >= 2 ? words[words.length - 2] : "";
 			const beforeLastWord = lastWord ? trimmed.substring(0, trimmed.length - lastWord.length) : trimmed + " ";
 
 			// Field completions (start of query or after AND/OR)
@@ -622,46 +631,57 @@ export default function (pi: ExtensionAPI) {
 
 			// Context-aware suggestions
 			if (lastWord.toLowerCase().startsWith("status")) {
+				// Typing "status..." โ†’ show status values
 				completions = statuses.map((s) => ({
 					value: beforeLastWord + s.value,
 					label: s.label,
 				}));
 			} else if (lastWord.toLowerCase().startsWith("assignee")) {
+				// Typing "assignee..." โ†’ show assignee values
 				completions = assignees.map((a) => ({
 					value: beforeLastWord + a.value,
 					label: a.label,
 				}));
 			} else if (lastWord.toLowerCase().startsWith("priority")) {
+				// Typing "priority..." โ†’ show priority values
 				completions = priorities.map((p) => ({
 					value: beforeLastWord + p.value,
 					label: p.label,
 				}));
 			} else if (lastWord.toLowerCase().startsWith("type")) {
+				// Typing "type..." โ†’ show type values
 				completions = types.map((t) => ({
 					value: beforeLastWord + t.value,
 					label: t.label,
 				}));
 			} else if (lastWord.toLowerCase().startsWith("created") || lastWord.toLowerCase().startsWith("updated")) {
+				// Typing "created..." or "updated..." โ†’ show time values
 				completions = times
 					.filter((t) => t.value.toLowerCase().startsWith(lastWord.toLowerCase()))
 					.map((t) => ({
 						value: beforeLastWord + t.value,
 						label: t.label,
 					}));
-			} else if (lastWord.length === 0 && trimmed.length > 0) {
-				// Just finished a word (ends with space), suggest fields for next condition
+			} else if (hasTrailingSpace && (previousWord === "AND" || previousWord === "OR")) {
+				// Just typed "AND " or "OR " โ†’ suggest fields
 				completions = fields.map((f) => ({
-					value: trimmed + f.value,
+					value: trimmed + " " + f.value,
 					label: f.label,
 				}));
-			} else if (trimmed.length > 0 && !trimmed.endsWith(" ")) {
-				// In the middle of typing something - suggest operators after current word
+			} else if (hasTrailingSpace || lastWord.length === 0) {
+				// Ends with space but not after AND/OR โ†’ suggest operators
+				completions = operators.map((o) => ({
+					value: trimmed + " " + o.value,
+					label: o.label,
+				}));
+			} else if (trimmed.length > 0) {
+				// In the middle of typing something โ†’ suggest operators
 				completions = operators.map((o) => ({
 					value: trimmed + " " + o.value,
 					label: o.label,
 				}));
 			} else {
-				// Empty or start of query, suggest fields
+				// Empty or start of query โ†’ suggest fields
 				completions = fields.map((f) => ({
 					value: f.value,
 					label: f.label,
home/common/desktop/kitty.nix
@@ -110,13 +110,13 @@
       # ============================================================================
 
       # Jira issue tracker - detect and open issues (SRVKP-123, JIRA-456, etc.)
-      map kitty_mod+j kitten hints --customize-processing ~/.config/kitty/jira-hints.py open
-      map kitty_mod+alt+j kitten hints --customize-processing ~/.config/kitty/jira-hints.py copy
+      map kitty_mod+j mkh --customize-processing ~/.config/kitty/jira-hints.py open
+      map kitty_mod+alt+j mkh --customize-processing ~/.config/kitty/jira-hints.py copy
 
       # Word selection hints with multiple actions
       # Copy word to clipboard (default word hint already at kitty_mod+d)
-      map kitty_mod+shift+d kitten hints --customize-processing ~/.config/kitty/word-hints.py define
-      map kitty_mod+t kitten hints --customize-processing ~/.config/kitty/word-hints.py translate
+      map kitty_mod+alt+d mkh --customize-processing ~/.config/kitty/word-hints.py define
+      map kitty_mod+t mkh --customize-processing ~/.config/kitty/word-hints.py translate
 
       # ============================================================================
       # KITTY POPUPS (tmux-style overlays)
@@ -174,9 +174,8 @@
           
           for issue_key, match_data in zip(matches, groupdicts):
               if action == 'copy':
-                  # Copy issue key to clipboard
-                  from kitty.fast_data_types import set_clipboard_string
-                  set_clipboard_string(issue_key)
+                  # Copy issue key to clipboard using boss API
+                  boss.set_clipboard_string(issue_key)
               else:
                   # Open in browser (default)
                   url = f'https://issues.redhat.com/browse/{issue_key}'
@@ -233,15 +232,12 @@
                   boss.open_url(url)
                   
               elif action == 'copy':
-                  # Copy to clipboard (default)
-                  # Use kitty's set-clipboard functionality
-                  from kitty.fast_data_types import set_clipboard_string
-                  set_clipboard_string(word)
+                  # Copy to clipboard using boss API
+                  boss.set_clipboard_string(word)
                   
               else:
                   # Unknown action - just copy
-                  from kitty.fast_data_types import set_clipboard_string
-                  set_clipboard_string(word)
+                  boss.set_clipboard_string(word)
     '';
 
     "kitty/dark-theme.auto.conf".source =