You are not logged in.

#1 2023-11-23 14:17:45

ihitmani
Member
Registered: 2021-05-03
Posts: 83

mouse wheel click

Hi, a long time ago I modified mouse wheel to make it work like "Ctrl+v"(paste), now I want to change it, but I forgot how, need help to find place where I changed it. Thanks.

Places that I checked:  /etc/X11/xorg.conf.d, .xbindkeysrc,.xinitrc

Last edited by ihitmani (2023-11-23 14:20:33)

Offline

#2 2023-11-23 14:23:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,232

Re: mouse wheel click

That's already the default behaviour on linux in many cases. Unless the button is literally unusable in other "normal" contexts (e.g. try opening a new tab by middle clicking a link in a browser) then chances are you just see the default.

Offline

#3 2023-11-23 14:33:46

ihitmani
Member
Registered: 2021-05-03
Posts: 83

Re: mouse wheel click

hmm, thats interesting, I remember that I change that, anyway thanks. I have logitech mouse that has left/right wheel clicks. Now I want to to override left/right to make it work like copy/paste, I tried  xbindkey, unfortunately when I manually press Ctrl+c/v it does not work(since xbindkey overrides ctrl+c/v ), because xte is not installed, are there any other methods to change that ? I still need manual ctrl+c,v functions

Last edited by ihitmani (2023-11-23 14:35:06)

Offline

#4 2023-11-23 15:13:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: mouse wheel click

Why does xbindkey override ctrl+c/v?  It would seem you want to make mouse buttons 6 and 7 generate ctrl+c and ctrl+v respectively.  This wouldn't have any effect on actually pressing ctrl+c or ctrl+v.  In reality though, you really shouldn't even do this.  Just bind buttons 6 and 7 directly to your end goal (i.e., xsel or xclip commands).

What did you actually put in your xbindkeys config?

Also note that button 2 does not simulate a Ctrl-V, but rather most software interprets button 2 to mean "paste" which coincidentally may also be what "Ctrl+V" means to that program.  Though in most cases they'd actually be slightly different as Ctrl-V most often pastes from the CLIPBOARD selection while button 2 pastes from the PRIMARY selection (admittedly there are a good number of annoying programs that mix these up).

Last edited by Trilby (2023-11-23 15:17:18)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2023-11-23 15:56:46

ihitmani
Member
Registered: 2021-05-03
Posts: 83

Re: mouse wheel click

Trilby wrote:

Why does xbindkey override ctrl+c/v?  It would seem you want to make mouse buttons 6 and 7 generate ctrl+c and ctrl+v respectively.  This wouldn't have any effect on actually pressing ctrl+c or ctrl+v.  In reality though, you really shouldn't even do this.  Just bind buttons 6 and 7 directly to your end goal (i.e., xsel or xclip commands).

What did you actually put in your xbindkeys config?

Also note that button 2 does not simulate a Ctrl-V, but rather most software interprets button 2 to mean "paste" which coincidentally may also be what "Ctrl+V" means to that program.  Though in most cases they'd actually be slightly different as Ctrl-V most often pastes from the CLIPBOARD selection while button 2 pastes from the PRIMARY selection (admittedly there are a good number of annoying programs that mix these up).

U re right, I want to do copy/paste from clipboard, mostly text data. Probably you are right, I need something different from .xbindkeysrc
Here it is .xbindkeysrc that I used :

"xte 'mouseclick 6'"
  control+c
"xte 'mouseclick 7'"
  control+v

UPD: this does not work

"xclip -selection clipboard"
  b:6
"xclip -selection clipboard -o"
  b:7

nor this when I try to click on left/right in browser:

"xsel --clipboard --input"
  b:6
#"xclip -o"
"xsel --clipboard --output"
  b:7

It actually copies, but does not paste

Last edited by ihitmani (2023-11-23 17:08:26)

Offline

#6 2023-11-23 17:35:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: mouse wheel click

The first xbindkeysrc is backwards, as I suspected: that (tries to) generate button events when Ctrl+C/V are pressed - and that's precisely why those two key combinations stopped doing what you'd expect them to.

The others using xsel look valid, but I neglected one point: the reason pasting fails is that xsel just sends the data to the stdout.  You'd need to pipe this to something that generates the relevant key events.  I don't know if xbindkeys includes such an option (to "playback" content from a selection).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2023-11-23 17:37:23

ihitmani
Member
Registered: 2021-05-03
Posts: 83

Re: mouse wheel click

.xbindkeysrc this one works:

"xclip -selection primary"
  b:6
"xdotool type --clearmodifiers --delay 0 -- ""$(xclip -o)"""
  b:7

I have another problem by default, it miss spaces

Why is it so hard to make it working? I had similar solution with logitech utility in windows and everything worked out of box

Last edited by ihitmani (2023-11-23 17:45:47)

Offline

#8 2023-11-23 17:49:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,462
Website

Re: mouse wheel click

I suspect missing spaces is a quoting issue.  Getting the syntax correct when you are passing shell commands to shell commands to something that parses input to make shell commands.

Something like* the following should do:

"xdotool type --clearmodifiers --delay 0 -- \"$(xclip -o)\""
  b:7

*I say "something like" as I find getting quoting correct in such circumstances to be mostly guess-and-check.  This is one reason I've never really used xbinkeys (the tool works great, but the syntax is problematic for non-trivial bindings).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2023-11-23 17:54:04

ihitmani
Member
Registered: 2021-05-03
Posts: 83

Re: mouse wheel click

Trilby wrote:

I suspect missing spaces is a quoting issue.  Getting the syntax correct when you are passing shell commands to shell commands to something that parses input to make shell commands.

Something like* the following should do:

"xdotool type --clearmodifiers --delay 0 -- \"$(xclip -o)\""
  b:7

*I say "something like" as I find getting quoting correct in such circumstances to be mostly guess-and-check.  This is one reason I've never really used xbinkeys (the tool works great, but the syntax is problematic for non-trivial bindings).

just tried, nope it is not the case, also '\n' symbols are missing. So what other tool would you offer ?
upd:


"xdotool key --clearmodifiers ctrl+c"
  b:6

"xdotool key --clearmodifiers ctrl+v"
  b:7
looks like it working

Last edited by ihitmani (2023-11-23 18:12:20)

Offline

Board footer

Powered by FluxBB