LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Openbox keybinding for keyboard "version" of mouse's middle-click paste

Posted 05-08-2021 at 06:34 PM by the dsc
Updated 08-06-2021 at 09:56 PM by the dsc

I thought it already existed natively, but apparently it does not. Maybe it can be done directly on rc.xml's keybindings themselves, but in order to get it to work it seemed easier as a separate one-liner "script":

Code:
xdotool getactivewindow windowmap windowraise keyup Alt keyup v type --delay 0 "$(xclip -s primary -o) "
For a "left-alt+v" keybinding, to be set on rc.xml, or whatever it's done in other environments/WMs. I'm not sure all the activewindow windomap windowraise is necessary, but it doesn't seem to make it worse. I thought I needed this sort of thing because I was under the impression it was pasting the mid-click clipboard onto the "nothing," like on .xsession-errors or something, rather than on whatever is selected. But possibly the impression was mostly due to the lack of "keyup," which merged the "alt" with the pasting, issuing multiple other keybindings (when they coincided to exist with the clipboard characters).

It also types a space after the paste, which I think is more often how I end up using it, it's just a matter of removing the space between the parentheses and the closing quote, if that's not useful.

Edit/bugfix: the first version of it didn't have "keyup v," but without it, anything pasted containing v, will have it missing, even if you just press it really fast, not holding it at all. I also added "delay 0," so the typing is faster, not instantaneous, but faster.

Edit/major rewrite to something much minor: instead of the whole one-lier with dozens of actions and even two programs, if what you want is the MIDDLE CLICK and you're using xdotool, then only "xdotool click 2" suffices, if that's your middle click. Damn.

Well, it has the disadvantage of being reliant on the mouse cursor placement, though. So maybe not that good. I wonder if I had thought of this solution, stumbled with this issue, and later came up with the "original" as a solution.
Posted in Uncategorized
Views 323 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 02:16 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration