Now let's have a look on the relevant part of gdm.conf:
[daemon]
Greeter=/etc/multiseat/scripts/multiseat-greeter
Greeter=/etc/multiseat/scripts/multiseat-greeter
[server-Xinerama]
name=Xinerama
command=/usr/bin/X -br -dpms -s 0
handled=false
flexible=false
[server-Xephyr]
name=Xephyr
command=/etc/multiseat/scripts/Xephyr-seat
handled=true
flexible=false
name=Xinerama
command=/usr/bin/X -br -dpms -s 0
handled=false
flexible=false
[server-Xephyr]
name=Xephyr
command=/etc/multiseat/scripts/Xephyr-seat
handled=true
flexible=false
This is achieved with the help of 2 programs: xwininfo and wmctrl. The wmctrl, among other things, can position a window in an X server. The option -v tells it to be verbose. The option -i tells it that the window on which the action is to be taken will be specified by a numeric ID (hexadecimal). The option -e tells the window to resize and/or move to a specified place, this option's arguments are: window gravity (0), x, y of the new position, w, h of the new window dimensions (-1 to keep old values). As we can see to make wmctrl do the job for us we need to know two pieces of information: 1) which window to operate on and 2) where to move the window to. The 2) will be obtained from the config file. We will come back to it later when we talk about integration with udev. And to get 1) we will use xwininfo.
Remember the Xauthority? It comes in handy again. Here is the story. xwininfo can query an X server, for example to get a list of the root window's children. The children of our main [server-Xinerama] X happen to be the Xephyrs. But the X server will not tell its secrets to anyone, but only to those who authenticate themselves properly - our friend Xauthority will handle this. The option -root tells xwininfo to use the X root window as the target window. The option -children tells it to list the target window children. The option -display specifies the DISPLAY to use. As a result something on the lines of the below is returned:
xwininfo: Window id: 0x1fc (the root window) (has no name)
Root window id: 0x1fc (the root window) (has no name)
Parent window id: 0x0 (none)
2 children:
0x400002 "Xephyr on :2.0 (ctrl+shift grabs mouse and keyboard)": ("Xephyr" "Xephyr") 1920x1080+0+0 +0+0
0x200002 "Xephyr on :1.0 (ctrl+shift grabs mouse and keyboard)": ("Xephyr" "Xephyr") 1280x1024+0+1080 +0+1080
Root window id: 0x1fc (the root window) (has no name)
Parent window id: 0x0 (none)
2 children:
0x400002 "Xephyr on :2.0 (ctrl+shift grabs mouse and keyboard)": ("Xephyr" "Xephyr") 1920x1080+0+0 +0+0
0x200002 "Xephyr on :1.0 (ctrl+shift grabs mouse and keyboard)": ("Xephyr" "Xephyr") 1280x1024+0+1080 +0+1080
We use grep to extract the line corresponding to the Xephyr we are moving and with cut (or awk) we extract the numerical window ID. Armed with this information we can use wmctrl. Again, it can operate on windows in a specified X, so we need to tell it which, and we do it by specifying the DISPLAY 0 and, of course, Xauthority of the [server-Xinerama]. After wmctrl has moved the Xephyr we can start the greeter program inside it. In GNOME this is /usr/lib/gdm/gdmgreeter.
Now the time has come to talk about the promised single configuration file common for relevant udev parts and for the multiseat setup. Stay tuned.
Brak komentarzy:
Prześlij komentarz