diff options
Diffstat (limited to 'saneterm')
-rw-r--r-- | saneterm/terminal.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/saneterm/terminal.py b/saneterm/terminal.py index c25f596..9a254c1 100644 --- a/saneterm/terminal.py +++ b/saneterm/terminal.py @@ -82,6 +82,7 @@ class Terminal(Gtk.Window): self.connect("configure-event", self.update_size) self.connect("destroy", self.destroy) + self.connect_after("set-focus", self.focus) bindings = keys.Bindings(self.termview) for key, idx in keys.CTRL.items(): @@ -109,6 +110,14 @@ class Terminal(Gtk.Window): (GObject.TYPE_LONG,)) self.termview.connect("history-entry", self.history) + def focus(self, window, widget): + # If no widget is focused, focus the termview by default. + # This occurs, for instance, after closing the SearchBar. + # + # XXX: Is there a better way to do this? + if widget is None: + self.emit("set-focus", self.termview) + def destroy(self, widget): self.hist.close() |