set focus and send on control+enter

This commit is contained in:
Morgan McMillian 2020-12-16 12:42:34 -08:00
parent ab947c2fce
commit 52efdacbe5

View file

@ -72,8 +72,15 @@ class ComposeWindow(Handy.Window):
self.add(box)
self.show_all()
textarea.grab_focus()
self.connect('key-release-event', self.on_key_release)
self.connect('key-press-event', self.on_key_press)
def on_key_press(self, widget, ev, data=None):
ctrl = (ev.state & Gdk.ModifierType.CONTROL_MASK)
if ctrl and ev.keyval == Gdk.KEY_Return:
self.send_post(None)
def on_key_release(self, widget, ev, data=None):
if ev.keyval == Gdk.KEY_Escape: