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

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

Merged
merged 3 commits into from
Jan 16, 2022
Merged
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
4 changes: 4 additions & 0 deletions guake/dbusiface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions guake/guake_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions guake/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
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