Skip to content

Commit

Permalink
add guake-toggle command
Browse files Browse the repository at this point in the history
to call dbus message directly

Signed-off-by: Gaetan Semet <[email protected]>
  • Loading branch information
gsemet committed Jun 6, 2018
1 parent 51aa791 commit 150a3a7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions docs/source/user/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ you can register the following snippet in your window manager
dbus-send --type=method_call --dest=org.guake3.RemoteControl \
/org/guake3/RemoteControl org.guake3.RemoteControl.show_hide
You can use the simpler
You can use the simpler:

.. code-block:: bash
guake -t
guake-toggle
But it will be slower since ultimately it sends the very same D-Bus message but will execute all
the Guake initialization procedure.
Please note the command `guake -t` will also toggle Guake but since it initialize a bit more than just
necessary, it can be slower that the two previous commands.

Note on Wayland
---------------
Expand All @@ -30,7 +30,7 @@ For more context, see issue #1041.

The workaround is setting a manual keybinding as described above.
On Fedora 26, for example, this can be accomplished by going to *Settings > Keyboard* and
adding a new custom shortcut to execute :code:`guake -t`.
adding a new custom shortcut to execute :code:`guake-toggle`.

Note for Archlinux users
------------------------
Expand Down
1 change: 1 addition & 0 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ def window_event(self, window, event):
def show_hide(self, *args):
"""Toggles the main window visibility
"""
log.debug("Show_hide called")
if self.forceHide:
self.forceHide = False
return
Expand Down
10 changes: 10 additions & 0 deletions guake/guake_toggle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def toggle_guake_by_dbus():
import dbus

try:
bus = dbus.SessionBus()
remote_object = bus.get_object('org.guake3.RemoteControl', '/org/guake3/RemoteControl')
print("Sending 'toggle' message to Guake3")
remote_object.show_hide()
except dbus.DBusException:
pass
12 changes: 12 additions & 0 deletions releasenotes/notes/wayland-3fcce3b30835e66d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fixes:
- |
Wayland is a bit more well supported. The X11 backend is now used by default for
GDK and it seems to make the shortcut works under most situation.
A more cleaner solution would be to develop a GAction
(`vote for this feature here <https://feathub.com/Guake/guake/+29>`_])
- |
A new command has been added: ``guake-toggle``, should be faster than
``guake -t``. You can use it when you register the global shortcut manually
(X11 or Wayland).
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ flake8
mock>=2.0.0
pep8
pipenv-to-requirements
pyflakes
pyflakes<2.0.0
pylint
pytest
pytest-mock
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ package_files =
[entry_points]
console_scripts =
guake = guake.main:exec_main
guake-toggle = guake.guake_toggle:toggle_guake_by_dbus

[build_sphinx]
source-dir = doc/source
Expand Down

0 comments on commit 150a3a7

Please sign in to comment.