Computers 'n Stuff

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: , , , ,

Do you want to read on <<click

Saturday, June 02, 2007 parmanent link to this post

setup of the MX1000: .xbindkeysrc with xmacroplay



Binding mouse events of the thumbbuttens to XVkdb by xbindkeys kind of sucks. I makes Firefox freeze. Hers my new .xbindkeyrc using xmacroplay.

Ok, this is my .xbindkeysrc

# Backward and Forward buttons
# "xvkbd -text "\A\[Left]"" # freezes firefox and makes mouse cursor jump
"echo -e 'KeyStrPress Alt_L\nKeyStrPress Left\nKeyStrRelease Left\nKeyStrRelease Alt_L' | xmacroplay :0 &" #better
m:0x10 + b:8"
#"xvkbd -text "\A\[Right]""
"echo -e 'KeyStrPress Alt_L\nKeyStrPress Right\nKeyStrRelease Right\nKeyStrRelease Alt_L' | xmacroplay :0 &"
m:0x10 + b:9

the idea was stolen from Stephan Reichelt Nice Work!
Get xmacro sources and make. copy xmacroplay to /usr/bin. I couldn't find a Suse rpm for this.

Related Posts
MX1000 Setup
MX1000 setup part 2

Labels: , , , ,

Do you want to read on <<click

How the Logitech MX1000 setup works in OpenSuse 10.2

Some more information about the setup of the MX1000 lasermouse in OpenSuse. Its a guide to use lomoco and keybindings with xbindkeys in conjunction with xvkdb.




In Suse 10.2 udev detects the mx1000 with this ruleset found in:
/etc/udev/rules.d/40-lomco.rules

# "C-BN34",  "Receiver for MX1000 Laser"
BUS=="usb", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="046d", SYSFS{idProduct}=="c50e", RUN="/lib/udev/lomoco.sh"

Then it runs the script:

/lib/udev/lomoco.sh



This script takes options for smartscroll enable/disable and resolution from this cofnig file:

/etc/sysconfig/logitech_mouse


So this is probalby the place to modify the lomoco settings at boot time systems wide.
For keybinding you can use xbindkeys it is a package of OpenSuse and you don't need to compile and install lmwheels. Its not maintained any more from what I understand. But check yourself if in doubt. Create .xbindkeysrc in you homedir with

# 'xbindkeys --defaults > /home/yourhomedir/.xbindkeysrc'.


Now edit .xbindkeysrc and add the following lines:

# Application-toggle button
"xvkbd -text "\[Alt_L]\[Tab]""
m:0x10 + b:10
# Backward and Forward buttons
"xvkbd -text "\[Alt_L]\[Left]""
m:0x10 + b:8
"xvkbd -text "\[Alt_L]\[Right]""
m:0x10 + b:9

The .xbindkeyserc was stolen with modification from here So how it works is that xbindkeys traces the events you trigger by pressing keys. When it catches a defind event then it launches an application which is here above the respective event in the .xbindkeysrc. In our case of the mouse events it starts xvkbd which is a virtual keybord that sends keyboard events to the xserver you define behind the -text optons. you kould define any keystroke you like instead the events here. For lmwheels you could probably define different keystrokes depending on the application you use the mouse in if you need it The b:10 and b:8 and so on are the mouse events where the number is the event the mouse sends. Here I created a listo of events triggerd by the MX1000 buttons if you need to know which number you need to use. Now execute xbindkeys and test the key bindings.

When satisfied you can make an autostart entry in your KDE Atotstart folder to start xbindkeys each time you boot. To do so execute e.g.:

# ln -s `which xbindkeys` `kde-config --userpath autostart`
links to lots of mouse setup guides

Technorati Tags: , ,

Labels: , , , ,

Do you want to read on <<click

Friday, June 01, 2007 parmanent link to this post

Logitech MX1000 USB mouse configuration / setup for X11 in OpenSuse 10.2 linux

The MX1000 Lasermouse is supported pretty well by OpenSuse. It was just a little hard to find out what you need. Here I write how I did the setup of the MX1000







To support all mouse buttons of a modern USB mouse like the Logitech MX1000 lasermouse in X11 I use the evdev driver. This driver is compiled into X11 by Suse linux so you just need to activate that driver. To do this I first modified the /etc/X11/xorg.conf now it looks like:

Section "InputDevice"
Identifier "Mouse0"
Driver "evdev"
Option "evBits" "+1-2"
Option "keyBits" "~272-287"
Option "relBits" "~0-2 ~6 ~8"
Option "Pass" "3"
EndSection

The options are stolen from the man page of evdev and are said to work for virtually any mouse. forget all about these mapping and ZAxixMapping Options, they are not supported by evdev, Check the manpage. In some forums you can read to use Options protocoll evdev. But this is obsolete and only used for older veresions of evdev. However, the identifier Mouse0 is crucial I guess, since with another identifier like mouse[0] the xserver refused to start. My explaination is that is has to match the entry in /dev/input/mouse0. This entry (node) done by udev. The configuratin is probalbly done at installation of Suse. Sombody wrote that Suse 10.2 does not support evdev any more. I think this is not true. You don't need to load it as a kernel module. evdev is compiled into the Xorg server.

I use lomoco, to control the feaures of the MX1000 lasermouse. lomoco is installed per default, it can be used to incerase the resolution from 400dpi (default) to 800 dpi:
# lomoco -8
and to turn on/off smart scrolling

# lomoco --sms
# lomoco --no-sms
in Suse linux /etc/sysconfig/logitech_mouse holds the configruation file of the lomoco config scrip that is executed on detection of a logitech mouse to configure smart scrolling and resolution of Logitech mice at startup.


What happens when you hit a mouse key depends on the xevent that is triggered and translated by the application into action. The xev command can be used to decipher the events triggerd by the mouse buttons. these xevents are generated by the mouse depending on sms or no-sms (use
# xev
in a console to test):

button event with smart scroll event without smart scroll
left 1 1
wheel pressed 2 2
right 3 3
wheel up 4 4
wheel down 5 5
wheel tilt right 6 14
wheel tilt right release 14 n/a
wheel tilt left 7 13
wheel tilt right release 13 n/a
thujb back 8 8
thumb front 9 9
app change 10 10
smart scroll up 4(as long as hold down) 11
smart scroll up release 11 n/a
smart scroll down 5(as long as hold down) 12
smart scroll down release 12 n/a

this is a list of x events triggerd by the mousbuttens in different modes of the logitech mouse.
Intersitng to note that although the MX1000 is a 12 button mouse (10 button + two for the wheel) the mouse can generate 14 events. So actually these Options Buttons 12 you can find in many forums are probably wrong anyway.

Xmodmap is used to remap the events of the mouse to other events. This technique comes in handy when an application has a hard wired reaction to a mouse event, but you want to trigger that event by another moue button. So what xomodmap does is to translate one event to another and sends that event to the application instead of the original. For example you could use xmodmap to map the thumbbuttons 8 and 9 on xevents 7 and 8 by
# xmodmap -e "pointer = 1 2 3 4 5 8 9 6 7 10 11 12 13 14 15 16 17 18 19 20"
In this row the position of the digit is the value of original x event and the value is the new xevent that will be sent in case that event is trigged, in this matter
(digit at position 6 has the value 8) event 6 (tilt mouse wheel with smart scroll enableled) will be mapped to event 8 (thumb button) . Event 8 (thumb button) is now tranlated ot event 6 (tilt mouse wheel)
This above mapping is interesting since firefox can be configured to do horizontal scrolling or to scroll
forward and backward history on events 6 and 7 depending on the about:config settings when you don't need horizontal scrolling a lot. . This is the default setting (type about:config in the adress field of firefox to check, I used Firefox 2.0 here) which does history scrolling on events 6 and 7 , that are usually the events triggered by the horizontal mouse wheel in X11.
mousewheel.horizscroll.withnokey.action Standart Integer 2
mousewheel.horizscroll.withnokey.sysnumlines Standard boolean false
of course you can also do horziontal scrolling now with the thumb buttons if you like but you have to change Integer to 1 and boolean to true.

Other customizations of mouse xeve
nts that x applications do not recoginze by default can be done by imwheel or xbindkeys in combinatin with xvkdb or xbindkeys in combination with xmacroplay

imwheel : imwheel will directly translate mouse events to (virual) keystrokes (or xevents) that are sent to and recognized by the application. e.g. alt + left will scroll one item back in history of firefox and you can configure imwheel to sent this keystrokes to the application when the thumb buttons are pressed which are not recognized by default. The advantage of imwheels is that it can be configured to send different keystrokes when a different application is used and that it doesen't need helper applications.

xbindkeys: xbindkeys is usually used to execute applications when a key or a combination of keys is pressed.
This is usually referred to as keyboard shortcuts. The advantage over imwheels is that it is highly configurable. You can use chord keys with the mouse and you can change the keybindings on the fly. With the mouse it can be used to execute an application that itself sends (virtual) keystrokes (or xevents) to an application similar to imwheel. Applications that are capable of sending virual keystrokes would be xvkdb and xmacroplay. I prefer to use xmacroplay since it is lightwight, quicker and causes less overhead when mouseevents are triggered in rapid fashion.

Related Posts:

MX1000 Lasermouse

Usefule mouse setup links
:
linklinst of Lots of linux mouse setup guides:



Labels: , , , , , ,

Do you want to read on <<click