--- /dev/null
+#!/usr/bin/perl
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+
+use File::Spec::Functions;
+use File::Basename;
+use Config::IniFiles;
+
+my $session_dir = '/etc/X11/Sessions';
+my $back_title = 'Auswahl der X-Umgebung';
+my $menu_title = 'Wählen Sie bitte eine X-Umgebung aus:';
+
+my $inifile = catfile( $ENV{'HOME'}, '.dmrc' );
+my $default = undef;
+
+if ( -f $inifile ) {
+ my $cfg = new Config::IniFiles( -file => $inifile, '-nocase' => 1, );
+ $default = $cfg->val( 'Desktop', 'Session' );
+}
+
+my ($session_file);
+my @SessionsArray;
+my $max = length($menu_title) + 3;
+my ( $height, $items );
+
+for $session_file ( glob( catfile( $session_dir, '*' ) ) ) {
+
+ next unless -f $session_file and -x $session_file;
+
+ my $session_name = basename($session_file);
+ my $session_title = basename($session_file);
+
+ if ( $session_name =~ /^Gnome$/i ) {
+ $session_title = "Gnome-Desktop-Umgebung";
+ }
+ elsif ( $session_name =~ /^kde-(\d\.\d)$/i ) {
+ $session_title = "KDE-Desktop " . $1;
+ }
+ elsif ( $session_name =~ /^wmaker$/i ) {
+ $session_title = "Windowmaker-Desktop";
+ }
+ elsif ( $session_name =~ /^Xsession$/i ) {
+ $session_title = "Standard X-Desktop";
+ }
+
+ push @SessionsArray, $session_name;
+ push @SessionsArray, $session_title;
+
+ my $length = length($session_name) + length($session_title) + 2;
+ $max = ( $length + 9 ) if ( $length + 9 ) > $max;
+
+}
+
+$items = int( scalar(@SessionsArray) / 2 );
+$height = $items + 7;
+
+my @DialogArgs = (
+ '--stdout',
+ '--backtitle',
+ $back_title,
+ '--menu',
+ $menu_title,
+ $height,
+ $max,
+ $items,
+ @SessionsArray,
+);
+
+if ( $default ) {
+ unshift @DialogArgs, $default;
+ unshift @DialogArgs, '--default-item';
+}
+
+my $cmd = '/usr/bin/dialog "' . join( '" "', @DialogArgs ) . '"';
+
+print $cmd . "\n";
+
+exit 0;
+
--- /dev/null
+#!/usr/bin/perl
+
+# $Id$
+# $URL$
+
+use strict;
+use warnings;
+
+use File::Spec::Functions;
+use File::Basename;
+use Config::IniFiles;
+
+my $session = shift;
+
+return 1 unless $session;
+
+my $inifile = catfile( $ENV{'HOME'}, '.dmrc' );
+
+unless ( -f $inifile ) {
+ unless ( open INI, ">>", $inifile ) {
+ die "Konnte '" . $inifile . "' nicht erzeugen: " . $! . "\n";
+ }
+ print INI <<ENDE;
+[Desktop]
+Session=uhu
+Language=de_DE.UTF-8
+ENDE
+ close INI;
+ chmod 0600, $inifile;
+}
+
+my $cfg = new Config::IniFiles( -file => $inifile );
+$cfg->SetWriteMode('0600');
+$cfg->AddSection('Desktop') unless $cfg->SectionExists('Desktop');
+$cfg->newval( 'Desktop', 'Session', $session );
+$cfg->RewriteConfig() || exit 5;
+
+exit 0;
+
--- /dev/null
+#!/bin/sh
+
+# $Id$
+# $URL$
+
+TMPFILE=`mktemp` || exit 5
+
+PL_SCRIPT=`dirname $0`"/get-sessions-dialog.pl"
+echo ${PL_SCRIPT}
+SET_PL_SCRIPT=`dirname $0`"/set-default-session.pl"
+echo ${SET_PL_SCRIPT}
+
+DIALOG_CMD=`${PL_SCRIPT}`" >${TMPFILE}"
+echo ${DIALOG_CMD}
+
+eval ${DIALOG_CMD}
+RES=$?
+
+if [ "${RES}" != "0" ]; then
+ rm -f $TMPFILE
+ exit ${RES}
+fi
+
+echo
+echo
+echo
+cat $TMPFILE
+echo
+
+#ls -l $TMPFILE
+#rm -f $TMPFILE
+#exit 0
+
+
+XSESSION=`cat ${TMPFILE}`
+${SET_PL_SCRIPT} ${XSESSION}
+#export XSESSION
+rm -f $TMPFILE
+
+echo XSESSION=$XSESSION startx
+XSESSION=$XSESSION startx
+
+