Map Ctrl and Alt to mouse thumb buttons
I'm running Ubuntu 12.04 and have a multi-button Microsoft mouse. I would like to map the Ctrl and Alt modifier keys to the left and right thumb buttons of my mouse, respectively, so I can Ctrl + click and Alt-click without touching the keyboard.
My thumb buttons are buttons 8 and 9.
I tried the solution in How do I configure a mouse thumb button?
which explained how to map a double click to a thumb button - this worked for the double-click but I couldn't figure out how to modify the solution for Ctrl and Alt
I also tried How to map Ctrl/Shift to thumb buttons of Mouse?
which used xdotools and xbindkeys. I modified the script to this:
~/.xbindkeysrc
:
"xdotool keydown alt"
b:9
"xdotool keyup alt"
release + alt + b:9
"xdotool keydown ctrl"
b:8
"xdotool keyup ctrl"
release + control + b:8
Which ALMOST works. It simulates a Ctrl-key press when I click the left thumb button, but I can't actually hold the button and click at the same time - holding the thumb button seems to prevent it from listening to other input until it is released.
Does anyone know how I can make my mouse thumb button actually work as a modifier key, so I can use thumb button + click instead of Ctrl + click?
mouse xbindkeys
add a comment |
I'm running Ubuntu 12.04 and have a multi-button Microsoft mouse. I would like to map the Ctrl and Alt modifier keys to the left and right thumb buttons of my mouse, respectively, so I can Ctrl + click and Alt-click without touching the keyboard.
My thumb buttons are buttons 8 and 9.
I tried the solution in How do I configure a mouse thumb button?
which explained how to map a double click to a thumb button - this worked for the double-click but I couldn't figure out how to modify the solution for Ctrl and Alt
I also tried How to map Ctrl/Shift to thumb buttons of Mouse?
which used xdotools and xbindkeys. I modified the script to this:
~/.xbindkeysrc
:
"xdotool keydown alt"
b:9
"xdotool keyup alt"
release + alt + b:9
"xdotool keydown ctrl"
b:8
"xdotool keyup ctrl"
release + control + b:8
Which ALMOST works. It simulates a Ctrl-key press when I click the left thumb button, but I can't actually hold the button and click at the same time - holding the thumb button seems to prevent it from listening to other input until it is released.
Does anyone know how I can make my mouse thumb button actually work as a modifier key, so I can use thumb button + click instead of Ctrl + click?
mouse xbindkeys
Runxev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.
– Helio
May 23 '15 at 14:34
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42
add a comment |
I'm running Ubuntu 12.04 and have a multi-button Microsoft mouse. I would like to map the Ctrl and Alt modifier keys to the left and right thumb buttons of my mouse, respectively, so I can Ctrl + click and Alt-click without touching the keyboard.
My thumb buttons are buttons 8 and 9.
I tried the solution in How do I configure a mouse thumb button?
which explained how to map a double click to a thumb button - this worked for the double-click but I couldn't figure out how to modify the solution for Ctrl and Alt
I also tried How to map Ctrl/Shift to thumb buttons of Mouse?
which used xdotools and xbindkeys. I modified the script to this:
~/.xbindkeysrc
:
"xdotool keydown alt"
b:9
"xdotool keyup alt"
release + alt + b:9
"xdotool keydown ctrl"
b:8
"xdotool keyup ctrl"
release + control + b:8
Which ALMOST works. It simulates a Ctrl-key press when I click the left thumb button, but I can't actually hold the button and click at the same time - holding the thumb button seems to prevent it from listening to other input until it is released.
Does anyone know how I can make my mouse thumb button actually work as a modifier key, so I can use thumb button + click instead of Ctrl + click?
mouse xbindkeys
I'm running Ubuntu 12.04 and have a multi-button Microsoft mouse. I would like to map the Ctrl and Alt modifier keys to the left and right thumb buttons of my mouse, respectively, so I can Ctrl + click and Alt-click without touching the keyboard.
My thumb buttons are buttons 8 and 9.
I tried the solution in How do I configure a mouse thumb button?
which explained how to map a double click to a thumb button - this worked for the double-click but I couldn't figure out how to modify the solution for Ctrl and Alt
I also tried How to map Ctrl/Shift to thumb buttons of Mouse?
which used xdotools and xbindkeys. I modified the script to this:
~/.xbindkeysrc
:
"xdotool keydown alt"
b:9
"xdotool keyup alt"
release + alt + b:9
"xdotool keydown ctrl"
b:8
"xdotool keyup ctrl"
release + control + b:8
Which ALMOST works. It simulates a Ctrl-key press when I click the left thumb button, but I can't actually hold the button and click at the same time - holding the thumb button seems to prevent it from listening to other input until it is released.
Does anyone know how I can make my mouse thumb button actually work as a modifier key, so I can use thumb button + click instead of Ctrl + click?
mouse xbindkeys
mouse xbindkeys
edited Jun 26 '18 at 20:36
Codito ergo sum
1,5043825
1,5043825
asked Jul 10 '12 at 20:34
rcorrercorre
15114
15114
Runxev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.
– Helio
May 23 '15 at 14:34
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42
add a comment |
Runxev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.
– Helio
May 23 '15 at 14:34
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42
Run
xev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.– Helio
May 23 '15 at 14:34
Run
xev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.– Helio
May 23 '15 at 14:34
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42
add a comment |
2 Answers
2
active
oldest
votes
i found a working solution here. it uses Easystroke (sudo apt install easystroke
). kudos to @stuartr from ubuntuforums!
though there was one issue - re-mapped mouse click sporadically fired an original ('back' in my case) event. to avoid this, mouse button can be remapped to some unused number with xinput set-button-map
(sudo apt install xinput
).
to re-map on every login i've created (exacutable) $HOME/.config/autostart/mouse-buttons.sh
with this content:
$ cat .config/autostart/mouse-buttons.sh
#!/usr/bin/env bash
mi_mouse_id=$(xinput | grep 'GTech MI wireless mouse.*pointer' | sed 's/.*tid=([0-9]*)t.*/1/')
xinput set-button-map $mi_mouse_id 1 2 3 4 5 6 7 20 9 10 11 12 13 14 15 16 17 18 19 20
$
this maps mouse button 8 to button 20. hopefully button 20 has no meaning. at least it has absolutely no effect for me.
now it's time to re-map button 20 to Ctrl:
- Preferences tab: additional buttons -> add -> radio button 'Instant Gestures' -> click the mouse button of choice in the grey area (for me a 'back, thumb button' became '(Instantly) Button 20')
- Preferences tab: Select 'Autostart Easystroke'
- Actions tab: Add Action
Name: anything you like (e.g. 'Mouse 20 -> Ctrl')
Type: 'Ignore'
Details: click it once to change 'Ignore' to 'Key combination...'. then press Ctrl + a. 'a' doesn't matter and is ignored. 'Key Combination' will be replaced with 'Ctr' - With the new action selected/highlighted -> click 'Record Stroke' -> press the mouse button you're wanting to use again (this came up with '20 -> 20' in the Stroke column for me)
- Now pressing and holding my mouse button brings up a dinky 'Ctr' on the screen and acts like the button is being held for as long as the mouse button is
add a comment |
Instead of using xdotool, if you prefer a functional GUI-based solution, you can download the Easystrokes app from the Ubuntu software center. You can easily map keyboard keys and shortcuts to mouse buttons and even mouse gestures.
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
add a comment |
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f162141%2fmap-ctrl-and-alt-to-mouse-thumb-buttons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
i found a working solution here. it uses Easystroke (sudo apt install easystroke
). kudos to @stuartr from ubuntuforums!
though there was one issue - re-mapped mouse click sporadically fired an original ('back' in my case) event. to avoid this, mouse button can be remapped to some unused number with xinput set-button-map
(sudo apt install xinput
).
to re-map on every login i've created (exacutable) $HOME/.config/autostart/mouse-buttons.sh
with this content:
$ cat .config/autostart/mouse-buttons.sh
#!/usr/bin/env bash
mi_mouse_id=$(xinput | grep 'GTech MI wireless mouse.*pointer' | sed 's/.*tid=([0-9]*)t.*/1/')
xinput set-button-map $mi_mouse_id 1 2 3 4 5 6 7 20 9 10 11 12 13 14 15 16 17 18 19 20
$
this maps mouse button 8 to button 20. hopefully button 20 has no meaning. at least it has absolutely no effect for me.
now it's time to re-map button 20 to Ctrl:
- Preferences tab: additional buttons -> add -> radio button 'Instant Gestures' -> click the mouse button of choice in the grey area (for me a 'back, thumb button' became '(Instantly) Button 20')
- Preferences tab: Select 'Autostart Easystroke'
- Actions tab: Add Action
Name: anything you like (e.g. 'Mouse 20 -> Ctrl')
Type: 'Ignore'
Details: click it once to change 'Ignore' to 'Key combination...'. then press Ctrl + a. 'a' doesn't matter and is ignored. 'Key Combination' will be replaced with 'Ctr' - With the new action selected/highlighted -> click 'Record Stroke' -> press the mouse button you're wanting to use again (this came up with '20 -> 20' in the Stroke column for me)
- Now pressing and holding my mouse button brings up a dinky 'Ctr' on the screen and acts like the button is being held for as long as the mouse button is
add a comment |
i found a working solution here. it uses Easystroke (sudo apt install easystroke
). kudos to @stuartr from ubuntuforums!
though there was one issue - re-mapped mouse click sporadically fired an original ('back' in my case) event. to avoid this, mouse button can be remapped to some unused number with xinput set-button-map
(sudo apt install xinput
).
to re-map on every login i've created (exacutable) $HOME/.config/autostart/mouse-buttons.sh
with this content:
$ cat .config/autostart/mouse-buttons.sh
#!/usr/bin/env bash
mi_mouse_id=$(xinput | grep 'GTech MI wireless mouse.*pointer' | sed 's/.*tid=([0-9]*)t.*/1/')
xinput set-button-map $mi_mouse_id 1 2 3 4 5 6 7 20 9 10 11 12 13 14 15 16 17 18 19 20
$
this maps mouse button 8 to button 20. hopefully button 20 has no meaning. at least it has absolutely no effect for me.
now it's time to re-map button 20 to Ctrl:
- Preferences tab: additional buttons -> add -> radio button 'Instant Gestures' -> click the mouse button of choice in the grey area (for me a 'back, thumb button' became '(Instantly) Button 20')
- Preferences tab: Select 'Autostart Easystroke'
- Actions tab: Add Action
Name: anything you like (e.g. 'Mouse 20 -> Ctrl')
Type: 'Ignore'
Details: click it once to change 'Ignore' to 'Key combination...'. then press Ctrl + a. 'a' doesn't matter and is ignored. 'Key Combination' will be replaced with 'Ctr' - With the new action selected/highlighted -> click 'Record Stroke' -> press the mouse button you're wanting to use again (this came up with '20 -> 20' in the Stroke column for me)
- Now pressing and holding my mouse button brings up a dinky 'Ctr' on the screen and acts like the button is being held for as long as the mouse button is
add a comment |
i found a working solution here. it uses Easystroke (sudo apt install easystroke
). kudos to @stuartr from ubuntuforums!
though there was one issue - re-mapped mouse click sporadically fired an original ('back' in my case) event. to avoid this, mouse button can be remapped to some unused number with xinput set-button-map
(sudo apt install xinput
).
to re-map on every login i've created (exacutable) $HOME/.config/autostart/mouse-buttons.sh
with this content:
$ cat .config/autostart/mouse-buttons.sh
#!/usr/bin/env bash
mi_mouse_id=$(xinput | grep 'GTech MI wireless mouse.*pointer' | sed 's/.*tid=([0-9]*)t.*/1/')
xinput set-button-map $mi_mouse_id 1 2 3 4 5 6 7 20 9 10 11 12 13 14 15 16 17 18 19 20
$
this maps mouse button 8 to button 20. hopefully button 20 has no meaning. at least it has absolutely no effect for me.
now it's time to re-map button 20 to Ctrl:
- Preferences tab: additional buttons -> add -> radio button 'Instant Gestures' -> click the mouse button of choice in the grey area (for me a 'back, thumb button' became '(Instantly) Button 20')
- Preferences tab: Select 'Autostart Easystroke'
- Actions tab: Add Action
Name: anything you like (e.g. 'Mouse 20 -> Ctrl')
Type: 'Ignore'
Details: click it once to change 'Ignore' to 'Key combination...'. then press Ctrl + a. 'a' doesn't matter and is ignored. 'Key Combination' will be replaced with 'Ctr' - With the new action selected/highlighted -> click 'Record Stroke' -> press the mouse button you're wanting to use again (this came up with '20 -> 20' in the Stroke column for me)
- Now pressing and holding my mouse button brings up a dinky 'Ctr' on the screen and acts like the button is being held for as long as the mouse button is
i found a working solution here. it uses Easystroke (sudo apt install easystroke
). kudos to @stuartr from ubuntuforums!
though there was one issue - re-mapped mouse click sporadically fired an original ('back' in my case) event. to avoid this, mouse button can be remapped to some unused number with xinput set-button-map
(sudo apt install xinput
).
to re-map on every login i've created (exacutable) $HOME/.config/autostart/mouse-buttons.sh
with this content:
$ cat .config/autostart/mouse-buttons.sh
#!/usr/bin/env bash
mi_mouse_id=$(xinput | grep 'GTech MI wireless mouse.*pointer' | sed 's/.*tid=([0-9]*)t.*/1/')
xinput set-button-map $mi_mouse_id 1 2 3 4 5 6 7 20 9 10 11 12 13 14 15 16 17 18 19 20
$
this maps mouse button 8 to button 20. hopefully button 20 has no meaning. at least it has absolutely no effect for me.
now it's time to re-map button 20 to Ctrl:
- Preferences tab: additional buttons -> add -> radio button 'Instant Gestures' -> click the mouse button of choice in the grey area (for me a 'back, thumb button' became '(Instantly) Button 20')
- Preferences tab: Select 'Autostart Easystroke'
- Actions tab: Add Action
Name: anything you like (e.g. 'Mouse 20 -> Ctrl')
Type: 'Ignore'
Details: click it once to change 'Ignore' to 'Key combination...'. then press Ctrl + a. 'a' doesn't matter and is ignored. 'Key Combination' will be replaced with 'Ctr' - With the new action selected/highlighted -> click 'Record Stroke' -> press the mouse button you're wanting to use again (this came up with '20 -> 20' in the Stroke column for me)
- Now pressing and holding my mouse button brings up a dinky 'Ctr' on the screen and acts like the button is being held for as long as the mouse button is
edited Mar 13 '18 at 18:48
answered Feb 28 '18 at 12:38
attiatti
1393
1393
add a comment |
add a comment |
Instead of using xdotool, if you prefer a functional GUI-based solution, you can download the Easystrokes app from the Ubuntu software center. You can easily map keyboard keys and shortcuts to mouse buttons and even mouse gestures.
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
add a comment |
Instead of using xdotool, if you prefer a functional GUI-based solution, you can download the Easystrokes app from the Ubuntu software center. You can easily map keyboard keys and shortcuts to mouse buttons and even mouse gestures.
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
add a comment |
Instead of using xdotool, if you prefer a functional GUI-based solution, you can download the Easystrokes app from the Ubuntu software center. You can easily map keyboard keys and shortcuts to mouse buttons and even mouse gestures.
Instead of using xdotool, if you prefer a functional GUI-based solution, you can download the Easystrokes app from the Ubuntu software center. You can easily map keyboard keys and shortcuts to mouse buttons and even mouse gestures.
answered Jul 13 '12 at 15:13
user76179user76179
291
291
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
add a comment |
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
5
5
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
I tried Easystrokes, but as far as I can tell, it won't allow me to map modifier keys to mouse buttons either. It will allow me to map a modifier+key combination, like SHIFT+A, but it won't let me map a modifier alone to a mouse button. I want holding down my mouse thumb button to have the same function as holding down the CTRL button.
– rcorre
Jul 13 '12 at 18:22
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f162141%2fmap-ctrl-and-alt-to-mouse-thumb-buttons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Run
xev | grep button|Button
, then, press the "Ctrl" tumb button over the white window, without releasing it, do a click, then release it and post the output.– Helio
May 23 '15 at 14:34
@Helio see my newly created question: askubuntu.com/questions/627555/…
– conceptdeluxe
May 24 '15 at 3:42