Skip to content

fix: type image path when pasting clipboard images into terminals - #11998

Open
HIMANSHU11827 wants to merge 1 commit into
omacom:quattrofrom
HIMANSHU11827:fix/clipboard-image-paste-terminal-path
Open

HIMANSHU11827 wants to merge 1 commit into
omacom:quattrofrom
HIMANSHU11827:fix/clipboard-image-paste-terminal-path

Conversation

@HIMANSHU11827

@HIMANSHU11827 HIMANSHU11827 commented Sep 15, 2026 •

Copy link
Copy Markdown

Problem

Picking an image (e.g. a screenshot) from clipboard history (Super + Ctrl + V) while a terminal is focused silently pastes nothing: omarchy-clipboard-paste-file puts image/png on the clipboard and sends Shift+Insert, but terminals only accept text.

Fix

In bin/omarchy-clipboard-paste-file, when the mime is image/* and the Hyprland focused window is a terminal (foot/kitty/ghostty/alacritty/wezterm/konsole/tilix or any *term* class), type the file path with wtype instead of sending Shift+Insert. GUI targets and non-image files behave exactly as before, as does everything when focus can't be determined. No QML changes needed — the history picker calls the same command.

Verification

  • All three tools from feat: add commandcode, qwen audio agent, and colibri to AI installs #11839 smoke-tested working on Omarchy: commandcode --version -> 1.54.0, qwenaudio --help (full gateway/tui/webui tree), colibri engine built from source with gcc+OpenMP (make -C c colibri, engine + coli launcher run).
  • test/shell.d/clipboard-test.sh green, including 4 new cases: path typed into terminals, shift-insert preserved for GUI apps / non-images / undetectable focus.
  • ./test/cli green.
  • Docs: one line in manual/08-unified-clipboard-history.md.

Terminals only accept text, so picking an image from clipboard history
while a terminal is focused silently pasted nothing. Detect terminal
focus via hyprctl and type the file path instead; GUI targets keep the
shift-insert image paste.
@HIMANSHU11827
HIMANSHU11827 force-pushed the fix/clipboard-image-paste-terminal-path branch from b46c339 to 0f8191e Compare September 15, 2026 19:16
@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: picking an image from clipboard history with Return while a stock foot, Alacritty, kitty or Ghostty window is focused classifies that terminal correctly and types the stored image's absolute path. Hyprland keeps reporting the origin window through hyprctl activewindow while the picker holds keyboard focus. --copy-only still sends no keystroke, and non-image files, other GUI windows and undetectable focus ({}, empty class, failing hyprctl) keep Shift+Insert. The four new tests pass on this head and on a local merge with current quattro, and the terminal case fails against the base script.

The main suggestion is to reuse Omarchy's existing terminal tag instead of a new class list. That tag also covers Omarchy's own agent window.

Terminal detection diverges from the terminal tag and misses org.omarchy.agent

Omarchy already defines what counts as a terminal in default/hypr/apps/terminals.lua, which tags (Alacritty|kitty|com.mitchellh.ghostty|foot|org\.codeberg\.dnkl\.foot|wezterm|org\.omarchy\..*|TUI\..*) as +terminal. default/hypr/bindings/clipboard.lua uses that tag for Super + C / Super + V "so there's one definition of what counts as a terminal". The new terminal_focused uses a separate substring list, and the two disagree:

window class                       terminal tag   this PR
org.omarchy.agent                  yes            Shift+Insert (nothing pasted)
org.omarchy.btop, TUI.float        yes            Shift+Insert
xterm, org.kde.konsole, footclient no             types path
io.gitlab.adhami3310.Footage (GUI) no             types path   ("foot" substring)
foot, Alacritty, kitty,            yes            types path   (both agree)
com.mitchellh.ghostty

The table comes from sandboxed runs of the head script with a stubbed hyprctl that returns each class and its tags.

Impact: omarchy agent (Super + Shift + Ctrl + A) and the scratchpad console launch agents with --app-id=org.omarchy.agent (bin/omarchy-agent). In those windows, picking an image still pastes nothing, although this is the agent-harness case the new manual sentence describes. Non-terminal apps whose class contains term or foot get a typed path instead of the usual Shift+Insert paste.

Suggested change: read the tag from hyprctl activewindow -j. Hyprland reports window-rule tags there with a trailing *:

terminal_focused() {
  hyprctl activewindow -j 2>/dev/null |
    jq -e '(.tags // []) | any(. == "terminal" or . == "terminal*")' >/dev/null 2>&1
}

In the same sandbox this types the path for exactly the tagged classes. The test's hyprctl stub would need to emit tags as well as class. If xterm, Konsole or Tilix should count as terminals, extending the tag in terminals.lua would cover Super + C / Super + V for them too.

The window is classified before the 150 ms delay

terminal_focused runs in the if condition, then sleep 0.15, then wtype.

Impact: after a mouse pick, Hyprland's focus-follows-mouse can move focus to the window under the pointer once the picker closes (the event sequence in #12987 shows this). The check can then see the origin terminal while the path is typed into another window, or the reverse. Keyboard picks are normally not affected (#12987 reports that they paste correctly).

Suggested change: sleep first, then classify the window that will receive the keys. With that order the PR's tests still pass. If #12991 or #13103 (origin-window refocus) lands, the check belongs after that refocus. Both currently conflict textually with this PR in bin/omarchy-clipboard-paste-file.

Additional notes

Suggested change (small): use wtype -- "$path". wtype 0.4 parses any argument starting with - as an option, so a relative path such as -shot.png passed through the CLI types nothing, and 2>/dev/null || true hides the error. Paths from the history picker are absolute, so this only affects direct CLI use. The test's expected wtype arguments change with it.

Documentation: the new manual sentence follows "ready to paste on Super + V", but Super + V never types a path. Only picking an image in the history picker does. The page's own note (line 14) says most agent harnesses use Ctrl + V for pasting images, so "terminals can only receive text" is too broad: the terminal's paste action is text-only, while programs inside it can read images from the clipboard. The script comment makes the same claim. A possible rewording: "Picking an image in clipboard history while a terminal is focused types its file path instead, since the terminal's own paste only handles text." Mentioning Shift + Return (copy only, no typed path) would help harness users who prefer Ctrl + V.

Optional test improvement: foot is the only positive terminal case, so a predicate of [[ $class == foot ]] passes all four new assertions (confirmed with a mutated script in the sandbox). Cases for org.omarchy.agent and a GUI class containing foot or term would pin the detection above.

Related work: issue #10526 reports this problem and is not referenced. #10536 (send Ctrl+V so image-aware terminal programs read the image), #13070 and #7422 take different approaches to it. #10536's test expects Ctrl+V for the same image paste, so the two cannot both hold as written. The first Verification bullet in the PR description (commandcode, qwenaudio, colibri) appears to belong to #11839.


Review information

Test scope: source review of the head against base quattro and current quattro, plus Hyprland 0.56.2 and wtype 0.4 source. test/shell.d/clipboard-test.sh and targeted variants ran in an isolated sandbox with stubbed hyprctl, wl-copy and wtype. No live desktop test: focus timing after mouse picks comes from source and #12987, and how individual agent harnesses handle a typed path was not tested.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@jandrusk

Copy link
Copy Markdown

Nice idea. Before review, a couple of notes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants