From bb9030e257b55e6586c3540892ac73cb9f90b92b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 1 Oct 2013 18:10:28 +0200 Subject: [PATCH] Add option to give back the focus to guake instead of hidding the window if it's opened and out of focus --- data/guake.schemas | 16 +++++++++++++++- src/guake | 10 +++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/data/guake.schemas b/data/guake.schemas index e744283d..0ba51715 100644 --- a/data/guake.schemas +++ b/data/guake.schemas @@ -514,7 +514,7 @@ true If guake must show a control to make resizing more handful - When true, guake shows a resizer on its bottom to allow user + When true, guake shows a resizer on its bottom to allow user resize guake. @@ -530,5 +530,19 @@ Set it as false to enjoy guake's fullscreen. + + + /schemas/apps/guake/general/focus_if_open + /apps/guake/general/focus_if_open + guake + bool + true + + Give focus to guake if tab is opened. + If the guake window is out of focus but open, + enabling this will give it back the focus instead of closing the window. + + + diff --git a/src/guake b/src/guake index db2e0822..b19f6893 100755 --- a/src/guake +++ b/src/guake @@ -280,7 +280,7 @@ class GConfHandler(object): client.get_string(KEY('/style/font/color'))) bgcolor = gtk.gdk.color_parse( client.get_string(KEY('/style/background/color'))) - palette = [gtk.gdk.color_parse(color) for color in + palette = [gtk.gdk.color_parse(color) for color in entry.value.get_string().split(':')] for i in self.guake.term_list: i.set_colors(fgcolor, bgcolor, palette) @@ -826,9 +826,13 @@ class Guake(SimpleGladeApp): if not self.window.get_property('visible'): self.show() self.set_terminal_focus() - else: + elif not self.client.get_bool(KEY('general/focus_if_open')) and \ + self.window.window.get_state() == gtk.gdk.WINDOW_STATE_ABOVE: self.hide() - + else: + self.show() + self.set_terminal_focus() + def show(self): """Shows the main window and grabs the focus on it. """