Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2913  / 2 Years ago, thu, may 26, 2022, 7:53:42

I have a logitech MX400 wireless. It has a search button I would like to use for pasting (instead of the extremely sensitive but hard to press scroll wheel). I already remapped other buttons with xbindkeys, and used xev to find the button press code, but this does not work for the search button. using xev and clicking the search button I get the following events



FocusOut event, serial 34, synthetic NO, window 0x3c00001,
mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 34, synthetic NO, window 0x3c00001,
mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 34, synthetic NO, window 0x0,
keys: 4294967275 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

PropertyNotify event, serial 34, synthetic NO, window 0x3c00001,
atom 0x1d7 (_NET_WM_ICON_GEOMETRY), time 23653064, state PropertyNewValue


No ButtonPress events. It seems that the search button is intercepted at a level below the X events. Any ideas? I have ubuntu 12.04. Ubuntu actually sees the click and spawns a search dialog, but there's no trace of a click event in the xev.



Edit



I checked the method provided with xmodmap. My .Xmodmap now contains the following line



keycode 225 = XF86Paste NoSymbol XF86Paste``


running xmodmap ~/.Xmodmap now disables the button altogether (or at least, I don't get any result by pressing it). I tried xmodmap -pke and it prints out:



keycode 225 = XF86Paste NoSymbol XF86Paste NoSymbol XF86Paste



Strange enough. All the other entries are similarly formatted. I am close to the solution, but there's still something weird.



Edit 2



I tried to run xinput (never heard of this command. amazing stuff). There are two entries for Logitech. Here is the output of listing each of them (id 9 and 10)



Logitech USB Receiver                       id=9    [slave  pointer  (2)]
Reporting 7 classes:
Class originated from: 9. Type: XIButtonClass
Buttons supported: 24
Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
Button state:
Class originated from: 9. Type: XIValuatorClass
Detail for Valuator 0:
Label: Rel X
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 9. Type: XIValuatorClass
Detail for Valuator 1:
Label: Rel Y
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 9. Type: XIValuatorClass
Detail for Valuator 2:
Label: Rel Horiz Wheel
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 9. Type: XIValuatorClass
Detail for Valuator 3:
Label: Rel Vert Wheel
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 9. Type: XIScrollClass
Scroll info for Valuator 2
type: 2 (horizontal)
increment: 1.000000
flags: 0x0
Class originated from: 9. Type: XIScrollClass
Scroll info for Valuator 3
type: 1 (vertical)
increment: -1.000000
flags: 0x2 ( preferred )


Logitech USB Receiver id=10 [slave pointer (2)]
Reporting 6 classes:
Class originated from: 10. Type: XIButtonClass
Buttons supported: 7
Button labels: "Button 0" "Button Unknown" "Button Unknown" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
Button state:
Class originated from: 10. Type: XIKeyClass
Keycodes supported: 248
Class originated from: 10. Type: XIValuatorClass
Detail for Valuator 0:
Label: Rel X
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 10. Type: XIValuatorClass
Detail for Valuator 1:
Label: Rel Y
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 10. Type: XIValuatorClass
Detail for Valuator 2:
Label: Rel Horiz Wheel
Range: -1.000000 - -1.000000
Resolution: 1 units/m
Mode: relative
Class originated from: 10. Type: XIScrollClass
Scroll info for Valuator 2
type: 2 (horizontal)
increment: 1.000000
flags: 0x0


Testing device 9 does not do anything with the button. Testing device 10 instead works, and this is the output as I click



$ xinput test 10
key press 225
key release 225
key press 225
key release 225
key press 225
key release 225


So it appears that the mouse acts as a keyboard in this regard, but for some reason, xmodmap does not do anything when it receives key 225.



** Edit **



I can confirm that adding keycode 225 = a prints an a every time I click the button. So the problem seems to be related to how XF86Paste is actually handled. I am sending it, but it's not pasting.


More From » mouse

 Answers
5

To simulate keyboard events I suggest you the great tool xdotool Install xdotool.



1. Install xdotool via terminal (CTRL+ALT+T):



sudo apt-get install xdotool


or use the Software Center Install xdotool.



2. Create a script that uses xdotool to emulate the key down events of CTRL and v. In the terminal:



mkdir -p ~/bin  
gedit ~/bin/fakepaste


Copy the following content into the editor window that opened up. After copying the code save, then close it:



#!/bin/sh
exec /usr/bin/xdotool key CTRL+V
EOF


Now make the script executable:



chmod +x ~/bin/fakepaste


3. Log out and log in to reload your PATH.



4. Create the custom shortcut



Go to System Settings, then go to Keyboard, then Shortcuts.



Press the + button at the bottom of the dialog. Provide a name for the shortcut you're about to create and for the command fill in: fakepaste. Press OK.



Next to your new shortcut you will see disabled. Click on that text and then press the key you want to be assigned to your keyboard emulation.



You should now be able to use your search key for pasting!


[#33318] Saturday, May 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
laceanz

Total Points: 86
Total Questions: 113
Total Answers: 104

Location: Australia
Member since Thu, Jan 26, 2023
1 Year ago
;