diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | sbin/chksession | 25 |
2 files changed, 25 insertions, 2 deletions
@@ -1,5 +1,5 @@ # Use Mageia release as major and bump minor -VERSION = 6.2 +VERSION = 6.3 PACKAGE = desktop-common-data NAME = desktop-common-data TAG := $(shell echo "V$(VERSION)_$(RELEASE)" | tr -- '-.' '__') diff --git a/sbin/chksession b/sbin/chksession index a4b8d71..5efa42f 100755 --- a/sbin/chksession +++ b/sbin/chksession @@ -23,6 +23,8 @@ Usage: $0 [OPTION]... -d=DIR, --dir=DIR: Specifies a directory of w-m configuration files. Default is /usr/share/xsessions/ + -x=ENTRY, --xsession=ENTRY: Produce window-managers script of ENTRY. + -h, --help: Produce this help. EOF @@ -41,6 +43,8 @@ sub parse_file { # parse a session descriptor file my $n; local $_ = cat($fn); ($n = $1) =~ s| ||g if /^Name=(.*)/m; + my $e = $1 if /^Exec=(.*)/m; + $script{$n} = $e; push @lf, $n; ($order{$n}) = $fn =~ m/(^[0-9][0-9])/; } @@ -50,7 +54,9 @@ usage(1) while ($ARGV[0] =~ /^--/ || $ARGV[0] =~ /^-/) { local $_ = shift; - if (/^--first/ || /^-F/) { + if (/^--xsession=([^ ]+)/ || /^-x=([^ ]+)/) { + $xsession = $1; + } elsif (/^--first/ || /^-F/) { $first++; } elsif (/^--list/ || /^-l/) { $list++; @@ -82,6 +88,23 @@ my ($e) = eval { cat("/etc/sysconfig/desktop") } =~ /DESKTOP=(\S+)/; # Order of names in @lf is otherwise unchanged. @lf = sort { $b =~ /^$e$/i <=> $a =~ /^$e$/i } @lf; +if ($xsession) { + if ($script{$xsession}) { + print "#!/bin/sh\n"; + print $script{$xsession} + } else { + print "xterm -geometry 100x25+0+0 &\n"; + if ( -x '/usr/bin/icewm' ) { + print "icewm\n"; + } elsif ( -x '/usr/bin/twm' ) { + print "twm\n"; + } else { + print "xterm -geometry 67x14+384+446\n"; + } + } + exit (0); +} + @lf ? print shift @lf, "\n" : print "default\n" if $first; |