From ec649aaa31a53e2f8384dfc8e0c429d1369a8280 Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Fri, 7 Mar 2014 22:50:06 +0000 Subject: [PATCH] Configurable broadcast group --- doc/terminator_config.5 | 4 +++ terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 53 +++++++++++++++++++++++++++++++++ terminatorlib/prefseditor.py | 22 ++++++++++++++ terminatorlib/terminator.py | 7 +++-- 5 files changed, 85 insertions(+), 2 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index c71d5c41..70ba8034 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -61,6 +61,10 @@ Defines where tabs are placed. Can be any of: top, left, right, bottom. If this is set to "hidden", the tab bar will not be shown. Note that hiding the tab bar is very confusing and not recommended. Default value: \fBtop\fR .TP +.B broadcast_group +Defines broadcast behavior. Can be any of: all, group, off. +Default value: \fBgroup\fR +.TP .B close_button_on_tab \fR(boolean) If set to True, tabs will have a close button on them. Default value: \fBTrue\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 801dc9c0..9a85af16 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -83,6 +83,7 @@ DEFAULTS = { 'window_state' : 'normal', 'borderless' : False, 'tab_position' : 'top', + 'broadcast_group' : 'group', 'close_button_on_tab' : True, 'hide_tabbar' : False, 'scroll_tabbar' : False, diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 628350db..a3e9bf95 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -256,6 +256,23 @@ + + + + + + + + All + + + Group + + + None + + + @@ -530,6 +547,42 @@ GTK_EXPAND + + + True + False + Broadcast group + + + 18 + 19 + + + + + + + True + False + BroadcastGroupListStore + 0 + + + + + 0 + + + + + 1 + 2 + 18 + 19 + + GTK_EXPAND + + True diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 9e3c684d..1bfa71c6 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -248,6 +248,16 @@ class PrefsEditor: else: active = 0 widget.set_active(active) + # Broadcast group + option = self.config['broadcast_group'] + widget = guiget('broadcastgroup') + if option == 'all': + active = 0 + elif option == 'off': + active = 2 + else: + active = 1 + widget.set_active(active) # scroll_tabbar widget = guiget('scrolltabbarcheck') widget.set_active(self.config['scroll_tabbar']) @@ -1007,6 +1017,18 @@ class PrefsEditor: self.config['tab_position'] = value self.config.save() + def on_broadcastgroup_changed(self, widget): + """Broadcast group changed""" + selected = widget.get_active() + if selected == 0: + value = 'all' + elif selected == 2: + value = 'off' + else: + value = 'group' + self.config['broadcast_group'] = value + self.config.save() + def on_winstatecombo_changed(self, widget): """Window state changed""" selected = widget.get_active() diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index fad51f54..25870bab 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -56,10 +56,10 @@ class Terminator(Borg): self.terminals = [] if not self.groups: self.groups = [] - if self.groupsend == None: - self.groupsend = self.groupsend_type['off'] if not self.config: self.config = Config() + if self.groupsend == None: + self.groupsend = self.groupsend_type[self.config['broadcast_group']] if not self.keybindings: self.keybindings = Keybindings() self.keybindings.configure(self.config['keybindings']) @@ -370,6 +370,9 @@ class Terminator(Borg): if maker.isinstance(child, 'Notebook'): child.configure() + # Set broadcasting group + self.groupsend = self.groupsend_type[self.config['broadcast_group']] + def create_group(self, name): """Create a new group""" if name not in self.groups: