Skip to content

feature: --is-visible option #1926 #2008

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

Merged
merged 3 commits into from
Jan 16, 2022
Merged
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
4 changes: 4 additions & 0 deletions guake/dbusiface.py
Original file line number Diff line number Diff line change
@@ -61,6 +61,10 @@ def hide(self):
def hide_from_remote(self):
self.guake.hide_from_remote()

@dbus.service.method(DBUS_NAME, out_signature="i")
def get_visibility(self):
return self.guake.get_visibility()

@dbus.service.method(DBUS_NAME)
def fullscreen(self):
self.guake.fullscreen()
5 changes: 5 additions & 0 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
@@ -599,6 +599,11 @@ def show_hide(self, *args):
log.debug("Hiding the terminal")
self.hide()

def get_visibility(self):
if self.hidden:
return 0
return 1

def show_focus(self, *args):
self.win_prepare()
self.show()
13 changes: 13 additions & 0 deletions guake/main.py
Original file line number Diff line number Diff line change
@@ -122,6 +122,14 @@ def main():
help=_("Toggles the visibility of the terminal window"),
)

parser.add_option(
"--is-visible",
dest="is_visible",
action="store_true",
default=False,
help=_("Return 1 if Guake is visible, 0 otherwise"),
)

parser.add_option(
"--show",
dest="show",
@@ -486,6 +494,11 @@ def main():
if options.hide:
remote_object.hide_from_remote()

if options.is_visible:
visibility = remote_object.get_visibility()
sys.stdout.write(f"{visibility}\n")
only_show_hide = options.show

if options.show_preferences:
remote_object.show_prefs()
only_show_hide = options.show
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

features:

- --is-visible option returns 1 when visible, and 0 when not #1926