Search $PATH for shells. Reinstate F11 (oops).

This commit is contained in:
Thomas Hurst 2008-06-09 18:51:37 +01:00
parent 2a9b782410
commit 1721a540c7
1 changed files with 12 additions and 10 deletions

View File

@ -368,28 +368,30 @@ text/plain
args = self.conf.custom_command.split () args = self.conf.custom_command.split ()
shell = args[0] shell = args[0]
try:
paths = os.environ['PATH'].split(':')
except:
paths = ['/usr/local', '/usr', '/']
if not os.path.exists (shell): if not os.path.exists (shell):
shell = os.getenv ('SHELL') or '' shell = os.getenv ('SHELL') or ''
if not os.path.exists (shell): if not os.path.exists (shell):
shell = pwd.getpwuid (os.getuid ())[6] or '' shell = pwd.getpwuid (os.getuid ())[6] or ''
if not os.path.exists (shell): if not os.path.exists (shell):
for i in ['bash','zsh','tcsh','ksh','csh','sh']: for i in ['bash','zsh','tcsh','ksh','csh','sh']:
shell = '/usr/bin/%s'%i for p in paths:
if not os.path.exists (shell): shell = os.path.join(p, 'bin', i)
shell = '/bin/%s'%i
if not os.path.exists (shell): if not os.path.exists (shell):
continue continue
else: else:
break break
else:
break;
if not os.path.exists (shell): if not os.path.exists (shell):
# Give up, we're completely stuck # Give up, we're completely stuck
print >> sys.stderr, _('Unable to find a shell') print >> sys.stderr, _('Unable to find a shell')
gobject.timeout_add (100, self.terminator.closeterm, self) gobject.timeout_add (100, self.terminator.closeterm, self)
return (-1) return (-1)
if not args: if not args:
args.append (shell) args.append (shell)
@ -1023,9 +1025,9 @@ class Terminator:
keyname = gtk.gdk.keyval_name (event.keyval) keyname = gtk.gdk.keyval_name (event.keyval)
mask = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK mask = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK
#if (keyname == 'F11'): if (keyname == 'F11'):
# self.fullscreen_toggle () self.fullscreen_toggle ()
# return (True) return (True)
if (event.state & mask) == mask: if (event.state & mask) == mask:
if keyname == 'Q': if keyname == 'Q':