Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'hide' hotkey for hiding guake window unconditionally without opening and showing it #1135

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions guake/data/org.guake.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@
<summary>Keybinding to show and focus guake.</summary>
<description>Global keybinding to allow user call guake from each place after it's opened without clicks.</description>
</key>
<key name="hide" type="s">
<default>''</default>
<summary>Keybinding to hide guake.</summary>
<description>Global keybinding to allow user call guake from each place after it's opened without clicks.</description>
</key>
</schema>
<schema id="guake.keybindings.local" path="/apps/guake/keybindings/local/">
<key name="quit" type="s">
Expand Down
11 changes: 11 additions & 0 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,17 @@ def show_focus(self, *args):
self.show()
self.set_terminal_focus()

def hide_win(self, *args):

if self.forceHide:
self.forceHide = False
return

if self.preventHide:
return

self.hide()

def win_prepare(self, *args):
# TODO PORT reenable this after keybinder fixes (this is mostly done but needs testing)
event_time = self.hotkeys.get_current_event_time()
Expand Down
6 changes: 5 additions & 1 deletion guake/keybindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, guake):

# Setup global keys
self.globalhotkeys = {}
globalkeys = ['show-hide', 'show-focus']
globalkeys = ['show-hide', 'show-focus', 'hide']
for key in globalkeys:
guake.settings.keybindingsGlobal.onChangedValue(key, self.reload_global)
guake.settings.keybindingsGlobal.triggerOnChangedValue(
Expand Down Expand Up @@ -98,6 +98,10 @@ def reload_global(self, settings, key, user_data):
if not self.guake.hotkeys.bind(value, self.guake.show_focus):
print("can't bind show-focus key")
return
elif key == "hide":
if not self.guake.hotkeys.bind(value, self.guake.hide_win):
print("can't bind hide key")
return

def reload_accelerators(self, *args):
"""Reassign an accel_group to guake main window and guake
Expand Down
9 changes: 7 additions & 2 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
'key': 'show-focus',
'label': _('Show and focus Guake window')
},
{
'key': 'hide',
'label': _('Hide Guake window')
},
{
'key': 'toggle-fullscreen',
'label': _('Toggle Fullscreen')
Expand Down Expand Up @@ -1084,7 +1088,8 @@ def populate_keys_tree(self):
model.set(giter, 0, '', 1, _(group['label']))
for item in group['keys']:
child = model.append(giter)
if item['key'] == "show-hide" or item['key'] == "show-focus":
if item['key'] == "show-hide" or item['key'] == "show-focus"
or item['key'] == "hide":
accel = self.settings.keybindingsGlobal.get_string(item['key'])
else:
accel = self.settings.keybindingsLocal.get_string(item['key'])
Expand Down Expand Up @@ -1170,7 +1175,7 @@ def each_key(model, path, subiter):
model.set_value(giter, 2, hotkey)

# setting the new value in gconf
if gconf_path == "show-hide" or gconf_path == "show-focus":
if gconf_path == "show-hide" or gconf_path == "show-focus" or gconf_path == "hide":
self.settings.keybindingsGlobal.set_string(gconf_path, key)
else:
self.settings.keybindingsLocal.set_string(gconf_path, key)
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/hide-win-hotkey-4d48cf5c34809d90.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
features:
- |
The additional feature to manipulate guake window from global environment.
You can use show-hide hotkey to hide window, but for convenient purposes
there are hide-win hotkey. It is useful when you don't want to check what
state of guake window have and just to use direct action.