From 1a7596f7a5777f8793841c8b8eda891f03f594ce Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:02:09 +0200 Subject: Adding debian version 3.46.8-1. Signed-off-by: Daniel Baumann --- debian/gnome-terminal.wrapper | 122 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 debian/gnome-terminal.wrapper (limited to 'debian/gnome-terminal.wrapper') diff --git a/debian/gnome-terminal.wrapper b/debian/gnome-terminal.wrapper new file mode 100644 index 0000000..cf64a62 --- /dev/null +++ b/debian/gnome-terminal.wrapper @@ -0,0 +1,122 @@ +#! /usr/bin/perl -w + +sub exists_in_path { + my $command = shift; + my @path = split ':', $ENV{PATH}; + + foreach my $dir (@path) { + if (-x "$dir/$command") { + return 1; + } + } + + return 0; +} + +# GNOME Terminal now uses a dbus-activated service, so calling it would exit +# immediately, while we're supposed to mimic xterm behavior and so to wait +# until the terminal is explicitly closed, so always use the wait argument +push(@args, '--wait'); + +while ($opt = shift(@ARGV)) +{ + if ($opt eq '-display') + { + $ENV{'DISPLAY'} = shift(@ARGV); + } + elsif ($opt eq '-name') + { + $arg = shift(@ARGV); + push(@args, "--window-with-profile=$arg"); + } + elsif ($opt eq '-n') + { + # Accept but ignore + print STDERR "$0: to set an icon, please use -name and set a profile icon\n" + } + elsif ($opt eq '-T' || $opt eq '-title') + { + push(@args, '-t', shift(@ARGV)); + } + elsif ($opt eq '-ls') + { + die "$0: Requested to be used as a login shell, but it's not supported\n" + } + elsif ($opt eq '+ls') + { + print STDERR "$0: gnome-terminal is always a non-login shell\n" + } + elsif ($opt eq '-geometry') + { + $arg = shift(@ARGV); + push(@args, "--geometry=$arg"); + } + elsif ($opt eq '-fn') + { + $arg = shift(@ARGV); + push(@args, "--font=$arg"); + } + 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') + { + # Debian Policy says we would be free to translate this into: + # push(@args, '--', @ARGV); + # but let's be nice to people with local scripts that rely on + # xterm -e having a special case for a singular argument. + $arg = shift(@ARGV); + if (@ARGV) + { + push(@args, '--', $arg, @ARGV); + last; + } + else + { + # Emulate xterm's special case for a single argument: if it + # isn't something we can execute directly, pass it to a shell + my $executable; + + if ($arg =~ m{/}) + { + $executable = -x $arg; + } + else + { + $executable = exists_in_path($arg); + } + + if ($executable) + { + push(@args, '--', $arg); + } + else + { + # Historically, we used the now-deprecated gnome-terminal -e + # for this case, which would split the command line up as if + # by a shell, but didn't support shell constructs like "if" + # and pipes. But this is easier, and matches what xterm does. + push(@args, '--', 'sh', '-c', $arg); + } + } + last; + } + elsif ($opt eq '-h' || $opt eq '--help') + { + push(@args, '--help'); + } +} + +exec('gnome-terminal',@args); -- cgit v1.2.3