Skip to content

Commit d1f9ec7

Browse files
committed
Always show Show/Hide on right clicking the tray, fixes #53
1 parent f3eb99b commit d1f9ec7

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

scc/gui/app.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""SC-Controller - App.
1+
"""SC Controller - App.
22
33
Main application window
44
"""
@@ -40,8 +40,8 @@
4040
class App(Gtk.Application, UserDataManager, BindingEditor):
4141
"""Main application / window."""
4242

43-
HILIGHT_COLOR = "#FF00FF00" # ARGB
44-
OBSERVE_COLOR = "#FF60A0FF" # ARGB
43+
HILIGHT_COLOR = "#FF00FF00" # ARGB
44+
OBSERVE_COLOR = "#FF60A0FF" # ARGB
4545
CONFIG = "scc.config.json"
4646
RELEASE_URL = "https://github.com/C0rn3j/sc-controller/releases/tag/v%s"
4747
OSD_MODE_PROF_NAME = ".scc-osd.profile_editor"
@@ -276,14 +276,15 @@ def apply_ui_layout(self, layout):
276276
btLGRIP.get_parent().reorder_child(btDPAD, 5)
277277

278278

279-
def setup_statusicon(self):
279+
def setup_statusicon(self) -> None:
280280
menu = self.builder.get_object("mnuTray")
281281
self.statusicon = get_status_icon(self.imagepath, menu)
282-
self.statusicon.connect('clicked', self.on_statusicon_clicked)
283-
if not self.statusicon.is_clickable():
284-
self.builder.get_object("mnuShowWindowTray").set_visible(True)
285-
GLib.idle_add(self.statusicon.set, "scc-%s" % (self.status,), _("SC Controller"))
286-
282+
self.statusicon.connect("clicked", self.on_statusicon_clicked)
283+
# if not self.statusicon.is_clickable():
284+
# self.builder.get_object("mnuShowWindowTray").set_visible(True)
285+
# Workaround - always add it to the menu, see https://github.com/C0rn3j/sc-controller/issues/53
286+
self.builder.get_object("mnuShowWindowTray").set_visible(True)
287+
GLib.idle_add(self.statusicon.set, f"scc-{self.status}", _("SC Controller"))
287288

288289
def destroy_statusicon(self):
289290
self.statusicon.destroy()
@@ -454,8 +455,8 @@ def save_config(self):
454455
self.enable_test_mode()
455456

456457

457-
def on_statusicon_clicked(self, *a):
458-
""" Handler for user clicking on tray icon button """
458+
def on_statusicon_clicked(self, *a) -> None:
459+
"""Handler for user clicking on tray icon button."""
459460
self.window.set_visible(not self.window.get_visible())
460461

461462

@@ -865,7 +866,7 @@ def on_mnuExit_activate(self, *a):
865866
self.quit()
866867

867868

868-
def on_mnuAbout_activate(self, *a):
869+
def on_mnuAbout_activate(self, *a) -> None:
869870
from scc.gui.aboutdialog import AboutDialog
870871
AboutDialog(self).show(self.window)
871872

@@ -1354,7 +1355,7 @@ def on_mnuEmulationEnabled_toggled(self, cb):
13541355
self.dm.stop()
13551356

13561357

1357-
def do_startup(self, *a):
1358+
def do_startup(self, *a) -> None:
13581359
Gtk.Application.do_startup(self, *a)
13591360
self.load_profile_list()
13601361
self.setup_widgets()

scc/gui/global_settings.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#!/usr/bin/env python3
2-
"""
3-
SC-Controller - Global Settings
1+
"""SC Controller - Global Settings.
42
53
Currently setups only one thing...
64
"""
@@ -29,7 +27,12 @@
2927
from scc.osd.osk_actions import OSKCursorAction
3028
import scc.osd.osk_actions
3129

32-
import re, sys, os, json, logging, traceback
30+
import re
31+
import sys
32+
import os
33+
import json
34+
import logging
35+
import traceback
3336
log = logging.getLogger("GS")
3437

3538
class GlobalSettings(Editor, UserDataManager, ComboSetter):
@@ -304,8 +307,8 @@ def cb(*a):
304307
self._timer = GLib.timeout_add_seconds(3, cb)
305308

306309

307-
def save_config(self):
308-
""" Transfers settings from UI back to config """
310+
def save_config(self) -> None:
311+
"""Transfers settings from UI back to config."""
309312
# Store hard stuff
310313
tvItems = self.builder.get_object("tvItems")
311314
cbShowOSD = self.builder.get_object("cbShowOSD")

scc/gui/statusicon.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def show(self):
110110
self.__hidden = False
111111
self._set_visible(self.__visible)
112112

113-
def is_clickable(self):
114-
""" Basically, returns False is appindicator is used """
113+
def is_clickable(self) -> bool:
114+
"""Basically, returns False is appindicator is used."""
115115
return True
116116

117117
def _is_forced(self):
@@ -279,7 +279,7 @@ def _set_visible(self, active):
279279

280280
self._tray.set_status(self._status_active if active else self._status_passive)
281281

282-
def is_clickable(self):
282+
def is_clickable(self) -> bool:
283283
return False
284284

285285
def destroy(self):
@@ -362,7 +362,7 @@ def _load_fallback(self):
362362
# Update fallback icon
363363
self.set(self._icon, self._text)
364364

365-
def is_clickable(self):
365+
def is_clickable(self) -> bool:
366366
if self._status_gtk:
367367
return self._status_gtk.is_clickable()
368368
if self._status_fb:

0 commit comments

Comments
 (0)