Skip to content

Instantly share code, notes, and snippets.

@ckjoris
Created August 12, 2023 20:32
Show Gist options
  • Save ckjoris/cf2b3a7ef729e629409db47d29009b04 to your computer and use it in GitHub Desktop.
Save ckjoris/cf2b3a7ef729e629409db47d29009b04 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3.10
def toggle_guake_by_dbus():
import dbus # pylint: disable=import-outside-toplevel
import time
try:
bus = dbus.SessionBus()
remote_object = bus.get_object(
"org.guake3.RemoteControl", "/org/guake3/RemoteControl"
)
visibility = remote_object.get_visibility()
if visibility == 0:
remote_object.show()
time.sleep(0.2)
remote_object.show()
else:
remote_object.hide()
except dbus.DBusException:
pass
if __name__ == "__main__":
toggle_guake_by_dbus()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment