Adding XDG support closes LP#238070
* adding python-xdg and xdg-utils in debian/control 's Recommends field * if xdg is not installed, default to ~/.terminatorrc * using xdg-open first, then fallback to gnome.url_show or webbrowser.open
This commit is contained in:
parent
17a61dabf6
commit
0803723ca9
1
debian/control
vendored
1
debian/control
vendored
@ -13,6 +13,7 @@ Package: terminator
|
||||
Architecture: all
|
||||
Depends: ${python:Depends}, python-vte, python-gconf, gconf2
|
||||
XB-Python-Version: ${python:Versions}
|
||||
Recommends: xdg-utils, python-xdg
|
||||
Description: Multiple GNOME terminals in one window
|
||||
This is a project to produce an efficient way of filling a
|
||||
large area of screen space with terminals. This is done by
|
||||
|
@ -1,6 +1,7 @@
|
||||
.TH "TERMINATORRC" "5" "Feb 22, 2008" "Nicolas Valcarcel <nvalcarcel@ubuntu.com>" ""
|
||||
.SH "NAME"
|
||||
~/.terminatorrc \- the config file for terminator terminal emulator.
|
||||
${XDG_CONFIG_HOME}/terminator/terminatorrc (usually ~/.config/terminator/terminatorrc)
|
||||
or ~/.terminatorrc \- the config file for terminator terminal emulator.
|
||||
.SH "DESCRIPTION"
|
||||
This manual page documents briefly the
|
||||
.B termiatorrc config file.
|
||||
|
16
terminator
16
terminator
@ -69,6 +69,7 @@ except:
|
||||
"gobject, gtk and pango to run Terminator.")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# import a library for viewing URLs
|
||||
try:
|
||||
# gnome.url_show() is really useful
|
||||
@ -88,11 +89,18 @@ except:
|
||||
error.run()
|
||||
sys.exit (1)
|
||||
|
||||
def exec_command(executable, *parameters):
|
||||
command = [executable]
|
||||
command.extend(parameters)
|
||||
|
||||
return os.system(command[0] + " \"%s\"" %command[1])
|
||||
|
||||
def openurl (url):
|
||||
try:
|
||||
url_show (url)
|
||||
except:
|
||||
pass
|
||||
if exec_command("xdg-open", url):
|
||||
try:
|
||||
url_show (url)
|
||||
except:
|
||||
pass
|
||||
|
||||
class TerminatorTerm (gtk.VBox):
|
||||
|
||||
|
@ -37,6 +37,12 @@ import os, sys, re
|
||||
# import unix-lib
|
||||
import pwd
|
||||
|
||||
HAS_XDG = True
|
||||
try:
|
||||
import xdg.BaseDirectory
|
||||
except:
|
||||
HAS_XDG = False
|
||||
|
||||
# set this to true to enable debugging output
|
||||
debug = True
|
||||
|
||||
@ -142,7 +148,11 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore):
|
||||
# that can be re-used when rc changes.
|
||||
def __init__ (self):
|
||||
self.type = "RCFile"
|
||||
self.rcfilename = os.path.join(os.path.expanduser("~"), ".terminatorrc")
|
||||
if HAS_XDG and xdg.BaseDirectory.load_first_config('terminator'):
|
||||
self.rcfilename = os.path.join(xdg.BaseDirectory.load_first_config('terminator'), "terminatorrc")
|
||||
else:
|
||||
self.rcfilename = os.path.join(os.path.expanduser("~"), ".terminatorrc")
|
||||
|
||||
if os.path.exists (self.rcfilename):
|
||||
rcfile = open (self.rcfilename)
|
||||
rc = rcfile.readlines ()
|
||||
|
Loading…
Reference in New Issue
Block a user