2010, July 08 (Thu) | |
Linux – Multiseat hacks (gnome gdm) | |
---|---|
I have two screens connected to a powerful box. Mostly, I’m using these for coding and it’s running Xinerama with radeon (sssh don’t say anything). Only sometimes however, I would like to share the machine with a second user. There are several recommended ways for multiseat setup:
Furthermore, you need to fiddle with the login manager to do everything “right”. As my setup is more temporary, I opted for a middle way. It remains not without rough edged though… The main login remains running on two screens, and in the case of wanting to share, I will set up a Xephyr instance on one monitor. Because of Xinerama, Xephyr doesn’t work out of the box like that. So I chose a small hack: I open an empty xterm (which has the netwm ability to go to fullscreen) and embed the Xephyr in it:
move the xterm window to the second monitor and switch it to fullscreen… I am using Gnome and have assigned a keybinding for that. That way, Xephyr will be running “full screen” on just one monitor, something that it isn’t able to do on its own (Xephyrs fullscreen would expand over both monitors due to Xinerama) Now we need to start the Xephyr and allow the login for the other account. Again, we have two possibilities. One is to use the xdmcp mode of gdm, and another to use gdmflexiserver — the Gnome user switcher. Update: I can’t get the SCIM input method editor to work with xdmcp… anyone knows why? So I’ve resorted to the gdmflexiserver one for now. For the xdmcp, we need to enable it. For example, in SuSE, set For the gdmflexiserver approach on the other hand, it is necessary to replace The wrapper script or First, we define the devices which we want to give the Xephyr use:
These are examples from my box, the Razer is a mouse and the strange keyboard is a cheap Cherry one — who knows why they can’t afford to brand its ID. Look in Now construct the real paths and add some checks to see if the devices are connected: mouse=/dev/input/by-id/usb-${mouse}-event-mouse keybd=/dev/input/by-id/usb-${keybd}-event-kbd if [[ -h $keybd && -h $mouse ]] { only in the Xorg case, we now loop over all available displays and find the first one which has a empty xterm window created as outlined above, to plant the Xephyr into: for ((disp=0;disp<$((${DISPLAY#*:}+0));++disp)) { in the wrapper case, we set the dummy disp variable instead disp=$((${DISPLAY#*:}+0)) finally, we locate the empty window using xwininfo and the OIFS=$IFS; IFS=$'\n' winin=($(DISPLAY=:$disp xwininfo -name Xephyr -children)); IFS=$OIFS if [[ $winin[1] == 'xwininfo: Window id: '*' "Xephyr"' && \ $winin[4] == ' 1 child:' && \ $winin[5] == *' (has no name): ()'* ]] { winid=($=winin[1]) if [[ $winid[4] == 0x* ]] { fontsdir=(/usr/share/fonts/*(/)) Xephyr doesn’t seem to know about the default fonts, so we construct a fontsdir here, might need to adjust this to your local site font dirs. Now for the start command. In case of the Xorg replacement for use with gdmflexiserver, it is important to get rid of the exec env DISPLAY=:$disp Xephyr -zap -retro \ -mouse evdev,,,device=$mouse \ -keybd evdev,,device=$keybd,xkbmodel=evdev \ -fp ${(j:,:)fontsdir} -parent $winid[4] \ ${@:#-verbose} for the wrapper script, we use the exec gnomesu -- Xephyr -zap -retro \ -mouse evdev,,,device=$mouse \ -keybd evdev,,device=$keybd,xkbmodel=evdev \ -fp ${(j:,:)fontsdir} -parent $winid[4] \ -once -query $@ just finish all the open blocks now… } } } however, in the Xorg replacement script, we will want to fall back to the real Xorg when we haven’t prepared any special window for Xephyr: } exec Xorg.old $@ As you can see, we moved With the wrapper script, just save it somewhere. You can then call it like this: ./xephyr-xdmcp 127.0.0.1 :3 Where 127.0.0.1 means your local host which you are going to query using xdmcp and :3 is a free display number for Xephyr to listen on. An outstanding trouble I’m having in both cases is with the Gnome keyboard-properties tool which will set the keyboard layout upon login. Since it needs a different layout — evdev layout in the case of Xephyr, and local connected keyboard layout in the case of plain X, it will break the keyboard layout directly after login. So far the only workaround is to rightclick on the desktop, “Open Terminal” and type in the command setxkbmap -model evdev before you can start working proper in the Xephyr instance. Maybe someone can come up with a better fix? |
|
Continue reading “Multiseat hacks (gnome gdm)” » | |
Navigation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
« | (older) | (newer) | » | |||||||
« | June 2010 | « | Main | ‹ | All articles list (Archives) | › | Search | » | August 2010 | » |