Trying to configure the GotoDesk command

I’m trying to help out a user who does not have Button 2, so can’t use it in his FvwmPager to change the active desktop. (I’m happy to be told how to emulate Button 2.) I figured, “Okay, maybe I can bind keys for him so he can execute the GotoDesk command.”

I’m just a dumb FVWM user myself, so my first guesses haven’t worked. I thought this would allow the arrow keys to go left/right and up/down (I have a 3x3 grid of desktops) while pressing either Alt key, but it didn’t work:

Key Right A M GotoDesk 1
Key Left A M GotoDesk -1
Key Up A M GotoDesk -3
Key Down A M GotoDesk 3

I got some occasional flashing in Chrome, which suggested to me that the window manager wasn’t intercepting the key presses. I quit Chrome and tried again. Now my Emacs session (last app which had focus) saw the key presses. I reread the GotoDesk doc, then tried this instead:

Key Right A M GotoDesk 1 0 0 9
Key Left A M GotoDesk -1 0 0 9
Key Up A M GotoDesk -3 0 0 9
Key Down A M GotoDesk 3 0 0 9

Am I correct in thinking that “Right A M” should direct FVWM to execute the named GotoDesk command in any context when I hold down the Alt key while pressing the right arrow key?

Perplexedly y’rs,

Skip

Mysterious is what you are reporting.
To switch Desktops one needs nothing but mouse button 1. Button 2 (you mean the middle button?) is used in the pager to move windows. Maybe you have (your friend has) an exotic configuration!? Can you use the other desktops with a 3-button mouse? Can you switch them by direct command input, e.g. in FvwmTalk: “GotoDesk 1” or “GotoDesk 0 1”
Your key commands in the first variant should be correct. The second variant assumes 10 rather than 9 desktops, they should range 0-8. Are you using FVWM in a special Desktop Environment that processes key events specially? Or is there just a syntax error in your configuration file? Or is your configuration file not seen by FVWM, maybe in the wrong place?

Sorry that I have only questions and no answers.
Tronar

So, I got mixed up, conflating two issues. (If you knew me, you’d know that’s not unusual.) For now, I am mostly interested in the lack of a middle mouse button, and the inability to rebind something else. It appears that my Xorg doesn’t have Emulate3Button mouse set to “true” (or “on”, or “yes”). When I drag the mouse using the button-one-plus-three-as-two trick, it pans the viewport, then snaps it to the virtual desktop under the mouse when I release them.

So perhaps it’s just an X11 config thing? I haven’t followed Xorg configuration changes over the years. I have an /etc/X11/xorg.conf file with an InputDevice section for the mouse which turns on three button emulation:

Section “InputDevice”
# generated from data in “/etc/sysconfig/mouse”
Identifier “Mouse0”
Driver “mouse”
Option “Protocol” “IMPS/2”
Option “Device” “/dev/input/mice”
Option “Emulate3Buttons” “yes”
Option “ZAxisMapping” “4 5”
EndSection

However, in /etc/X11/xorg.conf.d/11-mouse.conf I see many InputClass sections, three of which have Emulate3Buttons set to “on”. How do I know what Xorg is using? Reading the xorg.conf man page the order of possible config file locations suggests that it should be using /etc/X11/xorg.conf. So, is Emulate3Buttons not really a thing anymore, or is it broken in some way? Running xev and pressing button 1+3 seems not to register as a button 2 press:

ButtonPress event, serial 39, synthetic NO, window 0x2a00001,
root 0x25f, subw 0x0, time 3273481664, (115,92), root:(1626,931),
state 0x0, button 3, same_screen YES

ButtonPress event, serial 39, synthetic NO, window 0x2a00001,
root 0x25f, subw 0x0, time 3273481687, (115,92), root:(1626,931),
state 0x400, button 1, same_screen YES

ButtonRelease event, serial 39, synthetic NO, window 0x2a00001,
root 0x25f, subw 0x0, time 3273481855, (115,92), root:(1626,931),
state 0x500, button 3, same_screen YES

ButtonRelease event, serial 39, synthetic NO, window 0x2a00001,
root 0x25f, subw 0x0, time 3273481863, (115,92), root:(1626,931),
state 0x100, button 1, same_screen YES

Looking at the mouse(4) man page, I see there is an Emulate3Timeout, but it defaults to 50ms, and the interval between the presses and releases about is no more than 23ms.

I must be missing something else about three-button emulation.

So, I got mixed up, conflating two issues. (If you knew me, you’d know that’s not unusual.)

Well, first of all I noticed that you have hardly answered any of my questions.

So perhaps it’s just an X11 config thing?

Does any of your configuration files in /etc/X11/xorg.conf.d set “Emulate3Buttons” to “false”/“no”/“off”? If yes, change it; in any case (even though you changed it) insert into the InputClass section the Option explicitly once more]
Option Emulate3Buttons true
[/code]The InputClass that refers to your mouse is the one labeled “bla pointer blabla”.

None of the InputClass definitions explicitly sets Emulate3Buttons to off/false/no. I’m off today, so we’ll try the rest tomorrow.

I added:

Option  "Emulate3Buttons"    "on"

to each InputClass in 11-mouse.conf which looked like a mouse (not a trackball) to me. I don’t know what “bla pointer blabla” referred to. The only instances I saw of the string “pointer” (case-insensitive) were:

MatchIsPointer	"on"

In /etc/X11/xorg.conf I saw a different reference in the ServerLayout section:

InputDevice    "Mouse0" "CorePointer"

That seems to reference the InputDevice section I mentioned before:

Section "InputDevice" # generated from data in "/etc/sysconfig/mouse" Identifier "Mouse0" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/input/mice" Option "Emulate3Buttons" "yes" Option "ZAxisMapping" "4 5" EndSection
On the outside chance that the quotes weren’t supposed to be there, I replaced the above Emulate3Buttons option with

Option         Emulate3Buttons on

but that only caused the system to hang when I logged out.

First: The Xorg configuration includes /etc/X11/xorg.conf and the files in /etc/X11/xorg.conf.d and /usr/share/X11/xorg.conf.d, if you have all these non-empty. Don’t forget to consider all of these.
Secondly: Xorg input ist configured either by using HAL and various InputClass directives in any of the above configuration files, that’s the default, - or without HAL and by one or more InputDevice sections. HAL is disabled like this] Option “AutoAddDevices” “False”
Option “AutoEnableDevices” “False”[/code]Only in the latter case InputDevice is taken into account, in the former it is ignored. So, decide which of both ways you are using (or want to use, I recommend HAL). If HAL, then remove the InputDevice section and add the contents to one or more of the existing InputClass’es.

With my “pointer blabla” I was referring to one of the InputClass’es with a line similar to Identifier "evdev pointer catchall" so what you did was fine. And it should make exactly no difference whether you set an option to “yes” or “on”, the hang must have another reason.

Thanks @Tronar. Grep didn’t find “Auto” in any config file I could find. Given the ordering of the search, I suspect that the InputDevice section I referenced earlier is what’s active. However… Is there a log file somewhere in which the server states at startup, “this is my definition for the mouse” (or keyboard, etc)? I’m still a little bothered by the fact that I don’t seem to be able to get Emulate3Buttons to work.

If Emulate3Buttons is enabled, should xev show Button 2 events when I press and release Buttons 1+3 together? Or will it continue to log individual presses and releases for the separate buttons?

Argh, you did not understand what I said: Only when you have set the above “Auto” options to false, Xorg will take the InputDevice section into account. So, delete InputDevice! You must use InputClass as long as HAL is in use!
The log file for the X server is usually /var/log/Xorg.0.log and will indeed provide detailed information about mouse/pointer devices.
For your last question I would have to create an xorg.conf and restart my desktop, which I don’t want now. But I’m very sure that xev must show button 2 also in the emulated case as “Button 2”.
I’m repeating myself, but it might be useful to know whether you are using a plain FVWM or some special desktop environment. And maybe also the type of your Linux distribution.

Thank you for that clarification. I will pass that info along to our admins.

And that clinches it:

[3122507.743] (**) Logitech USB-PS/2 Optical Mouse: Applying InputClass "evdev pointer catchall" [3122507.743] (**) Logitech USB-PS/2 Optical Mouse: Applying InputClass "evdev pointer catchall"

I believe our admins were unaware of the /usr/share/X11 location. In talking to them, it seems they thought all the config file searching happened in /etc/X11. I will disabuse them of that notion. Or at least get them to simplify things so that catchall definition occurs earlier in the search path.

Finally, I am somewhat embarrassed to say that I completely forgot to mention one other (as it turns out) critical thing. I use Synergy, and my keyboard/mouse server (blade) is not the device I have been tweaking (firefly). Now that I have the config setup properly, using the mouse physically attached to firefly, I do get proper button 2 emulation. That is not the case when I use the mouse connected to blade with the pointer exposed on firefly’s display.

Right you are:

[code]ButtonPress event, serial 42, synthetic NO, window 0x1a00001,
root 0x25f, subw 0x0, time 69058375, (89,79), root:(643,1160),
state 0x0, button 2, same_screen YES

ButtonRelease event, serial 42, synthetic NO, window 0x1a00001,
root 0x25f, subw 0x0, time 69058575, (89,79), root:(643,1160),
state 0x200, button 2, same_screen YES[/code]

I don’t know “plain” from “fancy” FVWM, though I suspect it’s pretty plain. I’m using whatever our admins have provided. IT management dictated that the users I support must use FVWM, so I do as well, though essentially no other developers in our company do. Our Linux environment is behind-the-curve. Our desktops run openSUSE 12.2. Here are the basics as reported by zypper info:

Repository: os122-oss Name: fvwm2 Version: 2.6.4-2.1.2 Arch: x86_64 Vendor: openSUSE Installed: Yes Status: up-to-date

Okay, I had to google to get to know what is Synergy (a virtual mouse), Blade (a server hardware) and Firefly (actually a USB mouse). One mouse is connected to your Blade server, one (Firefly) to your desktop PC. You use Synergy to forward the mouse events from the Blade to the PC, so your PC has actually two mice, a local and a virtual one. Did I understand this correctly?
Emulate3Buttons only works for the local mouse, not the Synergy mouse. If at all, you have to enable this option on the server to get it working for its mouse. If Synergy then forwards the emulated button-2 events to the client or not, depends on wheter it collects the events in X11 or on a lower level. I don’t know - try it!
Having two mice should not be a problem on your PC; Xorg can handle this without conflicts. On the other hand Synergy is not a normal mouse … If you experience further problems or crashes, try disconnecting your local Firefly and work with the server’s mouse only.

By “plain FVWM” I meant that you just start FVWM in your X session and not one of those fancy desktop environments like KDE, GNOME, XFCE etc. with FVWM replacing their native window manager. For some of them it’s possible but might exhibit compatibility problems. I think this is not relevant for you.

Not quite. My two desktop computers are named “blade” and “firefly”. :slight_smile: The admins name machines when they are put into production. (I have no idea what was running through their collective heads when they configured these boxes, but it’s definitely better than the previous naming scheme, e.g., “udesktop312”.) Blade runs the Synergy server, Firefly runs the client. Except when first logging in, I don’t use Firefly’s keyboard and mouse.

If you have multiple computers (and thus multiple keyboards and mice), I do recommend Synergy. It’s really quite handy. It even runs cross-platform, so you can use a single keyboard and mouse across Windows, Mac, Linux, and other Unix variants (works fine on Solaris, for example).

[quot]Emulate3Buttons only works for the local mouse, not the Synergy mouse.
[/quote]
Yes. I had been experimenting on Firefly’s configuration, but mindlessly continuing to use Blade’s Synergy-powered keyboard and mouse. Once it dawned on me that Synergy was probably operating with Blade’s Xorg config, I switched to use Firefly’s mouse. With your help, I got Emulate3Buttons working on Firefly using its mouse. I then observed that it didn’t work on Firefly if I was using Blade’s mouse (with the pointer moved over to Firefly’s screen). I updated the settings on Blade’s Xorg config as discussed earlier. After logging back in on Blade, the Synergy-controlled mouse exhibited Emulate3Buttons properties whether the pointer was on Blade’s screen or Firefly’s. So I am now in business.

Correct. Nothing fancy in operation here. Just plain old FVWM.

Thanks for all your help. I apologize that it took me so long to figure things out, mostly a reflection of how I was approaching the problem, and the things I completely forgot about (like Synergy) or was unaware of (like HAL and /usr/share/X11).

“blade” and “firefly” are just names!! :confused:
Okay, nice to know that all problems could be solved. And thanks for the recommendation of Synergy, I think this comes in handy for my Raspberry Pi. :wink:
Have a nice time!

None of the InputClass definitions explicitly sets Emulate3Buttons to off/false/no. I’m off today, so we’ll try the rest tomorrow.

Uhmmm … what?
You mean the things that were discussed here one year ago?

Emulate3Buttons is probably off by default and has to be enbaled on purpose.

Regards, T.

None of the InputClass definitions explicitly sets Emulate3Buttons to off/false/no. I’m off today, so we’ll try the rest tomorrow. :slight_smile: