You are not logged in.

#1 2003-11-28 00:14:44

Pentadrago
Member
From: Germany
Registered: 2003-11-24
Posts: 16

script for automatically adding GDM sessions

Hi,
I installed AL 2 weeks ago and ran into the problem that I needed a lot of time to find out how the sessions of gdm are configured.
it needs one *.desktop file to every DM that it should start.

because I like trying different desktops I started to write a little script that checks for installed desktops and adds them to the gdm-session (in the same time it checks if there are entries for desktops that are no longer on the system and removes them)

#! /bin/bash

. functions

sessiondir=/opt/gnome/etc/dm/Sessions/
srcdir=Sessions/
paclist=`pacman -Q`

# this function uses two parameters 
# first the name that is printed and the desktop-file-name is based on
# second the package-name in the pacman-output, which identifies the DM
check () {
    check=`echo $paclist | grep $2' '`
    if [ "${#check}" -gt 0 ]
    then
        if [ ! -e $sessiondir$1.desktop ]
        then
            stat_busy "configuring $1"
            cp $srcdir$1.desktop $sessiondir$1.desktop
        else
            stat_ok $1
        fi
    else
        if [ -e $sessiondir$1.desktop ]
        then
            stat_busy "removing $1"
            rm $sessiondir$1.desktop
        fi
    fi
}

# calls the method
#check     AeWM++         aewm++
check     Blackbox     blackbox
check     Enlightenment     enlightenment
#check     EvilWM         evilwm
check     Fluxbox     fluxbox 
check     FvWM         fvwm
check     Gnome         gnome
check     Hackedbox     hackedbox
check     IceWM         icewm
#check    ION        ion
check     KDE         kdebase
#check     Openbox     openbox
#check     PekWM         pekwm
#check     PWM         pwm
#check     Ratpoison     ratpoison
check     Waimea         waimea
check     Windowmaker     windowmaker
check     Xfce         xfce
check     Xfce4         xfwm4

I use a copy of the /etc/rc.d/functions because I needed an stat_okay-function, don't know if there is a more complete function-lib on AL or it's possible to add a function like this

I commented out the wms I don't believe to be important in a gdm-list,  I think they are used as alternative to the wm of gnome or kde or fluxbox etc and would only make the session-list too large

please tell me if I'm wrong

the next points would be integration of other *dms (like kdm, xdm etc) and perhaps the localisation of the desktop-files (the "Gnome.desktop" seems to be complete ;-), I just copied a few of the files from a slackware-server and modified them (slackware uses the /etx/X11/Xsession for starting dms) but they contain way fewer information than the gnome one

I uploaded a tar-package called gdm-session-config.tar.bz2 containing the script, the functions snd the session-files on incoming

UPDATE:

- optimization of the script (write pacman-output to file, use exit-code)
- upload new version to gdm-session-config-0.2.tar.bz2

#! /bin/bash

. functions

destdir=/opt/gnome/etc/dm/Sessions/
srcdir=Sessions/
installedList=installed.lst
pacman -Q > $installedList

# this function uses two parameters 
# first the name that is printed and the desktop-file-name is based on
# second the package-name in the pacman-output, which identifies the DM
check () {
    grep $2' ' $installedList > /dev/null
    if [[ $? == 0 ]]
    then
        if [ ! -e $destdir$1.desktop ]
        then
            stat_busy "configuring $1"
            cp $srcdir$1.desktop $destdir$1.desktop
        else
            stat_ok $1
        fi
    else
        if [ -e $destdir$1.desktop ]
        then
            stat_busy "removing $1"
            rm $destdir$1.desktop
        fi
    fi
}

Before we could talk we were singing,
before we could run we were dancing.
"On Earth" by Samael

Offline

Board footer

Powered by FluxBB