Commits

nakamura committed 7ce0011

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

Comments (0)

Files changed (1)

                 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):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.