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