From db66ec7743c58e48931f7a908cdd66cbbfaeca26 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 25 Feb 2008 23:26:51 +0000 Subject: [PATCH 1/4] Add schema descriptions from gconf to document the rc settings --- doc/terminatorrc.5 | 85 +++++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 35 deletions(-) diff --git a/doc/terminatorrc.5 b/doc/terminatorrc.5 index 22d0428c..b10407f7 100644 --- a/doc/terminatorrc.5 +++ b/doc/terminatorrc.5 @@ -10,73 +10,88 @@ This manual page documents briefly the The options are defined one per line as \fB'OPTION = VALUE'\fR. The options are described below: .TP -.B gt_dir -Default value: \fB/apps/gnome\-terminal\fR +.B allow_bold\fR (boolean) +If true, allow applications in the terminal to make text boldface. +Default value: \fBTrue\fR .TP -.B _profile_dir -Default value: \fB%s/profiles\fR -.TP -.B allow_bold -Boolean value. Default value: \fBTrue\fR -.TP -.B silent_bell -Boolean value. Default value: \fBTrue\fR +.B silent_bell\fR (boolean) +If true, don't make a noise when applications send the escape sequence for the terminal bell. Flash the terminal instead. +Default value: \fBTrue\fR .TP .B background_color -Heximal RGB value for the background color. Default value: \fB#000000\fR +Default colour of terminal background, as a colour specification (can be HTML-style hex digits, or a colour name such as "red"). +Default value: \fB#000000\fR .TP .B background_darkness -Number for the background darkness. Default value: \fB0.5\fR +A value between 0.0 and 1.0 indicating how much to darken the background image. 0.0 means no darkness, 1.0 means fully dark. In the current implementation, there are only two levels of darkness possible, so the setting behaves as a boolean, where 0.0 disables the darkening effect. +Default value: \fB0.5\fR .TP .B background_type +Type of terminal background. May be "solid" for a solid colour, "image" for an image, or "transparent" for full transparency in compositing window managers, otherwise pseudo transparency. Default value: \fBsolid\fR .TP .B backspace_binding +Sets what code the backspace key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "ascii-del" is normally considered the correct setting for the Backspace key. Default value: \fBascii\-del\fR .TP .B delete_binding +Sets what code the delete key generates. Possible values are "ascii-del" for the ASCII DEL character, "control-h" for Control-H (AKA the ASCII BS character), "escape-sequence" for the escape sequence typically bound to backspace or delete. "escape-sequence" is normally considered the correct setting for the Delete key. Default value: \fBdelete\-sequence\fR .TP -.B cursor_blink -Boolean value. Default value: \fBFalse\fR +.B cursor_blink \fR(boolean) +Controls if the cursor blinks. +Default value: \fBFalse\fR .TP .B emulation +Sets what type of terminal should be emulated. Default value: \fBxterm\fR .TP .B font -Value for the font time and size in the format \fBFONTNAME SIZENUMBER\fR. Default value: \fBSerif 10\fR +An Pango font name. Examples are "Sans 12" or "Monospace Bold 14". +Default value: \fBSerif 10\fR .TP .B foreground_color -Hexadecimal RGB value for the font color. Default value: \fB#AAAAAA\fR +Default colour of text in the terminal, as a colour specification (can be HTML-style hex digits, or a colour name such as "red"). +Default value: \fB#AAAAAA\fR .TP .B scrollbar_position -Scrollbar position. Options available: right, left and hidden. Default value: \fBright\fR +Where to put the terminal scrollbar. Possibilities are "left", "right", and "disabled". +Default value: \fBright\fR .TP -.B scroll_background -Boolean value. Default value: \fBTrue\fR +.B scroll_background \fR(boolean) +If true, scroll the background image with the foreground text; if false, keep the image in a fixed position and scroll the text above it. +Default value: \fBTrue\fR .TP -.B scroll_on_keystroke -Boolean value. Default value: \fBFalse\fR -.TP -.B scroll_on_output -Boolean value. Default value: \fBFalse\fR -.TP -.B scrollback_lines -Number of lines stored for the scrollbar. Default value: \fB100\fR -.TP -.B focus -Default value: \fBsloppy\fR -.TP -.B child_restart +.B scroll_on_keystroke \fR(boolean) +If true, pressing a key jumps the scrollbar to the bottom. Default value: \fBFalse\fR .TP +.B scroll_on_output \fR(boolean) +If true, whenever there's new output the terminal will scroll to the bottom. +Default value: \fBFalse\fR +.TP +.B scrollback_lines +Number of scrollback lines to keep around. You can scroll back in the terminal by this number of lines; lines that don't fit in the scrollback are discarded. Be careful with this setting; it's the primary factor in determining how much memory the terminal will use. +Default value: \fB100\fR +.TP +.B focus +Sets what type of mouse events should determine terminal focus. Can be "sloppy" or "click". "mouse" is also interpreted as "sloppy". +Default value: \fBsloppy\fR +.TP +.B exit_action +Possible values are "close" to close the terminal, and "restart" to restart the command. +Default value: \fBclose\fR +.TP .B palette +Terminals have a 16-colour palette that applications inside the terminal can use. This is that palette, in the form of a colon-separated list of colour names. Colour names should be in hex format e.g. "#FF00FF". Default value: \fB#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF\fR .TP .B word_chars +When selecting text by word, sequences of these characters are considered single words. Ranges can be given as "A-Z". Literal hyphen (not expressing a range) should be the first character given. Default value: \fB\-A\-Za\-z0\-9,./?%&#:_\fR .TP -.B mouse_autohide -Boolean value. Default value: \fBTrue\fR +.B mouse_autohide \fR(boolean) +Controls whether the mouse cursor should be hidden while typing. +Default value: \fBTrue\fR .SH "SEE ALSO" -.BR gnome\-terminal(1), +.BR gnome\-terminal(1) From 4e45095f59bb3f746d0caebef6c5021b758ee4c6 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 26 Feb 2008 00:25:01 +0000 Subject: [PATCH 2/4] [CJ] Expand Thomas Meire no-gconf branch to have an optparse entry and move it. write a fake gconf client to make this work. We should refactor eventually. --- terminator | 72 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 16 deletions(-) diff --git a/terminator b/terminator index 2e32fab8..847e465f 100755 --- a/terminator +++ b/terminator @@ -27,13 +27,42 @@ gettext.install ('terminator') # import unix-lib import pwd +# import gconf if possible, if not construct a fake replacement +class fakegconfclient: + def get_string (self, key): + return ("") + def get_list (self, key, type): + return ([]) + def add_dir (self, profile, path): + return (True) + def notify_add (self, profile, callback): + return (True) + def get_bool (self, key): + return (False) + def get (self, key): + return (0) +class fakegconf: + CLIENT_PRELOAD_RECURSIVE = False + VALUE_STRING = "" + VALUE_INT = 0 + VALUE_FLOAT = 0.0 + VALUE_BOOL = False + def client_get_default (self): + foo = fakegconfclient () + return (foo) + +try: + import gconf +except: + pass + # import gtk libs # check just in case anyone runs it on a non-gnome system. try: - import gobject, gtk, gconf, pango + import gobject, gtk, pango except: print >> sys.stderr, _("You need to install the python bindings for " \ - "gobject, gtk, gconf and pango to run Terminator.") + "gobject, gtk and pango to run Terminator.") sys.exit(1) # import a library for viewing URLs @@ -90,17 +119,6 @@ class TerminatorTerm: 'mouse_autohide' : True, } - if os.path.exists(pwd.getpwuid(os.getuid())[5] + "/.terminatorrc"): - f = open(pwd.getpwuid(os.getuid())[5] + "/.terminatorrc") - config = f.readlines() - f.close() - - for line in config: - line = line.strip() - if line: - (key,value) = line.split("=") - defaults[key.strip()]=value.strip() - matches = {} def __init__ (self, terminator, profile = None, command = None, cwd = None): @@ -124,12 +142,24 @@ class TerminatorTerm: if profile != "Default" and "Default" in profiles: self.profile = '%s/Default'%(self.defaults['profile_dir']) - if not self.profile: - print >> sys.stderr, _("Warning: unable to find profile %s. Continue with default values...") % profile - if self.profile: self.gconf_client.add_dir (self.profile, gconf.CLIENT_PRELOAD_RECURSIVE) self.gconf_client.notify_add (self.profile, self.on_gconf_notification) + else: + if os.path.exists (pwd.getpwuid(os.getuid ())[5] + "/.terminatorrc"): + f = open (pwd.getpwuid (os.getuid ())[5] + "/.terminatorrc") + config = f.readlines () + f.close () + + for line in config: + try: + line = line.strip () + if line: + (key,value) = line.split ("=") + print >> sys.stderr, _('''Overriding setting '%s' from default value '%s' to: '%s' ''')%(key.strip (), self.defaults[key.strip ()], value.strip ()) + self.defaults[key.strip ()] = value.strip () + except: + pass self.gconf_client.add_dir ('/apps/metacity/general', gconf.CLIENT_PRELOAD_RECURSIVE) self.gconf_client.notify_add ('/apps/metacity/general/focus_mode', self.on_gconf_notification) @@ -824,6 +854,12 @@ class Terminator: return self.get_first_parent_paned(parent, vertical) if __name__ == '__main__': + try: + if (gconf): + pass + except: + # Install a fake gconf setup + gconf = fakegconf () def execute_cb (option, opt, value, parser): assert value is None @@ -843,6 +879,7 @@ if __name__ == '__main__': parser.add_option ("-p", "--profile", dest="profile", help="Specify a GNOME Terminal profile to emulate") parser.add_option ("-e", "--command", dest="command", help="Execute the argument to this option inside the terminal") parser.add_option ("-x", "--execute", dest="execute", action="callback", callback=execute_cb, help="Execute the remainder of the command line inside the terminal") + parser.add_option ("-g", "--no-gconf", dest="nogconf", action="store_true", help="Disable gconf usage, falling back on ~/.terminatorrc and defaults") (options, args) = parser.parse_args () if len (args) != 0: @@ -853,6 +890,9 @@ if __name__ == '__main__': command.append (options.command) if (options.execute): command = options.execute + if (options.nogconf): + del (gconf) + gconf = fakegconf () term = Terminator (options.profile, command) From a4013ad0f332c86a53ca7365aa3ef20ed199cfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Valc=C3=A1rcel?= Date: Tue, 26 Feb 2008 12:32:11 -0500 Subject: [PATCH 3/4] Adding terminatorrc manpage for install --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 6aff3442..a47609d2 100755 --- a/setup.py +++ b/setup.py @@ -54,6 +54,7 @@ setup(name='Terminator', data_files=[ ('share/applications', ['data/terminator.desktop']), ('share/man/man1', ['doc/terminator.1']), + ('share/man/man5', ['doc/terminatorrc.5']), ('share/pixmaps', ['data/icons/48x48/apps/terminator.png']), ('share/icons/hicolor/scalable/apps', glob.glob('data/icons/scalable/apps/*.svg')), ('share/icons/hicolor/16x16/apps', glob.glob('data/icons/16x16/apps/*.png')), From 84b984dc0cae704e30d9a784e692bb2bc0cbc3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Valc=C3=A1rcel?= Date: Tue, 26 Feb 2008 13:03:41 -0500 Subject: [PATCH 4/4] Added comments support on .terminatorrc --- terminator | 1 + 1 file changed, 1 insertion(+) diff --git a/terminator b/terminator index 847e465f..acce2c78 100755 --- a/terminator +++ b/terminator @@ -153,6 +153,7 @@ class TerminatorTerm: for line in config: try: + line = line.split("#")[0] line = line.strip () if line: (key,value) = line.split ("=")