Skip to content

Commit 3363a77

Browse files
committed
Add toggle theme action to systray icon
1 parent da8eb85 commit 3363a77

File tree

5 files changed

+136
-118
lines changed

5 files changed

+136
-118
lines changed
86 Bytes
Binary file not shown.

resources/translations/yin_yang.de_DE.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,19 @@
9292
<context>
9393
<name>systray</name>
9494
<message>
95-
<location filename="../../yin_yang/__main__.py" line="119"/>
95+
<location filename="../../yin_yang/__main__.py" line="120"/>
9696
<source>Open Yin Yang</source>
9797
<comment>Context menu action in the systray</comment>
9898
<translation>Yin Yang öffnen</translation>
9999
</message>
100100
<message>
101-
<location filename="../../yin_yang/__main__.py" line="120"/>
101+
<location filename="../../yin_yang/__main__.py" line="121"/>
102+
<source>Toggle theme</source>
103+
<comment>Context menu action in the systray</comment>
104+
<translation type="unfinished">Farbschema wechseln</translation>
105+
</message>
106+
<message>
107+
<location filename="../../yin_yang/__main__.py" line="122"/>
102108
<source>Quit</source>
103109
<comment>Context menu action in the systray</comment>
104110
<translation>Beenden</translation>

resources/translations/yin_yang.nl_NL.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,19 @@
9292
<context>
9393
<name>systray</name>
9494
<message>
95-
<location filename="../../yin_yang/__main__.py" line="119"/>
95+
<location filename="../../yin_yang/__main__.py" line="120"/>
9696
<source>Open Yin Yang</source>
9797
<comment>Context menu action in the systray</comment>
9898
<translation type="unfinished"></translation>
9999
</message>
100100
<message>
101-
<location filename="../../yin_yang/__main__.py" line="120"/>
101+
<location filename="../../yin_yang/__main__.py" line="121"/>
102+
<source>Toggle theme</source>
103+
<comment>Context menu action in the systray</comment>
104+
<translation type="unfinished"></translation>
105+
</message>
106+
<message>
107+
<location filename="../../yin_yang/__main__.py" line="122"/>
102108
<source>Quit</source>
103109
<comment>Context menu action in the systray</comment>
104110
<translation type="unfinished"></translation>

yin_yang/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def systray_icon_clicked(reason: QSystemTrayIcon.ActivationReason):
118118

119119
menu = QMenu('Yin & Yang')
120120
menu.addAction(app.translate('systray', 'Open Yin Yang', 'Context menu action in the systray'), lambda: window.show())
121+
menu.addAction(app.translate('systray', 'Toggle theme', 'Context menu action in the systray'), lambda: theme_switcher.set_mode(not config.dark_mode))
121122
menu.addAction(QIcon.fromTheme('application-exit'), app.translate('systray', 'Quit', 'Context menu action in the systray'), app.quit)
122123

123124
icon.setContextMenu(menu)

yin_yang/ui/resources_rc.py

Lines changed: 119 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -6,123 +6,128 @@
66
from PySide6 import QtCore
77

88
qt_resource_data = b"\
9-
\x00\x00\x07!\
9+
\x00\x00\x07w\
1010
<\
1111
\xb8d\x18\xca\xef\x9c\x95\xcd!\x1c\xbf`\xa1\xbd\xdd\xa7\
12-
\x00\x00\x00\x05de_DEB\x00\x00\x00\x90\x00\x04\
12+
\x00\x00\x00\x05de_DEB\x00\x00\x00\x98\x00\x04\
1313
\xa8\x8b\x00\x00\x00\xd6\x00\x05\x8c\x04\x00\x00\x068\x00\x0a\
1414
KE\x00\x00\x02t\x00J\x88\xea\x00\x00\x01\x06\x00R\
15-
\xfd\xf4\x00\x00\x01\xd7\x00\x89?\xc9\x00\x00\x05x\x03^\
16-
\x05u\x00\x00\x00o\x05/\xdfz\x00\x00\x02\x04\x06\x99\
17-
\x04U\x00\x00\x03\xeb\x07;\xe0\x03\x00\x00\x03\x19\x0ai\
18-
\xf3\xe7\x00\x00\x05\xf1\x0a\xa0\x8cG\x00\x00\x00\x00\x0b\x0b\
19-
\xe8\x0a\x00\x00\x01\x96\x0b\xa1\xae>\x00\x00\x04^\x0c\xbb\
20-
\x01s\x00\x00\x03\xa9\x0e\x0e\x8c\xca\x00\x00\x024\x0f\x0a\
21-
g\xee\x00\x00\x03@\x0fF^:\x00\x00\x019i\x00\
22-
\x00\x06f\x03\x00\x00\x006\x00A\x00u\x00t\x00o\
23-
\x00m\x00a\x00t\x00i\x00s\x00c\x00h\x00e\
24-
\x00r\x00 \x00T\x00h\x00e\x00m\x00e\x00n\
25-
\x00w\x00e\x00c\x00h\x00s\x00e\x00l\x08\x00\
26-
\x00\x00\x00\x06\x00\x00\x00\x19Automati\
27-
c theme switchin\
28-
g\x07\x00\x00\x00\x0bmain_windo\
29-
w\x01\x03\x00\x00\x008\x00B\x00e\x00n\x00u\x00\
30-
t\x00z\x00e\x00r\x00d\x00e\x00f\x00i\x00\
31-
n\x00i\x00e\x00r\x00t\x00e\x00r\x00 \x00\
32-
Z\x00e\x00i\x00t\x00r\x00a\x00u\x00m\x08\
33-
\x00\x00\x00\x00\x06\x00\x00\x00\x0fCustom \
34-
Schedule\x07\x00\x00\x00\x0bmai\
35-
n_window\x01\x03\x00\x00\x00\x0c\x00D\
36-
\x00u\x00n\x00k\x00e\x00l\x08\x00\x00\x00\x00\x06\
37-
\x00\x00\x00\x04Dark\x07\x00\x00\x00\x0bmai\
38-
n_window\x01\x03\x00\x00\x00\x0e\x00D\
39-
\x00u\x00n\x00k\x00e\x00l\x00:\x08\x00\x00\x00\
40-
\x00\x06\x00\x00\x00\x05Dark:\x07\x00\x00\x00\x0b\
41-
main_window\x01\x03\x00\x00\x00\
42-
,\x00V\x00e\x00r\x00z\x00\xf6\x00g\x00e\x00\
43-
r\x00u\x00n\x00g\x00 \x00n\x00a\x00c\x00\
44-
h\x00 \x00S\x00t\x00a\x00r\x00t\x08\x00\x00\
45-
\x00\x00\x06\x00\x00\x00\x11Delay aft\
46-
er boot:\x07\x00\x00\x00\x0bmai\
47-
n_window\x01\x03\x00\x00\x00\x18\x00B\
48-
\x00r\x00e\x00i\x00t\x00e\x00n\x00g\x00r\
49-
\x00a\x00d\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x09\
50-
Latitude:\x07\x00\x00\x00\x0bma\
51-
in_window\x01\x03\x00\x00\x00\x08\x00\
52-
H\x00e\x00l\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\
53-
\x05Light\x07\x00\x00\x00\x0bmain_\
54-
window\x01\x03\x00\x00\x00\x0a\x00H\x00e\
55-
\x00l\x00l\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x06\
56-
Light:\x07\x00\x00\x00\x0bmain_\
57-
window\x01\x03\x00\x00\x00\x16\x00L\x00\xe4\
58-
\x00n\x00g\x00e\x00n\x00g\x00r\x00a\x00d\
59-
\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x0aLong\
60-
itude:\x07\x00\x00\x00\x0bmain_\
61-
window\x01\x03\x00\x00\x00`\x00M\x00a\
62-
\x00c\x00h\x00e\x00 \x00e\x00i\x00n\x00 \
63-
\x00G\x00e\x00r\x00\xe4\x00u\x00s\x00c\x00h\
64-
\x00,\x00 \x00w\x00e\x00n\x00n\x00 \x00d\
65-
\x00a\x00s\x00 \x00T\x00h\x00e\x00m\x00a\
66-
\x00 \x00g\x00e\x00\xe4\x00n\x00d\x00e\x00r\
67-
\x00t\x00 \x00w\x00i\x00r\x00d\x08\x00\x00\x00\
68-
\x00\x06\x00\x00\x00%Make a sou\
69-
nd when switchin\
70-
g the theme\x07\x00\x00\x00\x0b\
71-
main_window\x01\x03\xff\xff\xff\
72-
\xff\x08\x00\x00\x00\x00\x06\x00\x00\x00\x07Plugi\
73-
ns\x07\x00\x00\x00\x0bmain_wind\
74-
ow\x01\x03\x00\x00\x006\x00S\x00e\x00n\x00d\
75-
\x00e\x00 \x00e\x00i\x00n\x00e\x00 \x00B\
76-
\x00e\x00n\x00a\x00c\x00h\x00r\x00i\x00c\
77-
\x00h\x00t\x00i\x00g\x00u\x00n\x00g\x08\x00\
78-
\x00\x00\x00\x06\x00\x00\x00\x13Send a n\
79-
otification\x07\x00\x00\x00\x0b\
80-
main_window\x01\x03\x00\x00\x00\
81-
\x1a\x00E\x00i\x00n\x00s\x00t\x00e\x00l\x00\
82-
l\x00u\x00n\x00g\x00e\x00n\x08\x00\x00\x00\x00\
83-
\x06\x00\x00\x00\x08Settings\x07\x00\x00\
84-
\x00\x0bmain_window\x01\x03\x00\
85-
\x00\x00B\x00S\x00o\x00n\x00n\x00e\x00n\x00\
86-
a\x00u\x00f\x00g\x00a\x00n\x00g\x00 \x00\
87-
b\x00i\x00s\x00 \x00S\x00o\x00n\x00n\x00\
88-
e\x00n\x00u\x00n\x00t\x00e\x00r\x00g\x00\
89-
a\x00n\x00g\x08\x00\x00\x00\x00\x06\x00\x00\x00\x11S\
90-
unset to Sunrise\
15+
\xfd\xf4\x00\x00\x01\xd7\x00\x89?\xc9\x00\x00\x05x\x02\xcf\
16+
6\x15\x00\x00\x06f\x03^\x05u\x00\x00\x00o\x05/\
17+
\xdfz\x00\x00\x02\x04\x06\x99\x04U\x00\x00\x03\xeb\x07;\
18+
\xe0\x03\x00\x00\x03\x19\x0ai\xf3\xe7\x00\x00\x05\xf1\x0a\xa0\
19+
\x8cG\x00\x00\x00\x00\x0b\x0b\xe8\x0a\x00\x00\x01\x96\x0b\xa1\
20+
\xae>\x00\x00\x04^\x0c\xbb\x01s\x00\x00\x03\xa9\x0e\x0e\
21+
\x8c\xca\x00\x00\x024\x0f\x0ag\xee\x00\x00\x03@\x0fF\
22+
^:\x00\x00\x019i\x00\x00\x06\xb4\x03\x00\x00\x006\
23+
\x00A\x00u\x00t\x00o\x00m\x00a\x00t\x00i\
24+
\x00s\x00c\x00h\x00e\x00r\x00 \x00T\x00h\
25+
\x00e\x00m\x00e\x00n\x00w\x00e\x00c\x00h\
26+
\x00s\x00e\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\x19\
27+
Automatic theme \
28+
switching\x07\x00\x00\x00\x0bma\
29+
in_window\x01\x03\x00\x00\x008\x00\
30+
B\x00e\x00n\x00u\x00t\x00z\x00e\x00r\x00\
31+
d\x00e\x00f\x00i\x00n\x00i\x00e\x00r\x00\
32+
t\x00e\x00r\x00 \x00Z\x00e\x00i\x00t\x00\
33+
r\x00a\x00u\x00m\x08\x00\x00\x00\x00\x06\x00\x00\x00\
34+
\x0fCustom Schedule\
35+
\x07\x00\x00\x00\x0bmain_window\
36+
\x01\x03\x00\x00\x00\x0c\x00D\x00u\x00n\x00k\x00e\
37+
\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\x04Dark\
9138
\x07\x00\x00\x00\x0bmain_window\
92-
\x01\x03\x00\x00\x00\xae\x00Z\x00e\x00i\x00t\x00 \
93-
\x00d\x00i\x00e\x00 \x00g\x00e\x00w\x00a\
94-
\x00r\x00t\x00e\x00t\x00 \x00w\x00e\x00r\
95-
\x00d\x00e\x00n\x00 \x00s\x00o\x00l\x00l\
96-
\x00 \x00w\x00\xe4\x00h\x00r\x00e\x00n\x00d\
97-
\x00 \x00d\x00a\x00s\x00 \x00S\x00y\x00s\
98-
\x00t\x00e\x00m\x00 \x00s\x00t\x00a\x00r\
99-
\x00t\x00e\x00t\x00.\x00 \x00S\x00t\x00a\
100-
\x00n\x00d\x00a\x00r\x00d\x00w\x00e\x00r\
101-
\x00t\x00 \x00i\x00s\x00t\x00 \x001\x000\
102-
\x00 \x00S\x00e\x00k\x00u\x00n\x00d\x00e\
103-
\x00n\x00.\x08\x00\x00\x00\x00\x06\x00\x00\x00LTi\
104-
me to wait until\
105-
the system fini\
106-
shed booting. De\
107-
fault value is 1\
108-
0 seconds.\x07\x00\x00\x00\x0bm\
109-
ain_window\x01\x03\x00\x00\x00<\
110-
\x00P\x00o\x00s\x00i\x00t\x00i\x00o\x00n\
111-
\x00 \x00a\x00u\x00t\x00o\x00m\x00a\x00t\
112-
\x00i\x00s\x00c\x00h\x00 \x00b\x00e\x00s\
113-
\x00t\x00i\x00m\x00m\x00e\x00n\x08\x00\x00\x00\
114-
\x00\x06\x00\x00\x00\x1dupdate loc\
115-
ation automatica\
116-
lly\x07\x00\x00\x00\x0bmain_win\
117-
dow\x01\x03\x00\x00\x00\x1e\x00Y\x00i\x00n\x00\
118-
\x00Y\x00a\x00n\x00g\x00 \x00\xf6\x00f\x00\
119-
f\x00n\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\
120-
\x0dOpen Yin Yang\x07\x00\
121-
\x00\x00\x07systray\x01\x03\x00\x00\x00\x0e\
122-
\x00B\x00e\x00e\x00n\x00d\x00e\x00n\x08\x00\
123-
\x00\x00\x00\x06\x00\x00\x00\x04Quit\x07\x00\x00\x00\
124-
\x07systray\x01\x88\x00\x00\x00\x02\x01\x01\
125-
\
39+
\x01\x03\x00\x00\x00\x0e\x00D\x00u\x00n\x00k\x00e\
40+
\x00l\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05Da\
41+
rk:\x07\x00\x00\x00\x0bmain_win\
42+
dow\x01\x03\x00\x00\x00,\x00V\x00e\x00r\x00\
43+
z\x00\xf6\x00g\x00e\x00r\x00u\x00n\x00g\x00\
44+
\x00n\x00a\x00c\x00h\x00 \x00S\x00t\x00\
45+
a\x00r\x00t\x08\x00\x00\x00\x00\x06\x00\x00\x00\x11D\
46+
elay after boot:\
47+
\x07\x00\x00\x00\x0bmain_window\
48+
\x01\x03\x00\x00\x00\x18\x00B\x00r\x00e\x00i\x00t\
49+
\x00e\x00n\x00g\x00r\x00a\x00d\x00:\x08\x00\
50+
\x00\x00\x00\x06\x00\x00\x00\x09Latitude\
51+
:\x07\x00\x00\x00\x0bmain_windo\
52+
w\x01\x03\x00\x00\x00\x08\x00H\x00e\x00l\x00l\x08\
53+
\x00\x00\x00\x00\x06\x00\x00\x00\x05Light\x07\x00\
54+
\x00\x00\x0bmain_window\x01\x03\
55+
\x00\x00\x00\x0a\x00H\x00e\x00l\x00l\x00:\x08\x00\
56+
\x00\x00\x00\x06\x00\x00\x00\x06Light:\x07\x00\
57+
\x00\x00\x0bmain_window\x01\x03\
58+
\x00\x00\x00\x16\x00L\x00\xe4\x00n\x00g\x00e\x00n\
59+
\x00g\x00r\x00a\x00d\x00:\x08\x00\x00\x00\x00\x06\
60+
\x00\x00\x00\x0aLongitude:\x07\x00\
61+
\x00\x00\x0bmain_window\x01\x03\
62+
\x00\x00\x00`\x00M\x00a\x00c\x00h\x00e\x00 \
63+
\x00e\x00i\x00n\x00 \x00G\x00e\x00r\x00\xe4\
64+
\x00u\x00s\x00c\x00h\x00,\x00 \x00w\x00e\
65+
\x00n\x00n\x00 \x00d\x00a\x00s\x00 \x00T\
66+
\x00h\x00e\x00m\x00a\x00 \x00g\x00e\x00\xe4\
67+
\x00n\x00d\x00e\x00r\x00t\x00 \x00w\x00i\
68+
\x00r\x00d\x08\x00\x00\x00\x00\x06\x00\x00\x00%Ma\
69+
ke a sound when \
70+
switching the th\
71+
eme\x07\x00\x00\x00\x0bmain_win\
72+
dow\x01\x03\xff\xff\xff\xff\x08\x00\x00\x00\x00\x06\x00\
73+
\x00\x00\x07Plugins\x07\x00\x00\x00\x0bm\
74+
ain_window\x01\x03\x00\x00\x006\
75+
\x00S\x00e\x00n\x00d\x00e\x00 \x00e\x00i\
76+
\x00n\x00e\x00 \x00B\x00e\x00n\x00a\x00c\
77+
\x00h\x00r\x00i\x00c\x00h\x00t\x00i\x00g\
78+
\x00u\x00n\x00g\x08\x00\x00\x00\x00\x06\x00\x00\x00\x13\
79+
Send a notificat\
80+
ion\x07\x00\x00\x00\x0bmain_win\
81+
dow\x01\x03\x00\x00\x00\x1a\x00E\x00i\x00n\x00\
82+
s\x00t\x00e\x00l\x00l\x00u\x00n\x00g\x00\
83+
e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x08Set\
84+
tings\x07\x00\x00\x00\x0bmain_w\
85+
indow\x01\x03\x00\x00\x00B\x00S\x00o\x00\
86+
n\x00n\x00e\x00n\x00a\x00u\x00f\x00g\x00\
87+
a\x00n\x00g\x00 \x00b\x00i\x00s\x00 \x00\
88+
S\x00o\x00n\x00n\x00e\x00n\x00u\x00n\x00\
89+
t\x00e\x00r\x00g\x00a\x00n\x00g\x08\x00\x00\
90+
\x00\x00\x06\x00\x00\x00\x11Sunset to\
91+
Sunrise\x07\x00\x00\x00\x0bmai\
92+
n_window\x01\x03\x00\x00\x00\xae\x00Z\
93+
\x00e\x00i\x00t\x00 \x00d\x00i\x00e\x00 \
94+
\x00g\x00e\x00w\x00a\x00r\x00t\x00e\x00t\
95+
\x00 \x00w\x00e\x00r\x00d\x00e\x00n\x00 \
96+
\x00s\x00o\x00l\x00l\x00 \x00w\x00\xe4\x00h\
97+
\x00r\x00e\x00n\x00d\x00 \x00d\x00a\x00s\
98+
\x00 \x00S\x00y\x00s\x00t\x00e\x00m\x00 \
99+
\x00s\x00t\x00a\x00r\x00t\x00e\x00t\x00.\
100+
\x00 \x00S\x00t\x00a\x00n\x00d\x00a\x00r\
101+
\x00d\x00w\x00e\x00r\x00t\x00 \x00i\x00s\
102+
\x00t\x00 \x001\x000\x00 \x00S\x00e\x00k\
103+
\x00u\x00n\x00d\x00e\x00n\x00.\x08\x00\x00\x00\
104+
\x00\x06\x00\x00\x00LTime to wa\
105+
it until the sys\
106+
tem finished boo\
107+
ting. Default va\
108+
lue is 10 second\
109+
s.\x07\x00\x00\x00\x0bmain_wind\
110+
ow\x01\x03\x00\x00\x00<\x00P\x00o\x00s\x00i\
111+
\x00t\x00i\x00o\x00n\x00 \x00a\x00u\x00t\
112+
\x00o\x00m\x00a\x00t\x00i\x00s\x00c\x00h\
113+
\x00 \x00b\x00e\x00s\x00t\x00i\x00m\x00m\
114+
\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x1dup\
115+
date location au\
116+
tomatically\x07\x00\x00\x00\x0b\
117+
main_window\x01\x03\x00\x00\x00\
118+
\x1e\x00Y\x00i\x00n\x00 \x00Y\x00a\x00n\x00\
119+
g\x00 \x00\xf6\x00f\x00f\x00n\x00e\x00n\x08\
120+
\x00\x00\x00\x00\x06\x00\x00\x00\x0dOpen Yi\
121+
n Yang\x07\x00\x00\x00\x07systr\
122+
ay\x01\x03\x00\x00\x00\x0e\x00B\x00e\x00e\x00n\
123+
\x00d\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x04\
124+
Quit\x07\x00\x00\x00\x07systray\
125+
\x01\x03\x00\x00\x00&\x00F\x00a\x00r\x00b\x00s\
126+
\x00c\x00h\x00e\x00m\x00a\x00 \x00w\x00e\
127+
\x00c\x00h\x00s\x00e\x00l\x00n\x08\x00\x00\x00\
128+
\x00\x06\x00\x00\x00\x0cToggle the\
129+
me\x07\x00\x00\x00\x07systray\x01\x88\
130+
\x00\x00\x00\x02\x01\x01\
126131
\x00\x00\x07\x22\
127132
\x00\
128133
\x00\x1dUx\xda\xcdYKs\xdb6\x10\xbe\xe7Wp\
@@ -269,8 +274,8 @@
269274
\x00\x00\x00\x10\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
270275
\x00\x00\x00\x00\x00\x00\x00\x00\
271276
\x00\x00\x00.\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
272-
\x00\x00\x01\x88\x1fj:\x04\
273-
\x00\x00\x00P\x00\x01\x00\x00\x00\x01\x00\x00\x07%\
277+
\x00\x00\x01\x88)>\x08Z\
278+
\x00\x00\x00P\x00\x01\x00\x00\x00\x01\x00\x00\x07{\
274279
\x00\x00\x01\x84\x01\xd5\x8cC\
275280
"
276281

0 commit comments

Comments
 (0)