Skip to content

Commit

Permalink
Implement --is-version option
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeb authored and Davidy22 committed Jan 16, 2022
1 parent d882f07 commit f69d7c0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
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 @@ -598,6 +598,11 @@ def show_hide(self, *args):
else:
log.debug("Hiding the terminal")
self.hide()

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

def show_focus(self, *args):
self.win_prepare()
Expand Down
13 changes: 13 additions & 0 deletions guake/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ def main():
help=_("Show support information"),
)

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

# checking mandatory dependencies

missing_deps = False
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

0 comments on commit f69d7c0

Please sign in to comment.