2008-03-08 00:04:41 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# TerminatorConfig - layered config classes
|
|
|
|
# Copyright (C) 2006-2008 cmsj@tenshu.net
|
|
|
|
#
|
2009-05-07 01:35:23 +00:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, version 2 only.
|
2008-03-08 00:04:41 +00:00
|
|
|
#
|
2009-05-07 01:35:23 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2008-03-08 00:04:41 +00:00
|
|
|
#
|
2009-05-07 01:35:23 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2008-03-08 00:04:41 +00:00
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
"""Terminator by Chris Jones <cmsj@tenshu.net>
|
2008-03-08 00:04:41 +00:00
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
Classes relating to configuratoin"""
|
2008-03-08 00:04:41 +00:00
|
|
|
|
2009-05-07 01:35:23 +00:00
|
|
|
import platform
|
2009-08-18 11:46:41 +00:00
|
|
|
from borg import Borg
|
2008-08-15 03:11:24 +00:00
|
|
|
|
2009-05-07 01:35:23 +00:00
|
|
|
DEFAULTS = {
|
2008-08-15 12:40:10 +00:00
|
|
|
'gt_dir' : '/apps/gnome-terminal',
|
|
|
|
'profile_dir' : '/apps/gnome-terminal/profiles',
|
|
|
|
'titlebars' : True,
|
2009-04-09 10:23:33 +00:00
|
|
|
'zoomedtitlebar' : True,
|
2008-08-15 12:40:10 +00:00
|
|
|
'allow_bold' : True,
|
2009-03-20 10:13:29 +00:00
|
|
|
'audible_bell' : False,
|
|
|
|
'visible_bell' : True,
|
|
|
|
'urgent_bell' : False,
|
2008-08-15 12:40:10 +00:00
|
|
|
'background_color' : '#000000',
|
|
|
|
'background_darkness' : 0.5,
|
|
|
|
'background_type' : 'solid',
|
|
|
|
'background_image' : '',
|
|
|
|
'backspace_binding' : 'ascii-del',
|
|
|
|
'delete_binding' : 'delete-sequence',
|
|
|
|
'cursor_blink' : True,
|
2009-03-25 12:58:55 +00:00
|
|
|
'cursor_shape' : 'block',
|
2009-03-25 12:48:27 +00:00
|
|
|
'cursor_color' : '',
|
2008-08-15 12:40:10 +00:00
|
|
|
'emulation' : 'xterm',
|
2009-12-19 02:08:35 +00:00
|
|
|
'geometry_hinting' : True,
|
2008-11-03 23:14:06 +00:00
|
|
|
'font' : 'Mono 10',
|
2008-08-15 12:40:10 +00:00
|
|
|
'foreground_color' : '#AAAAAA',
|
|
|
|
'scrollbar_position' : "right",
|
|
|
|
'scroll_background' : True,
|
|
|
|
'scroll_on_keystroke' : True,
|
|
|
|
'scroll_on_output' : True,
|
|
|
|
'scrollback_lines' : 500,
|
|
|
|
'focus' : 'click',
|
|
|
|
'exit_action' : 'close',
|
2009-08-18 11:46:41 +00:00
|
|
|
'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:\
|
|
|
|
#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:\
|
|
|
|
#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:\
|
|
|
|
#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:\
|
|
|
|
#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:\
|
|
|
|
#FFFFFFFFFFFF',
|
2008-08-15 12:40:10 +00:00
|
|
|
'word_chars' : '-A-Za-z0-9,./?%&#:_',
|
|
|
|
'mouse_autohide' : True,
|
|
|
|
'update_records' : True,
|
|
|
|
'login_shell' : False,
|
|
|
|
'use_custom_command' : False,
|
|
|
|
'custom_command' : '',
|
|
|
|
'use_system_font' : True,
|
|
|
|
'use_theme_colors' : False,
|
|
|
|
'http_proxy' : '',
|
|
|
|
'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'],
|
|
|
|
'encoding' : 'UTF-8',
|
|
|
|
'active_encodings' : ['UTF-8', 'ISO-8859-1'],
|
|
|
|
'fullscreen' : False,
|
|
|
|
'borderless' : False,
|
|
|
|
'maximise' : False,
|
2009-01-25 14:26:20 +00:00
|
|
|
'hidden' : False,
|
2008-08-15 12:40:10 +00:00
|
|
|
'handle_size' : -1,
|
|
|
|
'focus_on_close' : 'auto',
|
|
|
|
'f11_modifier' : False,
|
|
|
|
'force_no_bell' : False,
|
|
|
|
'cycle_term_tab' : True,
|
|
|
|
'copy_on_selection' : False,
|
|
|
|
'close_button_on_tab' : True,
|
2008-08-28 16:08:15 +00:00
|
|
|
'tab_position' : 'top',
|
2009-07-30 09:53:08 +00:00
|
|
|
'enable_real_transparency' : True,
|
2009-01-07 18:37:59 +00:00
|
|
|
'title_tx_txt_color' : '#FFFFFF',
|
|
|
|
'title_tx_bg_color' : '#C80003',
|
|
|
|
'title_rx_txt_color' : '#FFFFFF',
|
|
|
|
'title_rx_bg_color' : '#0076C9',
|
|
|
|
'title_ia_txt_color' : '#000000',
|
|
|
|
'title_ia_bg_color' : '#C0BEBF',
|
2008-08-15 12:40:10 +00:00
|
|
|
'try_posix_regexp' : platform.system() != 'Linux',
|
2009-02-02 23:01:00 +00:00
|
|
|
'hide_tabbar' : False,
|
2009-03-20 00:23:37 +00:00
|
|
|
'scroll_tabbar' : False,
|
2009-03-26 10:36:47 +00:00
|
|
|
'alternate_screen_scroll': True,
|
2009-11-09 22:33:17 +00:00
|
|
|
'split_to_group' : False,
|
|
|
|
'autoclean_groups' : True,
|
2008-08-15 12:40:10 +00:00
|
|
|
'keybindings' : {
|
|
|
|
'zoom_in' : '<Ctrl>plus',
|
|
|
|
'zoom_out' : '<Ctrl>minus',
|
|
|
|
'zoom_normal' : '<Ctrl>0',
|
|
|
|
'new_root_tab' : '<Ctrl><Shift><Alt>T',
|
|
|
|
'new_tab' : '<Ctrl><Shift>T',
|
2008-08-23 22:57:51 +00:00
|
|
|
'go_next' : ('<Ctrl><Shift>N','<Ctrl>Tab'),
|
|
|
|
'go_prev' : ('<Ctrl><Shift>P','<Ctrl><Shift>Tab'),
|
2008-12-19 07:41:55 +00:00
|
|
|
'go_up' : '<Alt>Up',
|
|
|
|
'go_down' : '<Alt>Down',
|
|
|
|
'go_left' : '<Alt>Left',
|
|
|
|
'go_right' : '<Alt>Right',
|
2008-08-15 12:40:10 +00:00
|
|
|
'split_horiz' : '<Ctrl><Shift>O',
|
|
|
|
'split_vert' : '<Ctrl><Shift>E',
|
|
|
|
'close_term' : '<Ctrl><Shift>W',
|
|
|
|
'copy' : '<Ctrl><Shift>C',
|
|
|
|
'paste' : '<Ctrl><Shift>V',
|
|
|
|
'toggle_scrollbar' : '<Ctrl><Shift>S',
|
|
|
|
'search' : '<Ctrl><Shift>F',
|
|
|
|
'close_window' : '<Ctrl><Shift>Q',
|
|
|
|
'resize_up' : '<Ctrl><Shift>Up',
|
|
|
|
'resize_down' : '<Ctrl><Shift>Down',
|
|
|
|
'resize_left' : '<Ctrl><Shift>Left',
|
|
|
|
'resize_right' : '<Ctrl><Shift>Right',
|
|
|
|
'move_tab_right' : '<Ctrl><Shift>Page_Down',
|
|
|
|
'move_tab_left' : '<Ctrl><Shift>Page_Up',
|
|
|
|
'toggle_zoom' : '<Ctrl><Shift>X',
|
|
|
|
'scaled_zoom' : '<Ctrl><Shift>Z',
|
|
|
|
'next_tab' : '<Ctrl>Page_Down',
|
|
|
|
'prev_tab' : '<Ctrl>Page_Up',
|
2009-01-21 08:29:32 +00:00
|
|
|
'switch_to_tab_1' : None,
|
|
|
|
'switch_to_tab_2' : None,
|
|
|
|
'switch_to_tab_3' : None,
|
|
|
|
'switch_to_tab_4' : None,
|
|
|
|
'switch_to_tab_5' : None,
|
|
|
|
'switch_to_tab_6' : None,
|
|
|
|
'switch_to_tab_7' : None,
|
|
|
|
'switch_to_tab_8' : None,
|
|
|
|
'switch_to_tab_9' : None,
|
|
|
|
'switch_to_tab_10' : None,
|
2008-08-15 12:40:10 +00:00
|
|
|
'full_screen' : 'F11',
|
2008-11-17 10:42:34 +00:00
|
|
|
'reset' : '<Ctrl><Shift>R',
|
|
|
|
'reset_clear' : '<Ctrl><Shift>G',
|
2009-01-25 18:33:22 +00:00
|
|
|
'hide_window' : '<Ctrl><Shift><Alt>a',
|
2009-05-23 16:05:50 +00:00
|
|
|
'group_all' : '<Super>g',
|
|
|
|
'ungroup_all' : '<Super><Shift>g',
|
|
|
|
'group_tab' : '<Super>t',
|
|
|
|
'ungroup_tab' : '<Super><Shift>T',
|
2009-05-28 08:29:56 +00:00
|
|
|
'new_window' : '<Ctrl><Shift>I',
|
2008-08-15 12:40:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
class Config(Borg, dict):
|
|
|
|
"""Class to provide access to our user configuration"""
|
2008-08-15 12:40:10 +00:00
|
|
|
|
2009-11-20 22:46:50 +00:00
|
|
|
defaults = None
|
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
def __init__(self):
|
|
|
|
"""Class initialiser"""
|
2008-04-07 20:49:10 +00:00
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
Borg.__init__(self)
|
|
|
|
dict.__init__(self)
|
2008-03-08 00:04:41 +00:00
|
|
|
|
2009-11-20 22:52:26 +00:00
|
|
|
self.prepare_attributes()
|
|
|
|
|
2009-11-20 22:46:50 +00:00
|
|
|
def prepare_attributes(self):
|
|
|
|
"""Set up our borg environment"""
|
|
|
|
if self.defaults is None:
|
|
|
|
self.defaults = DEFAULTS
|
|
|
|
|
2009-08-18 11:46:41 +00:00
|
|
|
def __getitem__(self, key):
|
|
|
|
"""Look up a configuration item"""
|
2009-11-20 22:46:50 +00:00
|
|
|
return(self.defaults[key])
|
2008-03-08 00:04:41 +00:00
|
|
|
|