Extra settings of GDM

This page is about extra settings of GDM for multiseat. You do not know what multiseat is? These extra settings are not vital when running multiseat but can ease its use. So, here you will find:

Disabling ‘Shutdown’ action

Because in GNOME menu, the item Shutdown is near item Logout, it is very reasonable to delete Shutdown (and Reboot) items form the menu (sometimes, someone “misclicked” and instead of logout – to great joy of the user at the second seat – shut down the computer). This can be done via editing registry of GNOME and also by disabling it in GDM itself:

[daemon]
HaltCommand=
SuspendCommand=

(when the command for power-off do not exist, we would hardly use them to shutdown).

However, it might be useful to allow the shutdown. To do this, just add shutdown as custom action. I have added also commands for switching between single and dualseat (plus you might add more descriptive text via options CustomCommandTooltip and CustomCommandText):

[customcommand]
CustomCommandLabel0=Power off
CustomCommand0=/sbin/poweroff

CustomCommandLabel1=Runlevel 3
CustomCommand1=/sbin/telinit 3

CustomCommandLabel2=Single-seat
CustomCommand2=/usr/local/sbin/mseat-switcher single

CustomCommandLabel3=Multi-seat
CustomCommand3=/usr/local/sbin/mseat-switcher multi

Switching between multi- and single-seat

Although the target was to share the computer among more users, sometimes it might me more useful to allow only one user use the computer (sophisticated applications or extended desktop over several monitors). But hand-made changes to configuration file always bring some kind of danger so I wrote a very simple script that changes GDM settings to reflect new settings as single/multi seat.

The only thing that has to be done is to add above each line that we would like to change (change = (un)comment) commented identifier that we later pass to the script as an argument.

Notice: this script uses GNU extension of sed to allow in-place editing of the file (-i argument).

Excert from the /etc/gdm/custom­.conf:

[servers]
...

#mseat:single
#0=Single

#mseat:multi
0=Std
#mseat:multi
1=Seat0
#mseat:multi
2=Seat1

Script /usr/local/sbin/mse­at-switcher:

#!/bin/sh

# script to switch between single seat (normal setup) and
# multiseat setup
# usage: $0 single|multi
#


config="/etc/gdm/custom.conf"
postcmd="/usr/sbin/gdm-safe-restart"

mode="$1";

[ "$mode" != "single" ] && [ "$mode" != "multi" ] && exit 1;




[ -w "$config" ] || exit 2;

if [ "$mode" = "single" ]; then
    sed -e '/^#mseat:multi[ \t]*$/{N;s/\n\([^#]\)/\n#\1/}' -e '/^#mseat:single[ \t]*$/{N;s/\n[ \t]*#[#]*/\n/}' -i "$config";
fi
if [ "$mode" = "multi" ]; then
    sed -e '/^#mseat:single[ \t]*$/{N;s/\n\([^#]\)/\n#\1/}' -e '/^#mseat:multi[ \t]*$/{N;s/\n[ \t]*#[#]*/\n/}' -i "$config";
fi

$postcmd

exit 0

Screensaver and background picture

Because I do not want the screen of GDM to be static, I decided to add a screensaver launch. However, that brought another problem – when GDM launches a program in the background (that do not have to be a screensaver only – you can use Conky for example) you cannot use themes but only select a color scheme. That is pretty boring so I wrote a script that sets up background picture and then stats the saver.

You have to add this to /etc/gdm/custom­.conf

[greeter]
BackgroundType=0
BackgroundColor=#b1b1b1
PositionY=100
PositionX=100
BackgroundProgram=/var/gdm/greeter.sh
BackgroundProgramInitialDelay=0
BackgroundProgramRestartDelay=0
RestartBackgroundProgram=true
SetPosition=true

Of course, there is nothing special in this – there is only one small problem with launching of the saver because it is running under gdm user and has to be configured for him. To do this you have first to enable logging in of gdm user. After setting up I recommend to turn off the possibility to login as gdm.

Script also recognizes on which screen it is running and accordingly displays the background picture: thanks to this I can use two concuring images (originally a widescreen photo).

#!/bin/sh

case $DISPLAY in
    :1) bg="/pub/images/bgleft.jpg";;
    :2) bg="/pub/images/bgright.jpg";;
    *) bg="/pub/images/bg.jpg";;
esac
hsetroot -center "$bg" &

/usr/bin/xscreensaver

Page was last changed on April 27, 2008 at 7:49 pm

Created by Vojtech HorkyXHTML & CSS valid •