Skip to content
Open
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
8 changes: 8 additions & 0 deletions appindicator-broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ def _create(self, identifier, icon):
if identifier in self._indicators:
print("Not creating the same identifier twice")
return
with open("/tmp/appindicators.created", "a") as myfile:
myfile.write(identifier + "\n")
with open("/tmp/appindicators.visible", "a") as myfile:
myfile.write(identifier + "\n")
indicator = AppIndicator3.Indicator.new(
identifier, icon,
AppIndicator3.IndicatorCategory.APPLICATION_STATUS
Expand All @@ -70,9 +74,13 @@ def _label(self, indicator, args):
indicator.set_label(args, args)

def _hide(self, indicator, args):
identifier = indicator.get_id()
os.system("sed -i '/^" + identifier + "$/ d' /tmp/appindicators.visible")
indicator.set_status(AppIndicator3.IndicatorStatus.PASSIVE)

def _show(self, indicator, args):
identifier = indicator.get_id()
os.system("grep -q " + identifier + " /tmp/appindicators.visible || echo '" + identifier + "' >>/tmp/appindicators.visible")
indicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)

def _menu_clear(self, indicator, args):
Expand Down