LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-23-2009, 01:59 AM   #1
uni4dfx
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Rep: Reputation: Disabled
Question Two mouse buttons to trigger an action


Hello.

I'm a lazy bastard with a Logitech MX1000 mouse. It has 10 buttons, so I can do lots of things with them. But that's not enough. I want to use one of the buttons as a 'modifier' in combinations with other mouse buttons to trigger (hopefully up to 18) different actions.
MX1000 has a "Window List" button (technically called b:10) that is perfect for this. I can map it to a specific action with xbindkeys as following:
Code:
# Some Action:
"/usr/bin/some_action"
  m:0x10 + b:10
But what I really want do is bind it to a combination of two (or possibly more?) mouse keys.
I have tried doing it this way:
Code:
# Some Action:
"/usr/bin/some_action"
  m:0x10 + b:10 + b:13
(button 13 is when you push the scroll wheel to the left - the same as b:6+Release)
But this does not work. It gets triggered when I press b:13, but not in combination with b:10. (If I swap b:10 and b:13, it only works when I press b:10)

I've found a hacky workaroundish way to do it, but it is not that great. What I did was bind button10 to "echo 1 > ~/.mymodkey" and button10/release to "echo 0 > ~/.mymodkey" and then I check this value on other keys. Here is the xbindkeysrc:
Code:
# Toggle mouse modifier:
"echo 1 > ~/.mymodkey"
  m:0x10 + b:10

# Untoggle mouse modifier:
"echo 0 > ~/.mymodkey"
  m:0x10 + b:10 + Release

# Next Song
"if [ "`cat ~/.mymodkey`" -eq "1" ]; then rhythmbox-client --next ; fi"
  m:0x10 + b:14

# Previous Song:
"if [ "`cat ~/.mymodkey`" -eq "1" ]; then rhythmbox-client --previous ; fi"
  m:0x10 + b:13
But this isn't exactly a good solution, because I can't make useful combinations like b:10 and b:1 ... xbindkeys grabs the defined keys so they no longer do what they originally did. And I still need to be able to leftclick.

So, how do I do this?
Can I add a new (mouse!) modifier key with xmodmap? I saw my mod3 is still unused. Is it possible to map it to a mouse key at all?
Is it possible to bind something (with xbindkeys or w/ something else) parallel to its original function?
Any other solution?

Last edited by uni4dfx; 06-23-2009 at 04:33 AM.
 
Old 06-24-2009, 01:07 AM   #2
uni4dfx
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Original Poster
Rep: Reputation: Disabled
Bump
 
Old 06-25-2009, 03:10 AM   #3
uni4dfx
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Original Poster
Rep: Reputation: Disabled
Bump
 
  


Reply

Tags
mouse, xbindkeys, xmodmap



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Action trigger on DHCP lease Cidi Rome Linux - Networking 3 03-05-2008 11:14 AM
Mouse back and forward buttons are interpreted as buttons 2 and 3 (MX610) jot-87 Linux - Hardware 1 08-06-2007 11:12 AM
Trigger action when module is inserted (wake on lan) benjalien Debian 12 04-25-2006 01:16 AM
GTK+ dialog: want to display buttons vertically in action area paulsm4 Programming 0 06-22-2005 06:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration