Using CapsLock as left mouse button; mostly works but fails with a few things

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
Linux System Info:
OS: GNU/Linux x86_64
Kernel: 3.13.0-24-generic
Distro: Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16
[Based On: Ubuntu 14.04.5 LTS, Trusty Tahr]
Due to a disability (spinal injury) which includes finger impairment, I have made some alterations so that I can use my keyboard's CapsLock key as my left mouse button. NumLock is remapped to function as CapsLock.
Almost everything works fine when using CapsLock as a left-click and left-double-click but a few things, listed below, do not. Can anyone please suggest changes that I can make, or an alternative approach, so that I can get CapsLock fully working as a left-click.
The following things all FAIL when using CapsLock key as a left-click, everything else that you can use a left-click with works fine and I've tried everything I can think of.
- Drag controls to move or resize windows do not work (nothing happens when attempted). Dragging within applications works fine though, e.g. scroll bars, re-sizeable elements, selecting and moving text, desktop icons, moving files in a file manager, etc.
- Window menus can be activated with 2 clicks, but then the menu items do nothing when clicked on, and the escape key must be pressed, or a REAL left-button click performed, to close the menu.
- System menus (top left in all windows) do not respond at all when clicked on.
- Left-clicking in context menus works in some applications but not in others.
- Cinnamon's drop-down panel controls partially fail, e.g. menu, volume, network, drives, date/time, will open with the 1st click, but do not then respond at all until clicked on again with a REAL mouse left-button click which closes them (pressing the escape key fails to close them even though it normally does).
The system changes I made were:
1) The following lines were added to ~/.xbindkeysrc to send mouse left-click press and release events when CapsLock is pressed and released.
# c:66 is Caps_Lock and in the xdotool commands the 1 specifies the left button.
"xdotool mousedown 1"
c:66
"xdotool mouseup 1"
Release+c:66
2) CapsLock functionality was turned off with the setxkbmap -option caps:none command (added to ~/.profile). CapsLock no longer functions as a modifier key and its keyboard indicator light is not toggled when pressed.
3) NumLock key re-mapped as CapsLock, so that NumLock acts exactly as CapsLock used to.
Edited the /usr/share/X11/xkb/symbols/pc file:
Replaced this line: key <NMLK> [ Num_Lock ] ;
With this line: key <NMLK> [ Caps_Lock ] ;
Deleted the cached keymap files, *.xkm, in /var/lib/xkb/ (system reboot needed to load the new keymaps).
EDIT @ 2018-03-01 13:27:
I installed the Python PyAutoGUI package and wrote 2 Python programs, one to call pyautogui.mouseDown() and the other to call pyautogui.mouseUp() and modified ~/.xbindkeysrc to run the 2 Python programs instead of the xdotool commands. The same problems persist, i.e. most left clicks are fine but dragging to move/resize windows and menus fail.
Since both xdotool and PyAutoGUI use Xlib I suspect that a solution that bypasses Xlib altogether is needed. Is there some lower-level way to initiate mouse button down/up events?
EDIT @ 2018-03-06 15:57:
Since my hypothesis was that Xlib was the problem, I tried bypassing it altogether by writing some code to write directly to the mouse input device, specifically /dev/input/event5. I've uploaded the C code to a GitHub gist. The code posted by thundertrick in this post on StackoOverflow was helpful to me.
I then created /etc/udev/rules.d/80-input.rules - the one liner below - to allow non-sudo writing of mouse events...
KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"
...then created the input group and added myself to the group.
sudo groupadd -f input
sudo gpasswd -a MY_USER_NAME input
...then altered my ~/.xbindkeysrc file to call my compiled write-mouse-events program.
The result was the exact same problem - using CapsLock as a left mouse button works fine but dragging to move/resize windows and menus fail.
devices cinnamon xbindkeys
add a comment |Â
up vote
5
down vote
favorite
Linux System Info:
OS: GNU/Linux x86_64
Kernel: 3.13.0-24-generic
Distro: Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16
[Based On: Ubuntu 14.04.5 LTS, Trusty Tahr]
Due to a disability (spinal injury) which includes finger impairment, I have made some alterations so that I can use my keyboard's CapsLock key as my left mouse button. NumLock is remapped to function as CapsLock.
Almost everything works fine when using CapsLock as a left-click and left-double-click but a few things, listed below, do not. Can anyone please suggest changes that I can make, or an alternative approach, so that I can get CapsLock fully working as a left-click.
The following things all FAIL when using CapsLock key as a left-click, everything else that you can use a left-click with works fine and I've tried everything I can think of.
- Drag controls to move or resize windows do not work (nothing happens when attempted). Dragging within applications works fine though, e.g. scroll bars, re-sizeable elements, selecting and moving text, desktop icons, moving files in a file manager, etc.
- Window menus can be activated with 2 clicks, but then the menu items do nothing when clicked on, and the escape key must be pressed, or a REAL left-button click performed, to close the menu.
- System menus (top left in all windows) do not respond at all when clicked on.
- Left-clicking in context menus works in some applications but not in others.
- Cinnamon's drop-down panel controls partially fail, e.g. menu, volume, network, drives, date/time, will open with the 1st click, but do not then respond at all until clicked on again with a REAL mouse left-button click which closes them (pressing the escape key fails to close them even though it normally does).
The system changes I made were:
1) The following lines were added to ~/.xbindkeysrc to send mouse left-click press and release events when CapsLock is pressed and released.
# c:66 is Caps_Lock and in the xdotool commands the 1 specifies the left button.
"xdotool mousedown 1"
c:66
"xdotool mouseup 1"
Release+c:66
2) CapsLock functionality was turned off with the setxkbmap -option caps:none command (added to ~/.profile). CapsLock no longer functions as a modifier key and its keyboard indicator light is not toggled when pressed.
3) NumLock key re-mapped as CapsLock, so that NumLock acts exactly as CapsLock used to.
Edited the /usr/share/X11/xkb/symbols/pc file:
Replaced this line: key <NMLK> [ Num_Lock ] ;
With this line: key <NMLK> [ Caps_Lock ] ;
Deleted the cached keymap files, *.xkm, in /var/lib/xkb/ (system reboot needed to load the new keymaps).
EDIT @ 2018-03-01 13:27:
I installed the Python PyAutoGUI package and wrote 2 Python programs, one to call pyautogui.mouseDown() and the other to call pyautogui.mouseUp() and modified ~/.xbindkeysrc to run the 2 Python programs instead of the xdotool commands. The same problems persist, i.e. most left clicks are fine but dragging to move/resize windows and menus fail.
Since both xdotool and PyAutoGUI use Xlib I suspect that a solution that bypasses Xlib altogether is needed. Is there some lower-level way to initiate mouse button down/up events?
EDIT @ 2018-03-06 15:57:
Since my hypothesis was that Xlib was the problem, I tried bypassing it altogether by writing some code to write directly to the mouse input device, specifically /dev/input/event5. I've uploaded the C code to a GitHub gist. The code posted by thundertrick in this post on StackoOverflow was helpful to me.
I then created /etc/udev/rules.d/80-input.rules - the one liner below - to allow non-sudo writing of mouse events...
KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"
...then created the input group and added myself to the group.
sudo groupadd -f input
sudo gpasswd -a MY_USER_NAME input
...then altered my ~/.xbindkeysrc file to call my compiled write-mouse-events program.
The result was the exact same problem - using CapsLock as a left mouse button works fine but dragging to move/resize windows and menus fail.
devices cinnamon xbindkeys
1
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at/usr/share/X11/xkb/compat/mousekeys. You'd bind<CAPS>toLockPointerButton(button=default). I don't know if you can bind the release action that way.
â Gilles
Mar 3 at 16:06
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
Linux System Info:
OS: GNU/Linux x86_64
Kernel: 3.13.0-24-generic
Distro: Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16
[Based On: Ubuntu 14.04.5 LTS, Trusty Tahr]
Due to a disability (spinal injury) which includes finger impairment, I have made some alterations so that I can use my keyboard's CapsLock key as my left mouse button. NumLock is remapped to function as CapsLock.
Almost everything works fine when using CapsLock as a left-click and left-double-click but a few things, listed below, do not. Can anyone please suggest changes that I can make, or an alternative approach, so that I can get CapsLock fully working as a left-click.
The following things all FAIL when using CapsLock key as a left-click, everything else that you can use a left-click with works fine and I've tried everything I can think of.
- Drag controls to move or resize windows do not work (nothing happens when attempted). Dragging within applications works fine though, e.g. scroll bars, re-sizeable elements, selecting and moving text, desktop icons, moving files in a file manager, etc.
- Window menus can be activated with 2 clicks, but then the menu items do nothing when clicked on, and the escape key must be pressed, or a REAL left-button click performed, to close the menu.
- System menus (top left in all windows) do not respond at all when clicked on.
- Left-clicking in context menus works in some applications but not in others.
- Cinnamon's drop-down panel controls partially fail, e.g. menu, volume, network, drives, date/time, will open with the 1st click, but do not then respond at all until clicked on again with a REAL mouse left-button click which closes them (pressing the escape key fails to close them even though it normally does).
The system changes I made were:
1) The following lines were added to ~/.xbindkeysrc to send mouse left-click press and release events when CapsLock is pressed and released.
# c:66 is Caps_Lock and in the xdotool commands the 1 specifies the left button.
"xdotool mousedown 1"
c:66
"xdotool mouseup 1"
Release+c:66
2) CapsLock functionality was turned off with the setxkbmap -option caps:none command (added to ~/.profile). CapsLock no longer functions as a modifier key and its keyboard indicator light is not toggled when pressed.
3) NumLock key re-mapped as CapsLock, so that NumLock acts exactly as CapsLock used to.
Edited the /usr/share/X11/xkb/symbols/pc file:
Replaced this line: key <NMLK> [ Num_Lock ] ;
With this line: key <NMLK> [ Caps_Lock ] ;
Deleted the cached keymap files, *.xkm, in /var/lib/xkb/ (system reboot needed to load the new keymaps).
EDIT @ 2018-03-01 13:27:
I installed the Python PyAutoGUI package and wrote 2 Python programs, one to call pyautogui.mouseDown() and the other to call pyautogui.mouseUp() and modified ~/.xbindkeysrc to run the 2 Python programs instead of the xdotool commands. The same problems persist, i.e. most left clicks are fine but dragging to move/resize windows and menus fail.
Since both xdotool and PyAutoGUI use Xlib I suspect that a solution that bypasses Xlib altogether is needed. Is there some lower-level way to initiate mouse button down/up events?
EDIT @ 2018-03-06 15:57:
Since my hypothesis was that Xlib was the problem, I tried bypassing it altogether by writing some code to write directly to the mouse input device, specifically /dev/input/event5. I've uploaded the C code to a GitHub gist. The code posted by thundertrick in this post on StackoOverflow was helpful to me.
I then created /etc/udev/rules.d/80-input.rules - the one liner below - to allow non-sudo writing of mouse events...
KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"
...then created the input group and added myself to the group.
sudo groupadd -f input
sudo gpasswd -a MY_USER_NAME input
...then altered my ~/.xbindkeysrc file to call my compiled write-mouse-events program.
The result was the exact same problem - using CapsLock as a left mouse button works fine but dragging to move/resize windows and menus fail.
devices cinnamon xbindkeys
Linux System Info:
OS: GNU/Linux x86_64
Kernel: 3.13.0-24-generic
Distro: Linux Mint 17 Qiana, Cinnamon 64-bit 2.2.16
[Based On: Ubuntu 14.04.5 LTS, Trusty Tahr]
Due to a disability (spinal injury) which includes finger impairment, I have made some alterations so that I can use my keyboard's CapsLock key as my left mouse button. NumLock is remapped to function as CapsLock.
Almost everything works fine when using CapsLock as a left-click and left-double-click but a few things, listed below, do not. Can anyone please suggest changes that I can make, or an alternative approach, so that I can get CapsLock fully working as a left-click.
The following things all FAIL when using CapsLock key as a left-click, everything else that you can use a left-click with works fine and I've tried everything I can think of.
- Drag controls to move or resize windows do not work (nothing happens when attempted). Dragging within applications works fine though, e.g. scroll bars, re-sizeable elements, selecting and moving text, desktop icons, moving files in a file manager, etc.
- Window menus can be activated with 2 clicks, but then the menu items do nothing when clicked on, and the escape key must be pressed, or a REAL left-button click performed, to close the menu.
- System menus (top left in all windows) do not respond at all when clicked on.
- Left-clicking in context menus works in some applications but not in others.
- Cinnamon's drop-down panel controls partially fail, e.g. menu, volume, network, drives, date/time, will open with the 1st click, but do not then respond at all until clicked on again with a REAL mouse left-button click which closes them (pressing the escape key fails to close them even though it normally does).
The system changes I made were:
1) The following lines were added to ~/.xbindkeysrc to send mouse left-click press and release events when CapsLock is pressed and released.
# c:66 is Caps_Lock and in the xdotool commands the 1 specifies the left button.
"xdotool mousedown 1"
c:66
"xdotool mouseup 1"
Release+c:66
2) CapsLock functionality was turned off with the setxkbmap -option caps:none command (added to ~/.profile). CapsLock no longer functions as a modifier key and its keyboard indicator light is not toggled when pressed.
3) NumLock key re-mapped as CapsLock, so that NumLock acts exactly as CapsLock used to.
Edited the /usr/share/X11/xkb/symbols/pc file:
Replaced this line: key <NMLK> [ Num_Lock ] ;
With this line: key <NMLK> [ Caps_Lock ] ;
Deleted the cached keymap files, *.xkm, in /var/lib/xkb/ (system reboot needed to load the new keymaps).
EDIT @ 2018-03-01 13:27:
I installed the Python PyAutoGUI package and wrote 2 Python programs, one to call pyautogui.mouseDown() and the other to call pyautogui.mouseUp() and modified ~/.xbindkeysrc to run the 2 Python programs instead of the xdotool commands. The same problems persist, i.e. most left clicks are fine but dragging to move/resize windows and menus fail.
Since both xdotool and PyAutoGUI use Xlib I suspect that a solution that bypasses Xlib altogether is needed. Is there some lower-level way to initiate mouse button down/up events?
EDIT @ 2018-03-06 15:57:
Since my hypothesis was that Xlib was the problem, I tried bypassing it altogether by writing some code to write directly to the mouse input device, specifically /dev/input/event5. I've uploaded the C code to a GitHub gist. The code posted by thundertrick in this post on StackoOverflow was helpful to me.
I then created /etc/udev/rules.d/80-input.rules - the one liner below - to allow non-sudo writing of mouse events...
KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"
...then created the input group and added myself to the group.
sudo groupadd -f input
sudo gpasswd -a MY_USER_NAME input
...then altered my ~/.xbindkeysrc file to call my compiled write-mouse-events program.
The result was the exact same problem - using CapsLock as a left mouse button works fine but dragging to move/resize windows and menus fail.
devices cinnamon xbindkeys
edited Mar 9 at 9:22
asked Feb 27 at 18:38
mattst
245110
245110
1
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at/usr/share/X11/xkb/compat/mousekeys. You'd bind<CAPS>toLockPointerButton(button=default). I don't know if you can bind the release action that way.
â Gilles
Mar 3 at 16:06
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46
add a comment |Â
1
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at/usr/share/X11/xkb/compat/mousekeys. You'd bind<CAPS>toLockPointerButton(button=default). I don't know if you can bind the release action that way.
â Gilles
Mar 3 at 16:06
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46
1
1
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at
/usr/share/X11/xkb/compat/mousekeys. You'd bind <CAPS> to LockPointerButton(button=default). I don't know if you can bind the release action that way.â Gilles
Mar 3 at 16:06
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at
/usr/share/X11/xkb/compat/mousekeys. You'd bind <CAPS> to LockPointerButton(button=default). I don't know if you can bind the release action that way.â Gilles
Mar 3 at 16:06
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426996%2fusing-capslock-as-left-mouse-button-mostly-works-but-fails-with-a-few-things%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
XKB's mousekeys features might help, but I'm not sure if they can do what you need. I don't know exactly how that works, look at
/usr/share/X11/xkb/compat/mousekeys. You'd bind<CAPS>toLockPointerButton(button=default). I don't know if you can bind the release action that way.â Gilles
Mar 3 at 16:06
Thanks. I've explored using MouseKeys but don't think it can be used to allow CapsLock to function as a left mouse button replacement, with a press of CapsLock being left-button down and a release of CapsLock being left-button up.
â mattst
Mar 6 at 15:46