New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mate-terminal.wrapper needed #9

Closed
subogero opened this Issue Nov 9, 2012 · 6 comments

Comments

Projects
None yet
4 participants
@subogero

subogero commented Nov 9, 2012

I've been hunting down a bug in Linux Mint 13 MATE:
I've set up Firefox to handle mailto: links via the /usr/lib/mutt/mailto-mutt program,
which just starts mutt in a new terminal and should pass the parameters.

It execs x-terminal-emulator -e mutt "$@"

x-terminal-emulator is in turn symlinked through /etc/alternatives to mate-terminal.

But mate-terminal ignores the parameters after -e , so in my case mutt is started
in normal mode and not in compose-email mode.

Originally I wanted to post a bug to Debian to fix mailto-mutt.
But then I tested a few other Debian-based systems (LM 13 KDE, Xfce and Xubuntu 12.04).
All work perfectly.

The reason is that, on one hand, KDE's konsole does pass the parameters after "-e " to cmd,
and the others using xfce4-terminal or gnome-terminal all come with a wrapper with a similar
behaviour. x-terminal-emulator in the latter cases is always a symlink to the wrapper.

MATE should behave at least the same as Linux Mint Xfce and come with a wrapper
for mate-terminal, passing all the rest of the command line to if
mate-terminal.wrapper -e
is called.

@subogero

This comment has been minimized.

Show comment
Hide comment
@subogero

subogero Nov 10, 2012

My minimal wrapper looks like this, it just swaps -e for -x:

#!/bin/sh
while [ "$1" ]; do
  param=$1
  shift
  [ $param = '-e' ] && param='-x'
  args="$args $param"
done
exec mate-terminal $args

This sample script might handle parameters with special characters badly, and it should be integrated into the Debian
/etc/alternatives system as well.

subogero commented Nov 10, 2012

My minimal wrapper looks like this, it just swaps -e for -x:

#!/bin/sh
while [ "$1" ]; do
  param=$1
  shift
  [ $param = '-e' ] && param='-x'
  args="$args $param"
done
exec mate-terminal $args

This sample script might handle parameters with special characters badly, and it should be integrated into the Debian
/etc/alternatives system as well.

@subogero subogero closed this Nov 10, 2012

@subogero subogero reopened this Nov 10, 2012

@subogero

This comment has been minimized.

Show comment
Hide comment
@subogero

subogero Nov 16, 2012

I've written the wrapper in C as, unlike a shell, it does not mess with the special characters in the arguments. I don't really know the mate build system, so I've just simply compiled and installed it in /usr/bin. It works nicely.

#include <unistd.h>
#include <string.h>
int main(int argc, char *argv[])
{
    int i;
    argv[0] = "/usr/bin/mate-terminal";
    for (i = 1; i < argc; ++i) {
        if (strncmp(argv[i], "-e", 3) == 0) {
            argv[i] = "-x";
        }
    }
    execv(argv[0], argv);
    return 1; /* if exec returns, it's an error, baby */ 
}

subogero commented Nov 16, 2012

I've written the wrapper in C as, unlike a shell, it does not mess with the special characters in the arguments. I don't really know the mate build system, so I've just simply compiled and installed it in /usr/bin. It works nicely.

#include <unistd.h>
#include <string.h>
int main(int argc, char *argv[])
{
    int i;
    argv[0] = "/usr/bin/mate-terminal";
    for (i = 1; i < argc; ++i) {
        if (strncmp(argv[i], "-e", 3) == 0) {
            argv[i] = "-x";
        }
    }
    execv(argv[0], argv);
    return 1; /* if exec returns, it's an error, baby */ 
}
@stefano-k

This comment has been minimized.

Show comment
Hide comment
@stefano-k
Member

stefano-k commented Nov 18, 2012

sbalneav added a commit that referenced this issue May 1, 2013

@sbalneav

This comment has been minimized.

Show comment
Hide comment
@sbalneav

sbalneav May 2, 2013

Contributor

mate-terminal.wrapper added

Contributor

sbalneav commented May 2, 2013

mate-terminal.wrapper added

@sbalneav sbalneav closed this May 2, 2013

@subogero

This comment has been minimized.

Show comment
Hide comment
@subogero

subogero commented May 15, 2013

Thanks!

@glensc

This comment has been minimized.

Show comment
Hide comment
@glensc

glensc Mar 1, 2014

Does this really have to be in Python?

and this wrapper is not needed on systems not using alternatives? what symlink actually points to this? can somebody show?

glensc commented Mar 1, 2014

Does this really have to be in Python?

and this wrapper is not needed on systems not using alternatives? what symlink actually points to this? can somebody show?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment