Computers 'n Stuff: My .xbindkeysrc.scm configruation file I use with the MX1000 lasermouse (for now)

I here share the resolutions for my Linux problems so they might safe somebody some time.

Sunday, June 03, 2007 parmanent link to this post

My .xbindkeysrc.scm configruation file I use with the MX1000 lasermouse (for now)

This is my .xbindkeysrc I'm using with my mx1000 lasermouse. It's quite useful. with firefox. The thumbkeys can scroll in history and if you press the appbutton and use the scrollwheel at the same time you scroll through tabs.. If the mouse is setup properly it should be possible to do horizontal scrolling by the tilting th scroll wheel. However Firefox needs some adjustments for theis to function since he will scroll through history when the horizontal scroll buttons are pressed. The appbutton pushed and released alone will toggle the last active app.

The the Guru repository xbindkey suse rpm are compiled without guile support.To use xbindkeys it has to be compiled with guile support. The Guru repository does provide a xbindkeys-1.8.2-1-src.rpm that can be compiled with :
# rpmbuild --with guile --rebuild sourcepackage 

to provide guile support. where sourcepackgage has to be replaced by the name of the sourcpackage, in this matter by xbindkeys-1.8.2-1-src.rpm. You will need to install the guile-devel package in order to compile xbindkeys in this way however. The compild RPM will show up in /usr/src/packages/RPMS/`architecture` where architecture has to corrospond your hardware architechture, in my case x86_64-

;; This configuration is guile based.
;; http://www.gnu.org/software/guile/guile.html
;; This config script us supposed to live in the homedirectory.
;; This was a not so quick but probably yet dirty hack by Vee Lee.(I know nothing about coding but at least it works)
;; You'll need xmacroplay and xbindkeys with -guile support compiled for this to work..
;; This is heavily based on the domoscripts (http://hocwp.free.fr/xbindkeys/xbindkeysrc-combo.scm.html)
;; of the author of xbindkeys (hocwp at free dot fr) Many thanks and keep up the good work.
;; It assigns keybindings to the scroll wheel on the fly after the appwindow button is pressed on the mx1000 lasermous!

define (display-n str)
"Display a string then newline"
(display str)
(newline))

(define (first-binding)
"First binding"
(xbindkey-function '("b:10") second-binding)
(xbindkey-function '("m:0" "b:9") (lambda () (run-command "echo -e 'KeyStrPress Alt_L\nKeyStrPress Right\nKeyStrRelease Right\nKeyStrRelease Alt_L\n' | xmacroplay :0 &")))
(xbindkey-function '("m:0" "b:8") (lambda () (run-command "echo -e 'KeyStrPress Alt_L\nKeyStrPress Left\nKeyStrRelease Left\nKeyStrRelease Alt_L\n' | xmacroplay :0 &")))
)

(define (reset-first-binding)
"reset first binding"
(display-n "resetting first binding")
(ungrab-all-keys)
(remove-all-keys)
(first-binding)
(grab-all-keys))

;;This allows to scroll through tabs in firefox
(define (second-binding)
"Second binding"
(display-n "setting second binding")
(ungrab-all-keys)
(remove-all-keys)
(xbindkey-function '("b:4")
(lambda ()
(display-n "Scroll up")
(run-command "echo -e 'KeyStrPress Control_L\nKeyStrPress Tab\nKeyStrRelease Tab\nKeyStrRelease Control_L' | xmacroplay :0 &")
))

(xbindkey-function '("b:5")
(lambda ()
(display-n "Scroll down")
(run-command "echo -e 'KeyStrPress Control_L\nKeyStrPress Shift_L\nKeyStrPress Tab\nKeyStrRelease Tab\nKeyStrRelease Shift_L\nKeyStrRelease Control_L' | xmacroplay :0 &")
))

(xbindkey-function '(release "b:10") (lambda ()
(run-command "echo -e 'KeyStrPress Alt_L\nKeyStrPress Tab\nKeyStrRelease Tab\nKeyStrRelease Alt_L' | xmacroplay :0 &")
(reset-first-binding)))
(grab-all-keys))

(define (scroll-apps-binding)
"scroll-apps-binding"
(display-n "scroll apps binding success")
(ungrab-all-keys)
(remove-all-keys)
(xbindkey-function '("b:4")(run-command "echo -e 'KeyStrPress Tab\nKeyStrRelease Tab' | xmacroplay :0 &"))
(xbindkey-function '("b:5")(run-command "echo -e 'KeyStrPress Shift_L\nKeyStrPress Tab\nKeyStrRelease Tab\nKeyStrRelease Shift_L' | xmacroplay :0 &"))
(xbindkey-function '("b:1") reset-first-binding)
(grab-all-keys))
(debug)
(grab-all-keys)
(first-binding)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; End of xbindkeys configuration ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


I'm looking for a way to alt + tab through the application windows using the scroll wheel but I can't get this working. Suggestions are welcome

Related Posts:
Mouse setup in linux links

Labels: , , , ,

6 Comments:

Blogger Unknown said...

Hi:

I'm trying to get Ratpoison keyboard shortcuts to work with XBindKeys, so I was inspired by your .xbindkeysrc.scm file.

I'm basically trying achieve that pressing Ctl-t : (control t, and colon after that) runs Alt-F2.

I'm using this:

(define (first-binding)
"First binding"
(xbindkey-function '(control t) second-binding))

(define (reset-first-binding)
"reset first binding"
(display-n "reset first binding")
(ungrab-all-keys)
(remove-all-keys)
(first-binding)
(grab-all-keys))

(define (second-binding)
"Second binding"
(display "New binding")
(ungrab-all-keys)
(remove-all-keys)
(xbindkey-function '(shift semicolon)
(lambda ()
(display-n "C-t :") (run-command "echo -e 'KeyStrPress Alt_L\nKeyStrPress F2\nKeyStrRelease F2\nKeyStrRelease Alt_L' | xmacroplay :0 &")
(reset-first-binding)))

But this doesn't run Alt-F2. Would you have an idea on what's wrong?

Thank you.

Best regards,

ShiroiKuma

Monday, October 29, 2007 4:11:00 PM

 
Anonymous Anonymous said...

Hi ShiroiKuma,

you didn't define the 'display-n' function in your script, so disply-n will have probalby no effect. You won't need it though, I just thought it might be handy for debugging purposes.

the xbindkey-function also probably doesen't understand the shift semicolon or control t arguments you use. As far as I rememembe it expects the xevents of the respective keystrokes as input.

you could try
# xev
to find out I guess. But I cant remember exactly any more.

Also check out the demoscirpts of the author of xbindkey
http://hocwp.free.fr/xbindkeys/xbindkeysrc-combo.scm.html
for more examples ...

I hope this helps a little

Cheers

vee lee

Thursday, November 22, 2007 4:55:00 AM

 
Anonymous puertas metalicas exterior said...

Really effective information, much thanks for the article.

Sunday, March 04, 2012 9:38:00 AM

 
Blogger Zero Angel said...

Thanks to your article, I was able to get multi mousebutton keybinds to work. This article was VERY difficult to find, but also quite helpful.

I customized the script so that both of the shoulder buttons act as modifiers, although it's missing any setup for b10 since my mouse doesnt have a b10.

http://forum.pinguyos.com/Thread-HOWTO-Mouse-buttons-to-change-workspaces-in-gnome-shell?pid=26800#pid26800

Saturday, September 22, 2012 4:54:00 PM

 
Blogger Seattle Seahawks blog said...

I always like walking in the rain, so no one can see me crying.
http://blanchekao.wordpress.com/2014/09/02/sam-not-necessarily-about-rams-training-group/
http://blanchekao.fotopages.com/?entry=10836480
http://blanchekao.over-blog.com/article-sam-definitely-not-with-rams-process-team-124484272.html

Monday, September 01, 2014 11:58:00 PM

 
Anonymous erectile dysfunction causes said...

These are truly enormous ideas in on the topic of blogging. You have touched some fastidious things here. Any way keep up wrinting.

Tuesday, November 24, 2020 8:02:00 PM

 

Post a Comment

<< Home