aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/chksession
diff options
context:
space:
mode:
authordaviddavid <geiger.david68210@gmail.com>2016-08-23 17:59:40 +0200
committerdaviddavid <geiger.david68210@gmail.com>2016-08-23 17:59:40 +0200
commit46e66c480c4447e014c51e7283f24186e4978a62 (patch)
tree3403d06549a5983e3c35dd427eb3a8f323757ce9 /sbin/chksession
parent14ef24332e653eb8e6a7eacf00ed0091e517fc3a (diff)
downloadcommon-data-46e66c480c4447e014c51e7283f24186e4978a62.tar
common-data-46e66c480c4447e014c51e7283f24186e4978a62.tar.gz
common-data-46e66c480c4447e014c51e7283f24186e4978a62.tar.bz2
common-data-46e66c480c4447e014c51e7283f24186e4978a62.tar.xz
common-data-46e66c480c4447e014c51e7283f24186e4978a62.zip
fix chksession from David Walser (mga#17617)6.3
Diffstat (limited to 'sbin/chksession')
-rwxr-xr-xsbin/chksession25
1 files changed, 24 insertions, 1 deletions
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;