Page 1 of 7 123 ... LastLast
Results 1 to 10 of 61

Thread: HOWTO: General mouse customization, including double click

  1. #1
    Join Date
    Dec 2006
    Beans
    678

    HOWTO: General mouse customization, including double click

    The information in this thread have been moved to https://help.ubuntu.com/community/MouseCustomizations

    A thread for discussion of the wiki page only can be found here http://ubuntuforums.org/showthread.php?t=2012401
    Thread closed.


    This is yet another mouse button customization guide. From reading these forums (and others on the net), I think the major unresolved issue for many users switching to Linux is the ability to set an arbitrary (usually the middle or thumb) button on a mouse to "double click" (typically double "left click"). I finally worked out a reasonable solution to this problem, and am including enough additional details that most people should be able to work out how to customize their mice. This is not to take away from a wide variety of other guides in these forums, but they are perhaps too specific (i.e., it's hard to modify the command set the poster presents, which typically don't work at all with my Marble Mouse trackball). These instructions rely only on X and distro-independent tools for it, so should work with most or all Linux distros with only minor changes. I have personally used or seen other people use parts of these instructions without problem in multiple versions/releases of Ubuntu and Debian.

    NOTE: Please keep all help questions public (i.e., post here rather than private messaging me), as any question you have is most likely one that will benefit other users, and I do have a full-time job, so can't act as private support for anyone.

    You may wish to try the program btnx: discussion at http://ubuntuforums.org/showthread.php?t=455656 and download at http://www.ollisalonen.com/btnx/. For many users, this program is probably easier and sufficient, and provides an interface similar to that for Logitech mice under Windows. However, btnx is still in development, so may not be entirely stable yet. Btnx also does not allow for some of the more complex combinations discussed below, such as modifier keys with mice buttons. Note: as of Sep 2008, btnx development has apparently ceased, due to something in Xorg 7.4 (released with Intrepid) permanently breaking the method btnx used to communicate with the mouse.

    Updated 1 April 2008

    SHORCUT: If all you want to do is set your four or five button mouse to use the extra buttons as "forward" and "back" buttons, you may have success with performing only a single action: edit /etc/X11/xorg.conf in the mouse section, and add the following two lines:
    Code:
    Option "Buttons" "7"
    Option "ButtonMapping" "1 2 3 6 7"
    Make sure to backup the file first, and restart X to have the effect take place. Assuming you are one of the fortunate people who only wants these functions and whose mouse buttons map as the "standard" behavior, you'll be all set. If it does not work, or you want other functions, you'll need to follow the longer details below. (END SHORTCUT)

    First, you need to install several programs. xbindkeys allows you to map any mouse (or keyboard) event to some program. xautomation is our gateway to setting up a "double click" event and mapping keyboard events to mouse buttons, and so it is not needed if you do not plan on using this.

    NOTE: xvkbd seems to be the preferred tool in other threads instead of xautomation/xte, so if you wish you can use that instead of xautomation for all the same keyboard mapping tasks if you prefer that approach. xmacro is another tool that may work to replace xte for double click.

    Open a terminal and type:
    Code:
    sudo apt-get install xautomation
    sudo apt-get install xbindkeys
    --Getting button numbers--
    Now we need to determine the "button number" of each physical button on your mouse.
    Code:
    xev
    This will open a window. Move your mouse cursor over it, and you'll see a lot of output in your terminal; don't worry about the output that happens when you move the mouse. One at a time, single click each button inside the "event tester" window, and note the 3rd line of output from either (or both) of the "ButtonPress" or "ButtonRelease" notices that pop up. The center item is "button X." Make a note of the number that matches each physical button on your mouse. Also note if one or more buttons do not respond.

    --Scroll Wheel and getting all buttons to respond--
    First, get your scroll wheel working, if you have one. As I do not, this will be approximate, but the other guides available cover this in great depth if you need more help. Basically, the "scroll up" and "scroll down"are 2 more buttons on your mouse, so you will need to identify this as well using xev. Then type:
    Code:
    sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
    sudo gedit /etc/X11/xorg.conf
    It is essentially to have a backup of xorg.conf, as messing it up can damage your ability to work to load your window environment. Search for "mouse." It should look something like this (although you may have additional lines):
    Code:
    Section "InputDevice"
    	Identifier	"Configured Mouse"
    	Driver		"mouse"
    	Option		"CorePointer"
    	Option		"Device"		"/dev/input/mice"
    	Option		"Protocol"		"ExplorerPS/2"
    	Option		"ZAxisMapping"		"6 7"
    	Option		"Emulate3Buttons"	"true"
    EndSection
    The only two lines we are going to touch are the "Protocol" and "ZAxisMapping" lines. Only change the Protocol line if one or more buttons did not respond. If you have unresponding buttons, chances are that you are using the PS/2 or IMPS/2 protocols, which may not allow for as many buttons (or the configuration) that you have, in which case try the ExplorerPS/2 as shown above. If you are already set to that and can't get buttons to respond (or get multiple button events in response to a single click), you probably need to use the "evdev" driver, described near the bottom of this post.

    ZAxisMapping refers to the scroll wheel. Basically, the simplest way to get the scroll wheel to work is to change the "6 7" above to match the two scroll button numbers from xev.

    You will need to restart X (logout & press Ctrl + Alt + Backspace) to have these changes go into effect. If you changed the protocol, you will need to resume at the beginning (getting button numbers) as they will probably have changed. If your scroll wheel still does not work, try this in the terminal (the pointer should have as many numbers as from the -pp output, each only once):
    Code:
    xmodmap -pp
    xmodmap -e "pointer = 1 2 3 4 5 X Y 6 7 ..."
    This first outputs your current mapping of buttons. Basically, this means that the number shown (in the pointer) is the button # that triggers the events normally associated with the button position (i.e., here X & Y should be replaced with your 2 scroll buttons, to get them to trigger the 6 & 7 events). Note that if you use xmodmap, you will to auto-load this each time you start X (in Gnome, go to System -> Preferences -> Sessions -> StartUp, and add the xmodmap command. Also note that xmodmap takes effect immediately; you do not need to restart.

    You may also need to add a "buttons" option and try remapping in xorg.conf; see the other tutorials and http://www.die.net/doc/linux/man/man...-driver.4.html for more details.

    --Rearranging buttons--
    As mentioned above, you can use xmodmap to rearrange buttons. This is useful if, as with my marble mouse, none of the buttons are set to be the "middle" button, which can be a problem in some programs. The middle button is button position 2. On my mouse, I have 4 buttons, which are assigned numbers 1, 3, 8, and 9. I use this:
    Code:
    xmodmap -e "pointer = 3 8 1 4 5 6 7 2 9"
    to assign button 8 to be the "middle button" (and assign position 8 to button 2, which does not exist). Note that I am also using this left-handed, so my right- & left-click buttons are swapped ("normally" the 1 is left-click and 3 is right-click). In my case, positions which are assigned numbers 2 & 4-7 do not have any function, since I do not have any of those button numbers. Again, you must run xmodmap each time you login for this to work.

    --Setting up double click--
    I know it's taken a while to get here, but the unique point to this howto: setting an arbitrary button to be a "double click." To follow what we're going to do, understand that there is no such thing as a "double click" event. What we are actually going to do is assign a button to give 2 "left-click" events.

    Installing xautomation provided us with several tools (use "man xautomation" if you're curious), but the key one is "xte." This allows us to send arbitray mouse (& keyboard) events to the kernel. We will also make use of xbindkeys to first trap the button event. First, create .xbindkeysrc, which xbindkeys uses for trapping events:
    Code:
    gedit ~/.xbindkeysrc
    Now type:
    Code:
    "/usr/bin/xte 'mouseup Y' 'mouseclick 1' 'mouseclick 1' &"
    b:Y
    or
    Code:
    "/usr/bin/xte 'mouseclick 1' 'mouseclick 1' &"
    b:Y + Release
    (The difference is whether you want the double click to to respond when you first click the mouse, or only when you release the button, respectively.)
    Replace "Y" in "b:Y" with the button number of the button you wish to assign to double-click. Save & close this file.

    Code:
    xbindkeys -n -v
    This starts xbindkeys running in the foreground, which means it will tell you if there are problems with your file. If you click the button Y, you should see xbindkeys provide trapping feedback upon release, and see feedback as well from button 1. Press "Ctrl + C" to stop this interface, then (if everything is working):
    Code:
    xbindkeys &
    which will load xbindkeys in the background, and you should be set. As with xmodmap (end of the Scroll Wheel section), you need to add xbindkeys to start when X loads for this to work long-term.

    --Additional keys--
    Basically, adding any other function to your mouse is going to use xbindkeys via the .xbindkeysrc file, except the command line will look something like this:
    Code:
    "/usr/bin/xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' &"
    b:Z
    This example binds "Alt + Left Arrow" to button Z, which works as "back" in Firefox (and a variety of other applications). You can read many more examples of key combinations here using "man xte" or at the xbindkeys site: http://hocwp.free.fr/xbindkeys/xbindkeys.html . The examples there mostly show to how invoke programs, but you can still get the example keys and just substitute in the example above. Also at the site are scripts (and at least one example of how to use in their config files, I think for invoking emacs two different ways) on mapping multiple events to a single button (e.g., if single click button Z, go back; if double-click, go forward).

    For those wishing to set "scroll up" & "scroll down" buttons that repeat (i.e., advance multiple times instead of just once per click), it should be possible to set up a short script that loops the xte event & a short sleep event as long as the button is held down, and invoke that script in .xbindkeysrc, but I have not actually tested this.

    EDIT: see the next few posts for how to get scroll working for multiple advances.

    Also note that xbindkeys is a great way to get keyboard combinations working (e.g., that useless Windows key, the multimedia keys you may have, or other random combinations to load favorite programs).

    --Application specific settings--
    See this thread: http://www.ubuntuforums.org/showthread.php?t=380927.
    Or post #30 below for an equivalent approach.

    --Dealing with different settings for laptops when external mouse connected--
    See this thread for a start: http://www.ubuntuforums.org/showthread.php?t=350464.

    --evdev driver--
    If you have multiple scroll wheels or buttons that are not recognized, you probably need to use the evdev driver. This is a little more complicated to set up. Much of this section is stolen from another mouse guide: https://help.ubuntu.com/community/MX1000Mouse.

    Note to Hardy users: the evdev driver was changed significantly for Xorg 7.3, released with Hardy. The below will not work. You may be able to replace Option "Name" with Option "by-path" and choose the correct device from /dev/input/by-path/, but users are reporting mixed success with this on Launchpad. Some of the other configuration options for evdev have also apparently been dropped.

    If running pre-Gutsy releases, install evdev (it is install by default in Gutsy):
    Code:
    sudo apt-get install xserver-xorg-input-evdev
    Then you need to identify the name of your mouse (or its receiver, if wireless):
    Code:
    cat /proc/bus/input/devices
    Which will yield output something like this (on my computer):
    I: Bus=0017 Vendor=0001 Product=0001 Version=0100
    N: Name="Macintosh mouse button emulation"
    P: Phys=
    S: Sysfs=/class/input/input0
    U: Uniq=
    H: Handlers=mouse0 event0
    B: EV=7
    B: KEY=70000 0 0 0 0 0 0 0 0
    B: REL=3

    I: Bus=0010 Vendor=001f Product=0001 Version=0100
    N: Name="PC Speaker"
    P: Phys=isa0061/input0
    S: Sysfs=/class/input/input4
    U: Uniq=
    H: Handlers=kbd event4
    B: EV=40001
    B: SND=6

    I: Bus=0003 Vendor=05a4 Product=9998 Version=0100
    N: Name="NOVATEK USB Keyboard"
    P: Phys=usb-0000:00:1f.2-1/input0
    S: Sysfs=/class/input/input58
    U: Uniq=
    H: Handlers=kbd event1
    B: EV=120003
    B: KEY=10000 7 ff87207a c14057ff febeffdf ffefffff ffffffff fffffffe
    B: LED=7

    I: Bus=0003 Vendor=05a4 Product=9998 Version=0100
    N: Name="NOVATEK USB Keyboard"
    P: Phys=usb-0000:00:1f.2-1/input1
    S: Sysfs=/class/input/input59
    U: Uniq=
    H: Handlers=kbd event2
    B: EV=3
    B: KEY=c000 100000 0 0 0

    I: Bus=0003 Vendor=046d Product=c408 Version=0110
    N: Name="Logitech USB Trackball"
    P: Phys=usb-0000:00:1f.4-1/input0
    S: Sysfs=/class/input/input60
    U: Uniq=
    H: Handlers=mouse1 event3
    B: EV=7
    B: KEY=1f0000 0 0 0 0 0 0 0 0
    B: REL=3

    I: Bus=0019 Vendor=0000 Product=0002 Version=0000
    N: Name="Power Button (FF)"
    P: Phys=button_power/button/input0
    S: Sysfs=/class/input/input61
    U: Uniq=
    H: Handlers=kbd event5
    B: EV=3
    B: KEY=100000 0 0 0

    I: Bus=0019 Vendor=0000 Product=0001 Version=0000
    N: Name="Power Button (CM)"
    P: Phys=PNP0C0C/button/input0
    S: Sysfs=/class/input/input62
    U: Uniq=
    H: Handlers=kbd event6
    B: EV=3
    B: KEY=100000 0 0 0
    You are looking for the one that implies a mouse, or the manufacturer of your mouse (not the Macintosh mouse buttom emulation) and generally would refer to "mouse" in the "Handler" line of the section; in my cases, this is the 5th entry with the name "Logitech USB Trackball". Make a note of the name line, including all capitalization exactly.

    Edit (after backing up!) your xorg.conf as described above, replacing the existing mouse section section (between the "Section..." and "EndSection" lines) with this:
    Code:
            Identifier      "Logitech Trackball"
            Driver          "evdev"
            Option          "Name"          "Logitech USB Trackball"
    replacing the Identifier to reflect what you wish to call your mouse, and the Option "Name" with the name of your mouse from the output desribed above.

    Then replace the
    Code:
    InputDevice     "configured mouse"
    near the bottom of xorg.conf with this (replacing your name as needed):
    Code:
    InputDevice     "Logitech Trackball" "CorePointer"
    NOTE: If you using a laptop where your mouse will not always be connected, use "SendCoreEvents" instead of "CorePointer".

    Save & close xorg.conf and restart X, then resume the guide above (note that the ZAxisMapping trick won't work with evdev).

    Also note with the evdev driver that some buttons will report two events (e.g., the "tilt wheel" of Logitech mice). The first button, usually the higher number, is the "start/stop" signal for the event, while the second button, usually lower and repeating, is the button you usually want to modify to change a function. I've not found a way on those mice to change which button is triggered (e.g., the "cruise" buttons on the Logitech MX1000 trigger buttons 4 & 5, which are the same as the scroll wheel, so you can't change the cruise effect separately from an effect on the scroll wheel).

    --Conclusion--
    So sorry for the marathon length, but hopefully this explains more of how things actually work, and will allow people to customize their mice in a fairly straightforward fashion. I will attempt to key an eye on this if anyone wants to provide feedback, point out problems, or needs additional help, but I'm trying to finish up my PhD so I can move on with my life, so I won't have a lot of time (I've already spent far too much on this problem). Feel free to re-post, abbreviate, correct, etc. Finally, for those long-time Linux users who may respond "just use KDE" or other useless pieces of "advice" to avoid the need for a double-click altogther, I just want to say that there are plenty of good reasons to want a separate single & double click event for normal users, and especially for those who have trouble physically double-clicking (most Linux users seem to forget out the "accessibility" issue of computers, though I find these forums to be much better than forums elsewhere - Ubuntu users must just be nicer people. 8) )
    Last edited by Elfy; June 29th, 2012 at 08:59 AM. Reason: Added notes to reflect improvements from thread discussions, added evdev.

  2. #2
    Join Date
    Jun 2006
    Beans
    2,310
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: HOWTO: General mouse customization, including double click

    I'm not sure if this helps any (by way of double-clicking versus single-clicking), but you can enable single clicking behaviour through gconf-editor.

    Open gconf-editor and go to Apps > Nautilus > Preferences and click on the key called click_policy and change the word double to the word single. Et, voila!

  3. #3
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: General mouse customization, including double click

    I'm not sure if this helps any (by way of double-clicking versus single-clicking), but you can enable single clicking behaviour through gconf-editor.
    This approach is the wrong solution, at least for me. While this avoids having to double-click in certain situations (e.g., starting a program), it does not address two basic issues:
    1) I like to be able to select something without necessarily activating (e.g., when I want to delete something on my desktop - and, yes, I know you can right-click & select it, but I prefer to left-click & hit the delete key).
    2) There are many cases within programs where double-clicking is required (e.g., to select a word), and the Nautilus preference has no effect there. (Fortunately: imagine being unable to distinguish single- & double-clicking while trying to write a document!)

    My personal primary motiviation comes from events falling into the 2nd case.

  4. #4
    Join Date
    Nov 2006
    Location
    Saudi Arabia
    Beans
    91
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: General mouse customization, including double click

    Quote Originally Posted by tweedledee View Post

    For those wishing to set "scroll up" & "scroll down" buttons that repeat (i.e., advance multiple times instead of just once per click), it should be possible to set up a short script that loops the xvkbd event & a short sleep event as long as the button is held down, and invoke that script in .xbindkeysrc, but I have not actually tested this.
    Can you possible explain how to do this, or even how to begin? I want to somehow set up xbindkeys to make it so that holding down Button 8 will continuously scroll down (Button 5). Unfortunately, I cannot figure out how to make xbindkeys repeat an event for as long as a button is held down, it only does the event once. Right now I just have it scroll down three times, and keep pressing it. An idea I have for this, but am unable to implement, is to create a script that will send an infinite number of button 5 events with a short delay, and have it execute when button 8 is pressed. Then, when button 8 is releases, the xbindkeys will kill the script. Would that even work?

    Also, is there any way to use xmodmap to map a mouse button as an arbitrary keyboard button? For example, I want to map Button 2 as keycode 168....or any other button I specify to any other keycode.
    Last edited by kobewan; December 13th, 2006 at 10:13 AM.

  5. #5
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: General mouse customization, including double click

    Quote Originally Posted by kobewan View Post
    Can you possible explain how to do this, or even how to begin? I want to somehow set up xbindkeys to make it so that holding down Button 8 will continuously scroll down (Button 5). Unfortunately, I cannot figure out how to make xbindkeys repeat an event for as long as a button is held down, it only does the event once. Right now I just have it scroll down three times, and keep pressing it. An idea I have for this, but am unable to implement, is to create a script that will send an infinite number of button 5 events with a short delay, and have it execute when button 8 is pressed. Then, when button 8 is releases, the xbindkeys will kill the script. Would that even work?
    Without having actually tried it, you've outlined the approach I was thinking of. Basically, you could use the approach I've described for the double-click, only instead of use xte to send button 1, send a scroll event (i.e., the button mapped to the z-axis in xorg.conf). Your xbindkeysrc would look something like this:
    Code:
    "~/.scrollscript &"
    b:8
    "~/.scrollscriptkill &"
    b:8 + Release
    You've then need a .scrollscript, which could look something like this:
    Code:
    #!/bin/bash
    setenv SCROLLSCRIPTVALUE=0
    while [ $SCROLLSCRIPTVALUE -eq 0 ]
    do
        xte 'mouseclick Y'
        sleep 0.1
    done
    Changing 0.1 to match your desired speed, and 'Y' to match the appropriate button. Here I'm using an environment variable to control the loop, so changing the value of SCROLLSCRIPTVALUE in .scrollscriptkill should stop the loop. I'm sure there is a more graceful way to handle that, but the loop should work. There is probably discussion of this in some of the threads about controls for Logitech mice as well. If you're unfamiliar with bash scripts, a quick Google search on "bash shell script" turns up a bunch of guides.

    EDIT: The method described does not quite work (at least not for mouse buttons), see the next post for a better implementation.

    Quote Originally Posted by kobewan View Post
    Also, is there any way to use xmodmap to map a mouse button as an arbitrary keyboard button? For example, I want to map Button 2 as keycode 168....or any other button I specify to any other keycode.
    Not using xmodmap. It should be possible using xbindkeys & xvkbd - use xbindkeys to trap the button event and send the desired keycode to xvkbd (or xte, actually, which also handles keyboard events). What you'd probably need to do is send the whole sequence of keys you'd ordinarily press (i.e., ctrl+shift+u, ctrl+shift+#, ctrl+shift+#, etc.) to type a unicode character not available on the keyboard. If you don't know the relevant unicode, you can find it in the character map (you probably are looking for something in the Latin-1 Supplement block - select View -> By Unicode Block, then the Latin supplement group & scroll down to find it).

    Post if you can either of these to work, especially the last - while I haven't read every post on this subject, that seems like an unusual (but clever, for mice with a huge number of buttons) use for a button.
    Last edited by tweedledee; December 15th, 2006 at 03:23 PM.

  6. #6
    Join Date
    Nov 2006
    Location
    Saudi Arabia
    Beans
    91
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: General mouse customization, including double click

    Alright, after trying out a bunch of things, as well as receiving several blinding flashes of the obvious, I have recorded the following results:-

    Unfortunately the cruise button doesn't work properly as described above. It seems that xbindkeys is not able to properly handle button releases, and can't map an action to a button and its release if the button sends mouse events while pressed. It works fine if you map the script's kill to a different button, but that's not quite the point.

    However : although a button release can't be mapped to kill the script if said button is sending another mouse button, it maps just fine if button in question is sending keyboard events. I'm using the same method to make the volume up and volume down buttons on my mouse repeating, and it works just fine. Now, you'd think that immediately after find this out, I would figure out how to do it. Unfortunately, it took me several hours (and a few games of Super Smash Brothers) before nearly being blinded by the obvious ; map the mouse button to send key Down, instead of mouse Scroll Down. Granted, this won't work in all the same places, but for general use it should be fine (it will scroll the browser window, the Agrekator window and PDFs. So I created a simple script in my home directory, called .scrolldown, containing:

    Code:
    #!/bin/bash
    #
    DO=1000000
    
    for ((a=0; a < DO ; a++))  # do the loop number of times that is in DO
    do
      /usr/bin/xte 'key Down'
      sleep 0.15
    done
    Then, I put this into the xbindkeys configuration file:

    Code:
    # scroll down
    "~/.scrolldown"
       b:8
    
    # kill scroll down
    "killall .scrolldown"
       release + b:8
    Also, I've figured out how to make a "modifier" button. It doesn't work if you simply try to simply map a modifying key (down on press, up on release) on a button as again 'Release + b:*' wouldn't work properly. So I mapped this to button 17:

    Code:
    # button becomes modifier Alt+Control (m:0xc)
    "/usr/bin/xte 'keydown Alt_R' 'keydown Control_R'; sleep 1 ; /usr/bin/xte 'keyup Alt_R' 'keyup Control_R'"
      b:17
    It works like this : hit the modifier button and then hit a different button within 1 second to generate a different event. The best part about the way that it is set up is that you could even set up a button to be a kind of modifier toggle, so that hitting it once makes it send mod1+event, hitting it twice sends mod2+event, three times sends mod3+event etc. All you have to do is something like this : the first time you hit modifier button (button 17 for me) it sends 'keydown Alt+Ctrl' for one second. Hitting Button17 within that one second will make it send 'keyup Alt' followed by 'keydown Ctrl+Shift' for one second. This means that you can create a pretty much infinite number of keys (or at least more keys than you can keep track of).

    An example of how this is useful in my current configuration: mod + the Volume Down button I mentioned above sends the mute button. Another way that it could be useful is to basically create different xbindkeys profiles for different applications. Hit mod twice, and then change your profile depending on what button you press (for example, a seperate amaroK profile could be quickly mapped by hitting Mod2+Button8). This would probably be even cooler with an on screen display, and I'm looking into that right now...it should be fairly easy to implement using OSD programs from Synaptics.

    It's for reasons like this that Linux is so awesome, and really shows the power of it. Sure, doing things like this might not matter to your average Windows user, but I would've killed for this kind of functionality for Windows. On top of that, I'm sure that this is only scratching the surface of what can be done ; I only started using Linux about 2-3 weeks ago. When I was switching, the thing that I thought I would miss the most would be my mouse's extra keys (I was using Setpoint, hacked with uberOptions to make almost anything configurable). Now, if I have to switch back to Windows the thing that I will miss the most would be my mouse's configurability. I can definitely do so much more than I could come close to with Windows.

    Also, I don't need to "use xmodmap to map a mouse button as an arbitrary keyboard button" anymore. I originally wanted to do it because I didn't like xbindkeys very much, due to a few shortcomings like not properly catching button releases and not having any autorepeat setting (also because xvkbd is one seriously strange piece of software, only doing what it wants to do. xte is so much better than it.) Unfortunately, all other key binding applications that I found only worked for keyboard events, and they detected them using keycodes. This would mean that remapping a mouse button to a key would in xbindkeys would not work, and would also not get around the above problems. Fortunately, I've pretty much been able to work around those problems now. I would still look over any alternative I could find, since it would be less annoying and time consuming, but I'm loving my mouse right now.
    Last edited by kobewan; December 15th, 2006 at 12:25 AM. Reason: major cleaning up of post

  7. #7
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: General mouse customization, including double click

    Quote Originally Posted by kobewan View Post
    Alright, after trying out a bunch of things, as well as receiving several blinding flashes of the obvious, I have recorded the following results:-

    Unfortunately the cruise button doesn't work properly as described above. It seems that xbindkeys is not able to properly handle button releases, and can't map an action to a button and its release if the button sends mouse events while pressed. It works fine if you map the script's kill to a different button, but that's not quite the point.
    I'd just discovered the problem of the "release won't kill" as well, trying to do something entirely unrelated, and have made a note in my previous post. However, you seem to have found an extraordinarily clever use of your mouse, I'm impressed. I agree with you - I'm finding the customizability of my mouse much superior to Windows (which I have completely dropped except for 2 programs that I can't for research purposes), and I'm finding xte much more reliable and easier to use than xvkbd. Supposedly they make use of the same library for communicating events, but xte is much cleaner for this purpose, plus you can send mouse events.

    Since you have obviously taken this further than I have, if you have a chance it may be worth trying to get my initial steps with your supplements into the wiki; I don't anticipate having time for that any time soon.

  8. #8
    Join Date
    Nov 2006
    Location
    Saudi Arabia
    Beans
    91
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: General mouse customization, including double click

    I may look into updating the wiki, but before that I want to configure it to perfection and I'm unfortunately still a couple of steps off. I'm not going to be able to figure these things on my own though, I've been trying for a long time now. In order of difficulty, easiest first:

    1. Setting up an OnScreen Display : solved

    2. Real, application-specific settings. Right now, I've created a few different settings files for xbindkeys, and keep a drawer on my panel with the icons of 5 or 6 different apps in it. Whenever I want to change my bindings, I just select the appropriate icon. That runs a script which kills the open xbindkeys and tells it to restart using that apps settings

    Although this works reasonably well, I think it should be possible to do better than this. I was using devilspie yesterday, and it has pretty good window matching capabilities. Basically, I want a program that can do something like this:

    if (application name = Firefox) and (focused = true) then (*run command*).

    I think programs like this *should* exist, but I haven't had any success in finding anything.

    3. Setting sensitivity of second mouse : based on the information that I've found, I think this might not even be possible. I'm using an IBM Thinkpad, and my eraser nub/mouse thing in the middle of the keyboard is set as my primary mouse. Using the 'Mouse' applet in Gnome Control Center as well as 'xset m' in the terminal only change the setting for my eraser nub. My Logitech mouse has a higher acceleration than I would like, but I am unable to change it. Setting the resolution in lomoco doesn't help either.
    Last edited by kobewan; December 15th, 2006 at 06:56 PM.

  9. #9
    Join Date
    Nov 2005
    Location
    AZ
    Beans
    114
    Distro
    Kubuntu 13.04 Raring Ringtail

    Re: HOWTO: General mouse customization, including double click

    i installed the listed programs via apt, and created the xbindkeysrc, editing it so that i can map my two side buttons to use them as back and forward buttons in Firefox and nautilus, however after starting xbindkeys -n -v and pressing the "back button" on my mouse i get the following output.

    Code:
    paridoth@paridoth-desktop:~$ xbindkeys -n -v
    displayName = :0.0
    rc file = /home/paridoth/.xbindkeysrc
    rc guile file = /home/paridoth/.xbindkeysrc.scm
    getting rc guile file /home/paridoth/.xbindkeysrc.scm.
    WARNING : /home/paridoth/.xbindkeysrc.scm not found or reading not allowed.
    2 keys in /home/paridoth/.xbindkeysrc
    
    min_keycode=8     max_keycode=255 (ie: know keycodes)
    "/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[left]" &"
        m:0x0 + b:8   (mouse)
    "/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[right]" &"
        m:0x0 + b:9   (mouse)
    starting loop...
    Button press !
    e.xbutton.button=8
    e.xbutton.state=16
    "/usr/bin/xvkbd -xsendevent -text "\[Alt_L]\[left]" &"
        m:0x0 + b:8   (mouse)
    Start program with fork+exec call
    Catch CHLD signal -> pid 7349 terminated
    Button release !
    e.xbutton.button=8
    e.xbutton.state=16
    and it is not working, i'm sure i missed something in your tutorial, but i'm not sure what it is.

  10. #10
    Join Date
    Dec 2006
    Beans
    678

    Re: HOWTO: General mouse customization, including double click

    Quote Originally Posted by paridoth View Post
    i installed the listed programs via apt, and created the xbindkeysrc, editing it so that i can map my two side buttons to use them as back and forward buttons in Firefox and nautilus, however after starting xbindkeys -n -v and pressing the "back button" on my mouse i get the following output.
    Try these solutions in your xbindkeys.src, in the order listed (assuming the previous step didn't work):

    1) Change your "left" and "right" to "Left" and "Right" (capital first letters).
    2) Try adding " + Release" to the b:8 & b:9 lines.
    3) Install xautomation, and replace your xvkbd lines with these:
    Code:
    "/usr/bin/xte 'keydown Alt_L' 'key Left' 'keyup Alt_L' &"
    b:8
    "/usr/bin/xte 'keydown Alt_L' 'key Right' 'keyup Alt_L' &"
    b:9
    Last edited by tweedledee; January 10th, 2007 at 01:23 AM.

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •