Replace mate-terminal.wrapper with one adapted from gnome-terminal.wrapper that support double quoted commands.

Closes https://github.com/mate-desktop/mate-terminal/pull/88
master-1.22
Martin Wimpress 2015-04-21 07:53:34 +01:00 committed by Stefano Karapetsas
parent e771a4d654
commit 37ff9fcae6
1 changed files with 79 additions and 42 deletions

View File

@ -1,44 +1,81 @@
#!/usr/bin/env python k#! /usr/bin/perl -w
import sys my $login=0;
import os
import subprocess
newargs = ['mate-terminal'] while ($opt = shift(@ARGV))
oldargs = sys.argv[1:] {
if ($opt eq '-display')
while True: {
try: $ENV{'DISPLAY'} = shift(@ARGV);
arg = oldargs.pop(0) }
elsif ($opt eq '-name')
if arg == '-display': {
os.environ['DISPLAY'] = oldargs.pop(0) $arg = shift(@ARGV);
elif arg == '-name': push(@args, "--window-with-profile=$arg");
newargs.append('--window-with-profile=' + oldargs.pop(0)) }
elif arg == '-n': elsif ($opt eq '-n')
sys.stderr.write('Set an icon in your profile') {
elif arg == '-T' or arg == '-title': # Accept but ignore
newargs.append('-t') print STDERR "$0: to set an icon, please use -name <profile> and set a profile icon\n"
newargs.append(oldargs.pop(0)) }
elif arg == '-ls' or arg == '+ls': elsif ($opt eq '-T' || $opt eq '-title')
sys.stderr.write('Login shell not supported. Set in your profile.') {
elif arg == '-geometry': push(@args, '-t', shift(@ARGV));
newargs.append('--geometry=' + oldargs.pop(0)) }
elif arg == '-fn': elsif ($opt eq '-ls')
newargs.append('--font=' + oldargs.pop(0)) {
elif arg == '-fg': $login = 1;
newargs.append('--foreground=' + oldargs.pop(0)) }
elif arg == '-bg': elsif ($opt eq '+ls')
newargs.append('--background=' + oldargs.pop(0)) {
elif arg == '-tn': $login = 0;
newargs.append('--termname=' + oldargs.pop(0)) }
elif arg == '-h' or arg == '--help': elsif ($opt eq '-geometry')
newargs.append('--help') {
elif arg == '-e': $arg = shift(@ARGV);
newargs.append('-x') push(@args, "--geometry=$arg");
newargs += oldargs }
break elsif ($opt eq '-fn')
except IndexError: {
break $arg = shift(@ARGV);
push(@args, "--font=$arg");
subprocess.call(newargs) }
elsif ($opt eq '-fg')
{
$arg = shift(@ARGV);
push(@args, "--foreground=$arg");
}
elsif ($opt eq '-bg')
{
$arg = shift(@ARGV);
push(@args, "--background=$arg");
}
elsif ($opt eq '-tn')
{
$arg = shift(@ARGV);
push(@args, "--termname=$arg");
}
elsif ($opt eq '-e')
{
$arg = shift(@ARGV);
if (@ARGV)
{
push(@args, '-x', $arg, @ARGV);
last;
}
else
{
push(@args, '-e', $arg);
}
last;
}
elsif ($opt eq '-h' || $opt eq '--help')
{
push(@args, '--help');
}
}
if ($login == 1)
{
@args = ('--login', @args);
}
exec('mate-terminal',@args);