This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Setting mouse buttons to act as keyboard keys + another

Tags: None
(comma "," separated)
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
I have a Microsoft Laser Mouse 5000 and a Microsoft Natural Ergonomic Keyboard 4000 v 1.0.

It is sort of easy to set up the special keys on my keyboard to do what I want them to do, however setting my mouse buttons seems to require some tricks I have no found yet. On my keyboard I have 'Back' and 'Forward' keys. On my mouse I have 'Back' and 'Forward' buttons. I would love it if when I set the 'Back' and 'Forward' keys on my keyboard for some action in a program, my 'Back' and 'Forward' buttons get the same exact action.

For example in Kate I set the 'Back' key to go, well, 'back' and set the 'Forward' key to, you know. ;) Now, I want my 'Forward' and 'Back' buttons on my mouse to do the exact same actions in Kate. I also reset Ctrl+PageUp to go forward, and Ctrl+PageDown to go back. I have mentally assigned the 'Forward' key/button and Ctrl+PageUp to always go forward; and the 'Back' key/button and Ctrl+PageDown to always go back. Every program with tabs (except browers), I will assign those keys to the appropriate direction.

Is there a way to get those mouse buttons to work like their keyboard alternatives?

Also, I can not seem to assign my keyboard's 'Start' key to open the Application Launcher Menu. I would love to be able to do it.

Debian 7; KDE 4.8.4
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I suggest you take a look at this blog post, which should allow you to map your mouse buttons appropriately - http://blog.hanschen.org/2009/10/13/mou ... xbindkeys/


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
bcooksley ... thank you very much. Is there a place I can go to add this functionality to a wishlist for future versions of KDE? In most K applications we have the ability to configure shortcuts (shortcut and alternative), it would be nice to see a column for mouse shortcuts or a third colum for a third possible shortcut for an action. Have a nice day!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Mouse shortcuts are a long standing feature request i'm afraid. KDE is limited from providing them due to limitations in Qt I believe. I'm not sure how Qt 5 changes things in this regard however.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
If I knew what QT 1 and QT 5 are, I would understand. Sorry I don't.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
KDE is built upon a set of libraries known as Qt. KDE is currently based upon Qt 4, with the next generation Plasma Desktop and Applications to be based on Qt 5.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
This is still solved, though I can not for the life of me, understand xbindkeys setup. I will have to get used to the loss of mouse function.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Is there any particular part of the mouse button setup with xbindkeys you haven't been able to get working?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
Where others can easily understand those instructions, I can not. It is as if the writer is speaking another language which I am not conversant in at the moment. The instructions do not come with enough screen shots to show me exactly what I should be looking for and is not KDE specific as far as I can tell. The instructions completely lost me.
User avatar
google01103
Manager
Posts
6668
Karma
25
you could try using btnx (it's 2 packages: btnx & btnx-config), not a KDE app but should work fine

this is the best doc I could find (there's probably others) and it is translated from the French http://translate.google.com/translate?s ... r.org/btnx


OpenSuse Leap 42.1 x64, Plasma 5.x

User avatar
Hans
Administrator
Posts
3304
Karma
24
OS
Lady Aleena wrote:Where others can easily understand those instructions, I can not. It is as if the writer is speaking another language which I am not conversant in at the moment. The instructions do not come with enough screen shots to show me exactly what I should be looking for and is not KDE specific as far as I can tell. The instructions completely lost me.


Edit: Just read your first post again and I think I might understand some of the confusion. The shortcuts in e.g. Kate only belong to Kate, while xbindkeys defines global shortcuts. In theory you should be able to bind one mouse button to your "Forward" button on the keyboard, but unfortunately I don't know what that key would be called in xte (it's not listed when running xte -h). If the Forward key just sends e.g. Ctrl + Page Down, then you should be able to use the second snippet I posted in the comments of the blog post.

What in particular do you find unclear? If you have any specific questions, it would make it easier to clarify things. :)

1. As you say it's not KDE specific (there's a note about it in the beginning of the linked article).
2. Pretty much everything in that tutorial is done in a text editor, which is why there aren't many screenshots. Why take a screenshot of some text when the text can be copy-pasted directly to the post? If you're uncomfortable configuring things by changing a text file, have you tried using the graphical tool "xbindkeys-config" mentioned in the post?
3. When configuring shortcuts, you basically need two things:
- A trigger. When the application (in this case xbindkeys) finds that you have pressed the trigger (could be a key on the keyboard, a key combination, a mouse button, etc.), it will execute some action.
- An action. This is what will happen when you have pressed the trigger.

The actions in xbindkeys are things that you would normally run from the command line (terminal). For example, if you want to launch System Settings, typing "System Settings" doesn't work (it isn't a valid command) - the corresponding command is "systemsettings".

Now, what if we want to map a mouse button to the "Back" action? There is (as far as I know) no terminal command that will make the current application go back, because it varies by application. However, most applications use the keyboard shortcut "Alt+Left Arrow" for the "Back" action, so what if we can trick the computer (really the X server) that we've pressed Alt+Left Arrow when we really pressed a mouse button? This can be done by combining xbindkeys and a tool called xte. xte is a command line program that will send keyboard and mouse events to the system, so if you run e.g. "xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'", the computer thinks that we've pressed Alt+Left Arrow on our keyboard. Now we just need to bind this action to a trigger (e.g. a mouse button) using xbindkeys.

Have you tried to copy the snippet (edit: try the second snippet) in my last comment to ~/.xbindkeysrc (open ".xbindkeysrc" in your home directory in any text editor, e.g. Kate. If you haven't created this file, you'll have to create it first. Also note that the file is hidden by default) and restart xbindkeys?

Edit:

Also, I can not seem to assign my keyboard's 'Start' key to open the Application Launcher Menu. I would love to be able to do it.


See http://blog.hanschen.org/2012/10/17/ope ... super-key/

Hopefully that guide is clearer. ;D


Problem solved? Please click on "Accept this answer" below the post with the best answer to mark your topic as solved.

10 things you might want to do in KDE | Open menu with Super key | Mouse shortcuts
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
I uploaded a screenshot of my current 'Back' and 'Forward' configuration for keyboard keys.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
The second section of XBindKeys configuration which is posted in the blog comment Hans linked to ( http://blog.hanschen.org/2009/10/13/mou ... mment-3068 ) should work for you as the shortcuts in KDE are set the same.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
Lady Aleena
Registered Member
Posts
28
Karma
0
OS
WIth the help of a friend on IRC, we finally got my mouse buttons working as I desired with the following.
Code: Select all
"xte 'key XF86Back'"
  b:8
"xte 'key XF86Forward'"
  b:9

Now on to the Start button. :)
User avatar
firef
Registered Member
Posts
25
Karma
0
OS

reassign middle button in Fedora:

Fri Feb 14, 2020 10:26 am
Code: Select all
# ~/xbindkeysrc file content:


#  Fedora set middlebutton as    browse-BACK ;      xev    produces    b:2   for middle mouse button
#  launch   xbindkeys     in   ~/.bashrc   to activate 

#  dnf install xbindkeys
#  dnf install xautomation # for xte


"xte "key XF86Back""
  m:0x0 + b:2


 
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.8.5
#
# If you edit this file, do not forget to uncomment any lines that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# To specify a key, you can use 'xbindkeys --key' or  'xbindkeys --multikey' and put one of the two lines in this file.
#
# The format of a command line is:
#    "command to start"
#       associated key
#
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.              what???
#
# List of modifier:
#   Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#   Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#

# The release modifier is not a standard X modifier, but you can
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.                                     meaning what?

#keystate_numlock    = enable
#keystate_capslock   = enable
#keystate_scrolllock = enable

# Examples of commands:

#                       control+shift + k    will show a  pop-up window 
#                       (default       "q"   is a poor choice cuz it quits)
"xbindkeys_show"
  control+shift + k

   
# set directly keycode (here control + f with my keyboard)
#"xterm"
#  c:41 + m:0x4

# specify a mouse button
#"xterm"
#  control + b:2

#"xterm -geom 50x20+20+20"
#   Shift+Mod2+alt + s
#
## set directly keycode (here control+alt+mod2 + f with my keyboard)
#"xterm"
#  alt + c:0x29 + m:4 + mod2
#
## Control+Shift+a  release event starts rxvt
#"rxvt"
#  release+control+shift + a
#
## Control + mouse button 2 release event starts rxvt
#"rxvt"
#  Control + b:2 + Release

##################################
# End of xbindkeys configuration #
##################################


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]