I have been using Terminator as a drop-down terminal, using the hide_window key binding. It works well, but has a glaring flaw. When the Terminator window is unhidden, it doesn't have focus. And often enough, I just press the key for Terminator, start typing immediately ... and hilarity ensues. How do I make Terminator gain focus as well?

  • GNOME Shell
  • Arch Linux / Ubuntu 14.04 (the behaviour is the same on both systems)
  • There is only one Terminator window running at any given time.

Sometimes, unhiding-hiding-unhiding in quick succession results in Terminator having focus, but this is very cumbersome (and somewhat unreliable).

  • GNOME terminator, right? gnometerminator.blogspot.fr – Braiam Mar 21 '15 at 13:15
  • @Braiam yes. So a consensus has been reached on the tagging question? – muru Mar 21 '15 at 13:27
  • 1
    The only consensus is that something should be done, and since nobody decided what I will go for the safest one, retag all gnome terminator as gnome terminator. – Braiam Mar 21 '15 at 13:37
  • Ha, funny. I have set to focus follows pointer in XFCE and it just doesn't hide at all. – Braiam Mar 21 '15 at 16:10
  • You may have already investigated this idea, but focus-stealing prevention might be relevant. Comments in this bug report including mine suggest that it's important. IDK how that works in Gnome Shell though. – Sparhawk Mar 24 '15 at 13:54

Try this patch. I found it on the bug report @Sparhawk provided and the user said it worked. I assume you know how to use the patch command. It also worked for me. (I have the same issue.)

Click here for a comprehensive patch manual.

=== modified file 'terminatorlib/window.py'
--- terminatorlib/window.py 2011-08-22 20:05:38 +0000
+++ terminatorlib/window.py 2012-03-30 21:02:28 +0000
@@ -273,6 +273,12 @@
             if self.position:
                 self.move(self.position[0], self.position[1])
+            self.grab_focus()
+            try:
+                t = gtk.gdk.x11_get_server_time(self.window)
+            except AttributeError:
+                t = 0
+            self.window.focus(t)
             self.position = self.get_position()

With Terminator 1.90, it seems a different change has to be made. From comment #18 on the same bug report:

I've changed lines 307-311 to:

            from gi.repository import GdkX11
            t = GdkX11.x11_get_server_time(self.get_window())
        except AttributeError:
            t = 0
| improve this answer | |
  • Worked for me too. – Shashwat Kumar Apr 18 '16 at 20:44
  • does this work for Terminator 1.91 too? – Jesse Apr 11 '17 at 12:19
  • Thanks, second patch ".. I've changed lines 307-311 to: .." worked for me. OS: Debian GNU/Linux 9.12 (stretch) Terminator: 1.90 – csonuryilmaz Apr 12 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.