The i3 FAQ has migrated to https://www.reddit.com/r/i3wm/. All content here is read-only.
Ask Your Question
0

Mouse button press-hold-release through keyboard

asked 2015-10-12 01:20:16 +0000

c0ffeeartc gravatar image

updated 2015-10-13 21:14:30 +0000

My mouse is loud, and I have set these commands

bindsym Mod1+F1 exec xdotool click 1
bindsym Mod1+F2 exec xdotool click 2
bindsym Mod1+F3 exec xdotool click 3

They click fine but don't support drag and drop functionality.

I'm in situation where I want to move real mouse for precise positioning but emulate clicks and drags with notebook keyboard keys.

Is there a way to accomplish this ?

edit retag flag offensive close merge delete

4 answers

Sort by » oldest newest most voted
0

answered 2015-10-13 20:57:44 +0000

c0ffeeartc gravatar image

updated 2015-10-13 21:21:38 +0000

bindsym wasn't enough, so I used xbindkeys for this

# inside ~/.xbindkeysrc
"xdotool mousedown 1"
    Alt + F1
"xdotool mouseup 1"
    Alt + F1 + Release
# same for mouse2 F2 and mouse3 F3

There was F1, F2, F3 hold key repetition problem, luckily xset has option to disable repeat for specific keycodes

xset -r 67
xset -r 68
xset -r 69

Clicks and drags work well now

edit flag offensive delete link more
1

answered 2015-10-13 18:08:17 +0000

Anon1234 gravatar image

updated 2015-10-13 18:12:06 +0000

Run:

setxkbmap -option keypad:pointerkeys

shift+numlock now will activate the numpad mouse mode:

7, 8 ,9 are the up directions
4, 6 are left and right
1, 2, 3 are the down directions 

/ selects the left mouse key
* selects the middle mouse key
- selects the right mouse key 

Press 5 or + do to the actual mouseclick
Press 0/Ins to press and hold the selected mouse key (e.g. for dragging
something)
Press ./Del to release the currently selected mouse key. 

First select the mouse key you want to
(ab)use by pressing / for left mouse
key, - for the right botton or * for
the middle and then press 5 to do the
actual click-

Source

edit flag offensive delete link more

Comments

Thanks for great answer. I use notebook without numpad though. I'm in weird situation where I can and prefer to move real mouse but click with keyboard keys. I'll add this to main question to make things clear

c0ffeeartc gravatar imagec0ffeeartc ( 2015-10-13 20:28:56 +0000 )edit
0

answered 2015-10-24 17:40:55 +0000

nezabudka gravatar image

updated 2015-10-24 17:45:11 +0000

#sudo apt install xdotool
bindsym $mod+Return exec xdotool click 1
bindsym Mod4+F2 exec xdotool click 2
bindsym Mod4+Return exec xdotool click 3
bindsym Mod4+Up exec xdotool click 4    #прокрутка вверх
bindsym Mod4+Down exec xdotool click 5  #прокрутка вниз
bindsym $mod+Up exec xdotool mousemove_relative -- 0 -15
bindsym $mod+Down exec xdotool mousemove_relative 0 15
bindsym $mod+Right exec xdotool mousemove_relative 15 0
bindsym $mod+Left exec xdotool mousemove_relative -- -15 0
edit flag offensive delete link more
0

answered 2015-10-12 08:13:41 +0000

Airblader gravatar image

updated 2015-10-12 08:16:00 +0000

It might be posible like this:

bindsym Mod1+F1 exec --no-startup-id xdotool mousedown 1
bindsym --release Mod1+F1 exec --no-startup-id xdotool mouseup 1

You'll have to try it out.

edit flag offensive delete link more

Comments

Thanks. I tested in blender and then xev. xev says both mousedown and mouseup events fire after key release

c0ffeeartc gravatar imagec0ffeeartc ( 2015-10-13 13:36:34 +0000 )edit

Question Tools

Stats

Asked: 2015-10-12 01:20:16 +0000

Seen: 85 times

Last updated: Oct 24