obsidian-terminal
obsidian-terminal copied to clipboard
[Bug/Feature Request] Middle-click paste (Primary Selection) not working in focused terminal on Linux
Problem Description:
In Linux environments, Obsidian (and most of its plugins) supports pasting selected text using a middle-click of the mouse (the "Primary Selection" feature). However, within the "Terminal" plugin, when the terminal is focused, this paste functionality does not work.
The expected behavior is that a middle-click would paste the text that has been previously selected (and automatically copied to the system's Primary Selection buffer). Currently, no action occurs, or the click is not recognized as a paste command.
Current Behavior:
When the "Terminal" plugin is focused, middle-clicking does not paste the primary selection from the Linux clipboard. Pasting requires using Ctrl+Shift+V, which works correctly.
Expected Behavior:
I would appreciate it if the "Terminal" plugin could support middle-click paste (Primary Selection) when focused, to maintain consistency with the behavior of native Linux terminals and the rest of the Obsidian application.
Additional Notes:
I understand that, according to the plugin's documentation, most Obsidian keyboard shortcuts are disabled when the terminal is focused to better emulate a native terminal. However, middle-click paste is a core feature of terminals in Linux, and its absence affects workflow fluidity.
Pasting via Ctrl+Shift+V works as expected.
This middle-click paste functionality does work in other areas of Obsidian and in other plugins.
It seems like xterm.js should support middle click on Linux automatically? Could you check if navigator.platform (in the developer console) contains Linux?
https://github.com/Tyriar/xterm.js/blob/877b37d3cc4be2382a7fc5bd662cd3f57a86c536/src/browser/CoreBrowserTerminal.ts#L363-L371
If it really does not work, I think I could manually implement it (and add an option to toggle it).
You remind me that VSCode has right-click to copy and paste, which I will also add later (as an option):
https://github.com/xtermjs/xterm.js/issues/2478#issuecomment-703180139