Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset ac49d23c in mainline


Ignore:
Timestamp:
2019-06-21T12:12:20Z (17 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
fd244cd
Parents:
3498bd5
Message:

tools/ew.py: Add support for gnome-terminal

Also adds informative error message when no terminal emulator is found.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    r3498bd5 rac49d23c  
    5757
    5858def termemu_detect():
    59         for termemu in ['xfce4-terminal', 'xterm']:
     59        emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
     60        for termemu in emus:
    6061                try:
    6162                        subprocess.check_output('which ' + termemu, shell = True)
     
    6465                        pass
    6566
     67        print('Could not find any of the terminal emulators %s.'%(emus))
     68        sys.exit(1)
     69
    6670def run_in_console(cmd, title):
    6771        ecmd = cmd.replace('"', '\\"')
    68         cmdline = termemu_detect() + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
     72        temu = termemu_detect()
     73        if temu == 'gnome-terminal':
     74                cmdline = temu + ' -- ' + ecmd
     75        else:
     76                cmdline = temu + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
     77
    6978        print(cmdline)
    7079        if not is_override('dryrun'):
Note: See TracChangeset for help on using the changeset viewer.