1. nakamura
  2. silk

Commits

nakamura  committed 7ce0011

make Ctrl + Alt + Shift + s toggle all terminal's sync mode

  • Participants
  • Parent commits af3009f
  • Branches default

Comments (0)

Files changed (1)

File silk.py

View file
                 self._sync_check.set_active(not self._sync_check.get_active())
                 return True
 
+    def set_sync(self, is_synced):
+        self._sync_check.set_active(is_synced)
+
 
 class Config(object):
     def __init__(self, **kwargs):
 
         term_frame.terminal.connect_object('commit',
                                            self.do_term_commit, term_frame)
+        term_frame.terminal.connect_object('key-press-event',
+                                           self.do_term_key_press, term_frame)
 
         term_frame.show_all()
 
                    not t.terminal.child_exited and t.is_synced:
                     t.terminal.feed_child(text, length)
 
+    def do_term_key_press(self, term_frame, event):
+        keyname = Gdk.keyval_name(event.keyval)
+
+        # FIXME: wrap 80 chars
+        if event.state == Gdk.ModifierType.CONTROL_MASK|Gdk.ModifierType.MOD1_MASK|Gdk.ModifierType.SHIFT_MASK:
+            # Ctrl + Alt + Shift + ...
+            if keyname == 'S':
+                self.sync_all(not term_frame.is_synced)
+                return True
+
+    def sync_all(self, is_synced):
+        for t in self.terminals:
+            t.set_sync(is_synced)
+
 
 # for develop/debug
 def dump_props(widgets):