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) 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')), diff --git a/terminator b/terminator index 60775593..1d1daaf7 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 @@ -64,7 +93,6 @@ def openurl (url): class TerminatorTerm: # Our settings - # FIXME: Add commandline and/or gconf options to change these defaults = { 'gt_dir' : '/apps/gnome-terminal', '_profile_dir' : '%s/profiles', @@ -91,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): @@ -125,12 +142,25 @@ 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.split("#")[0] + 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) @@ -390,8 +420,8 @@ class TerminatorTerm: if ret == None: print >> sys.stderr, _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property - sys.exit (1) - return ret + + return (ret) def reconfigure_vte (self): # Set our emulation @@ -447,25 +477,6 @@ class TerminatorTerm: else: fg_color = gtk.gdk.color_parse (self.reconf ('foreground_color')) bg_color = gtk.gdk.color_parse (self.reconf ('background_color')) - - # Set our background image, transparency and type - background_type = self.reconf ('background_type') - - if background_type == "solid": - self._vte.set_background_image_file ('') - self._vte.set_background_transparent (False) - if background_type == "image": - self._vte.set_background_image_file (self.reconf ('background_image')) - self._vte.set_scroll_background (self.reconf ('scroll_background')) - self._vte.set_background_transparent (False) - if background_type == "transparent": - darkness = self.reconf ('background_darkness') - if self._vte.is_composited(): - self._vte.set_background_transparent (False) - self._vte.set_opacity(int(darkness * 65535)) - else: - self._vte.set_background_transparent (True) - self._vte.set_background_saturation (1 - darkness) colors = palette.split (':') palette = [] @@ -474,6 +485,32 @@ class TerminatorTerm: palette.append (gtk.gdk.color_parse (color)) self._vte.set_colors (fg_color, bg_color, palette) + # Set our background image, transparency and type + # Many thanks to the authors of gnome-terminal, on which this code is based. + background_type = self.reconf ('background_type') + + # set background image settings + if background_type == "image": + self._vte.set_background_image_file (self.reconf ('background_image')) + self._vte.set_scroll_background (self.reconf('scroll_background')) + else: + self._vte.set_background_image_file('') + self._vte.set_scroll_background(False) + + # set transparency for the background (image) + if background_type in ("image", "transparent"): + self._vte.set_background_tint_color (bg_color) + self._vte.set_background_saturation(1 - (self.reconf ('background_darkness'))) + self._vte.set_opacity(int(self.reconf('background_darkness') * 65535)) + else: + self._vte.set_background_saturation(1) + self._vte.set_opacity(65535) + + if not self._vte.is_composited(): + self._vte.set_background_transparent (background_type == "transparent") + else: + self._vte.set_background_transparent (False) + # Set our cursor blinkiness self._vte.set_cursor_blinks = (self.reconf ('cursor_blink')) @@ -822,11 +859,13 @@ class Terminator: parent.add (pane) - position = (vertical) and parent.allocation.height or parent.allocation.width + position = (vertical) and parent.allocation.height \ + or parent.allocation.width if isinstance (parent, gtk.Paned): # We are inside a split term - position = (vertical) and widget.get_box().allocation.height or widget.get_box().allocation.width + position = (vertical) and widget.get_box().allocation.height \ + or widget.get_box().allocation.width if (widget.get_box () == parent.get_child1 ()): widget.get_box ().reparent (pane) @@ -967,19 +1006,23 @@ class Terminator: elif isinstance (parent, gtk.HPaned) and not vertical: return parent return self.get_first_parent_paned(parent, vertical) - - -def execute_cb (option, opt, value, parser): - assert value is None - value = [] - while parser.rargs: - arg = parser.rargs[0] - value.append (arg) - del (parser.rargs[0]) - setattr(parser.values, option.dest, value) - 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 + value = [] + while parser.rargs: + arg = parser.rargs[0] + value.append (arg) + del (parser.rargs[0]) + setattr(parser.values, option.dest, value) usage = "usage: %prog [options]" parser = OptionParser (usage) @@ -990,6 +1033,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: @@ -1000,6 +1044,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)