Browse Source

Allow each user to specify the default terminal emulator

The default terminal emulator can be specified by each user individually
in a ~/.config/xdgmenumaker.cfg file. In case the file is not there, or
one is not specified, default to the debian alternatives system on
debian and debian-likes and xterm in any other case.
pull/3/head
George Vlahavas 11 years ago
parent
commit
c7e7fa8d42
  1. 13
      src/xdgmenumaker

13
src/xdgmenumaker

@ -7,6 +7,7 @@ import gtk
import xdg.DesktopEntry as dentry import xdg.DesktopEntry as dentry
import xdg.Exceptions as exc import xdg.Exceptions as exc
import xdg.BaseDirectory as bd import xdg.BaseDirectory as bd
import ConfigParser
from operator import attrgetter from operator import attrgetter
seticon = False seticon = False
@ -49,7 +50,17 @@ system_icon = de.getIcon()
de = dentry.DesktopEntry(filename = '/usr/share/desktop-directories/xdgmenumaker-other.directory') de = dentry.DesktopEntry(filename = '/usr/share/desktop-directories/xdgmenumaker-other.directory')
other = de.getName().encode('utf-8') other = de.getName().encode('utf-8')
other_icon = de.getIcon() other_icon = de.getIcon()
# use debians alternative system if available # Find out which terminal emulator to use for apps that need to be
# launched in a terminal.
# First see if there is a user specified terminal emulator in the
# xdgmenumaker.cfg file.
try:
config = ConfigParser.SafeConfigParser()
config.read(os.path.expanduser('~/.config/xdgmenumaker.cfg'))
terminal_app = config.get('Terminal', 'terminal')
# if there isn't, on debian and debian-likes, use the alternatives
# system, otherwise default to xterm
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
if os.path.exists('/etc/alternatives/x-terminal-emulator') and os.path.exists('/usr/bin/x-terminal-emulator'): if os.path.exists('/etc/alternatives/x-terminal-emulator') and os.path.exists('/usr/bin/x-terminal-emulator'):
terminal_app = '/usr/bin/x-terminal-emulator' terminal_app = '/usr/bin/x-terminal-emulator'
else: else:

Loading…
Cancel
Save