Skip to content

Commit 8f38cb0

Browse files
committed
Fix AttributeError: 'App' object has no attribute 'appindicator
The error occurred when timetracker was started without arguments while another instance was already running
1 parent 822a603 commit 8f38cb0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/timetracker

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ class App(Gtk.Application):
9292
action.connect("activate", self.handle_quit)
9393
self.add_action(action)
9494

95+
self.appindicator: AppIndicator3.Indicator = AppIndicator3.Indicator.new(
96+
id="timetracker",
97+
icon_name=os.path.join(ICONS_DIR, "gtk-no.svg"),
98+
category=AppIndicator3.IndicatorCategory.APPLICATION_STATUS
99+
)
100+
95101
self.register()
96102
if self.get_is_remote():
97103
return
@@ -122,11 +128,6 @@ class App(Gtk.Application):
122128
# self.tray_icon.connect("popup-menu", self.show_menu)
123129

124130
# Add AppIndicator icon
125-
self.appindicator: AppIndicator3.Indicator = AppIndicator3.Indicator.new(
126-
id="timetracker",
127-
icon_name=os.path.join(ICONS_DIR, "gtk-no.svg"),
128-
category=AppIndicator3.IndicatorCategory.APPLICATION_STATUS
129-
)
130131
self.appindicator.set_status(AppIndicator3.IndicatorStatus.ACTIVE)
131132
self.appindicator.set_menu(self.menu)
132133
self.appindicator.set_attention_icon_full(

0 commit comments

Comments
 (0)