diff options
Diffstat (limited to 'bin/DrakWM')
-rwxr-xr-x | bin/DrakWM | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/bin/DrakWM b/bin/DrakWM deleted file mode 100755 index 2af7b18..0000000 --- a/bin/DrakWM +++ /dev/null @@ -1,132 +0,0 @@ -#!/usr/bin/perl -# -*- Mode: cperl -*- -# Copyright (C) 2000 by Chmouel Boudjnah <chmouel@mandrakesoft.com>, -# MandrakeSoft Inc. -# Redistribution of this file is permitted under the terms of the GNU -# Public License (GPL) -# $Id$ -###################### -# Description: Launch window manager according to -# /etc/X11/window-manager with various options. - -use Getopt::Long; - -my ($wm, $command, $window_mgr_file); -my (@lf); - -my @getopt_args = ('l|list-active-session', - 'i|xinit', - 'a|alias', - 'm|window-manager-file=s', - 'g|with-file-manager=s', - 'p|picture=s', - 'x|with-xterm', - 'h|help', - 'F|fallback', - ); -GetOptions(\%options, @getopt_args) || usage(1); -usage() if $options{h}; - -$window_mgr_file = $options{'m'} ? $options{'m'} : '/etc/X11/window-managers'; -die "$window_mgr_file don't exist\n" unless -r $window_mgr_file; -parse_file($window_mgr_file); - -if ($options{l}){ - print "\t\t\tActive Sessions:\n"; - list_sessions(); - exit(0); -} - -if ($options{a}) {print "alias $_=\'$0 -i $_\';" for @lf; exit 0;} - -unless ($ARGV[0]) { - print STDERR "\n\t\tYou need to specify a Window Manager\n\n"; - usage(1); -} else { $wm = $ARGV[0] } - - -if (!$exec{$wm} && !$options{F}) { - print STDERR "I can't find an entry for $wm\n"; - print STDERR "This is the list of active sessions:\n\n"; - list_sessions(1); - print STDERR "\nVerify your installation or adjust $window_mgr_file\n"; - exit 1; -} - -# Launching -if ($options{p} and $options{b}) { - print STDERR "option -p and -b are incompatible\n"; - exit 1; -} else { - system("xsetroot", "-solid", $options{b}) if $options{b}; -} - -if ($options{g} =~ /KFM/i) { - system("kfm &"); -} elsif ($options{g} =~ /GMC/i) { - system("gmc &"); -} elsif ($options{g} =~ /SFM/i) { #Special Pixel. - system("sfm &"); -} else { - if ($options{g}) { - print STDERR "You need to specify KFM or GMC to --with-filemanager"; - exit(1); - } -} - -if ( $options{p} and ! -x '/usr/X11R6/bin/xsetbg') { - print STDERR "Can't find xli installed, please adjust your installation\n"; - exit(1); -} else { system("xsetbg", $options{p}) if $options{p}; } -if ($options{x}) { - my $xterm = $ENV{XTERM} ? $ENV{XTERM} : "xterm -bg black -fg white"; - system("$xterm &"); -} - -# END -if (!$options{i}) { - $command = $script{$wm} ? $script{$wm} : $script{shift @lf}; - exec ("/bin/sh", "-c", "$command"); -} else { - exec ("xinit $exec{$wm}"); -} - -sub parse_file { - my $f=shift @_; - local *F; - my ($e, $s, $n, $i, $d); - open F, $f or die "Can't open $f\n"; - local $/ = "--@@--"; - while (<F>) { - $n = $1 if /^NAME=(.*)/m; - $e = $1 if /^EXEC=(.*)/m; - $d = $1 if /^DESC=(.*)/m; - $i = $1 if /^ICON=(.*)/m; - $s = $1 while /SCRIPT:(.*?)$/gs; - if (-x $e) { $script{$n} = $s; $exec{$n} = $e; push @lf, $n; } - } -} - -sub list_sessions{my $e=shift @_;for(@lf){print{$e ? STDERR : STDOUT}"$_\n";}} - -sub usage { - my $e = shift @_; - (my $basename = $0) =~ s|.*/||; - print { $e ? STDERR : STDOUT } << "EOF"; -Usage: $0 [-Faixh] [ -b color ] [ window-manager session] -Window-Manager launcher - - -i --xinit: Launch with xinit. - -a --alias: Product alias for bourne shell. - -b=COLOR --background=COLOR: Specify a background color. - -g --with-file-manager: Launch with a filemanager [ KFM | GMC ] - -x --with-xtermM: Display an xterm. - -p=PIC --picture=PIC: Pictures to display in background. - -l --list-active-session: List active sessions. - -F --fallback: Try to fallback between window-managers - if failing to launch the specified one. - -h --help: Display this message. - -EOF - exit($e); -} |