Skip to content

Commit

Permalink
Add toggle theme action to systray icon
Browse files Browse the repository at this point in the history
  • Loading branch information
l0drex committed May 23, 2023
1 parent da8eb85 commit 3363a77
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 118 deletions.
Binary file modified resources/translations/yin_yang.de_DE.qm
Binary file not shown.
10 changes: 8 additions & 2 deletions resources/translations/yin_yang.de_DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@
<context>
<name>systray</name>
<message>
<location filename="../../yin_yang/__main__.py" line="119"/>
<location filename="../../yin_yang/__main__.py" line="120"/>
<source>Open Yin Yang</source>
<comment>Context menu action in the systray</comment>
<translation>Yin Yang öffnen</translation>
</message>
<message>
<location filename="../../yin_yang/__main__.py" line="120"/>
<location filename="../../yin_yang/__main__.py" line="121"/>
<source>Toggle theme</source>
<comment>Context menu action in the systray</comment>
<translation type="unfinished">Farbschema wechseln</translation>
</message>
<message>
<location filename="../../yin_yang/__main__.py" line="122"/>
<source>Quit</source>
<comment>Context menu action in the systray</comment>
<translation>Beenden</translation>
Expand Down
10 changes: 8 additions & 2 deletions resources/translations/yin_yang.nl_NL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@
<context>
<name>systray</name>
<message>
<location filename="../../yin_yang/__main__.py" line="119"/>
<location filename="../../yin_yang/__main__.py" line="120"/>
<source>Open Yin Yang</source>
<comment>Context menu action in the systray</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../yin_yang/__main__.py" line="120"/>
<location filename="../../yin_yang/__main__.py" line="121"/>
<source>Toggle theme</source>
<comment>Context menu action in the systray</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../yin_yang/__main__.py" line="122"/>
<source>Quit</source>
<comment>Context menu action in the systray</comment>
<translation type="unfinished"></translation>
Expand Down
1 change: 1 addition & 0 deletions yin_yang/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ def systray_icon_clicked(reason: QSystemTrayIcon.ActivationReason):

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

icon.setContextMenu(menu)
Expand Down
233 changes: 119 additions & 114 deletions yin_yang/ui/resources_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,123 +6,128 @@
from PySide6 import QtCore

qt_resource_data = b"\
\x00\x00\x07!\
\x00\x00\x07w\
<\
\xb8d\x18\xca\xef\x9c\x95\xcd!\x1c\xbf`\xa1\xbd\xdd\xa7\
\x00\x00\x00\x05de_DEB\x00\x00\x00\x90\x00\x04\
\x00\x00\x00\x05de_DEB\x00\x00\x00\x98\x00\x04\
\xa8\x8b\x00\x00\x00\xd6\x00\x05\x8c\x04\x00\x00\x068\x00\x0a\
KE\x00\x00\x02t\x00J\x88\xea\x00\x00\x01\x06\x00R\
\xfd\xf4\x00\x00\x01\xd7\x00\x89?\xc9\x00\x00\x05x\x03^\
\x05u\x00\x00\x00o\x05/\xdfz\x00\x00\x02\x04\x06\x99\
\x04U\x00\x00\x03\xeb\x07;\xe0\x03\x00\x00\x03\x19\x0ai\
\xf3\xe7\x00\x00\x05\xf1\x0a\xa0\x8cG\x00\x00\x00\x00\x0b\x0b\
\xe8\x0a\x00\x00\x01\x96\x0b\xa1\xae>\x00\x00\x04^\x0c\xbb\
\x01s\x00\x00\x03\xa9\x0e\x0e\x8c\xca\x00\x00\x024\x0f\x0a\
g\xee\x00\x00\x03@\x0fF^:\x00\x00\x019i\x00\
\x00\x06f\x03\x00\x00\x006\x00A\x00u\x00t\x00o\
\x00m\x00a\x00t\x00i\x00s\x00c\x00h\x00e\
\x00r\x00 \x00T\x00h\x00e\x00m\x00e\x00n\
\x00w\x00e\x00c\x00h\x00s\x00e\x00l\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x19Automati\
c theme switchin\
g\x07\x00\x00\x00\x0bmain_windo\
w\x01\x03\x00\x00\x008\x00B\x00e\x00n\x00u\x00\
t\x00z\x00e\x00r\x00d\x00e\x00f\x00i\x00\
n\x00i\x00e\x00r\x00t\x00e\x00r\x00 \x00\
Z\x00e\x00i\x00t\x00r\x00a\x00u\x00m\x08\
\x00\x00\x00\x00\x06\x00\x00\x00\x0fCustom \
Schedule\x07\x00\x00\x00\x0bmai\
n_window\x01\x03\x00\x00\x00\x0c\x00D\
\x00u\x00n\x00k\x00e\x00l\x08\x00\x00\x00\x00\x06\
\x00\x00\x00\x04Dark\x07\x00\x00\x00\x0bmai\
n_window\x01\x03\x00\x00\x00\x0e\x00D\
\x00u\x00n\x00k\x00e\x00l\x00:\x08\x00\x00\x00\
\x00\x06\x00\x00\x00\x05Dark:\x07\x00\x00\x00\x0b\
main_window\x01\x03\x00\x00\x00\
,\x00V\x00e\x00r\x00z\x00\xf6\x00g\x00e\x00\
r\x00u\x00n\x00g\x00 \x00n\x00a\x00c\x00\
h\x00 \x00S\x00t\x00a\x00r\x00t\x08\x00\x00\
\x00\x00\x06\x00\x00\x00\x11Delay aft\
er boot:\x07\x00\x00\x00\x0bmai\
n_window\x01\x03\x00\x00\x00\x18\x00B\
\x00r\x00e\x00i\x00t\x00e\x00n\x00g\x00r\
\x00a\x00d\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x09\
Latitude:\x07\x00\x00\x00\x0bma\
in_window\x01\x03\x00\x00\x00\x08\x00\
H\x00e\x00l\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\
\x05Light\x07\x00\x00\x00\x0bmain_\
window\x01\x03\x00\x00\x00\x0a\x00H\x00e\
\x00l\x00l\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x06\
Light:\x07\x00\x00\x00\x0bmain_\
window\x01\x03\x00\x00\x00\x16\x00L\x00\xe4\
\x00n\x00g\x00e\x00n\x00g\x00r\x00a\x00d\
\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x0aLong\
itude:\x07\x00\x00\x00\x0bmain_\
window\x01\x03\x00\x00\x00`\x00M\x00a\
\x00c\x00h\x00e\x00 \x00e\x00i\x00n\x00 \
\x00G\x00e\x00r\x00\xe4\x00u\x00s\x00c\x00h\
\x00,\x00 \x00w\x00e\x00n\x00n\x00 \x00d\
\x00a\x00s\x00 \x00T\x00h\x00e\x00m\x00a\
\x00 \x00g\x00e\x00\xe4\x00n\x00d\x00e\x00r\
\x00t\x00 \x00w\x00i\x00r\x00d\x08\x00\x00\x00\
\x00\x06\x00\x00\x00%Make a sou\
nd when switchin\
g the theme\x07\x00\x00\x00\x0b\
main_window\x01\x03\xff\xff\xff\
\xff\x08\x00\x00\x00\x00\x06\x00\x00\x00\x07Plugi\
ns\x07\x00\x00\x00\x0bmain_wind\
ow\x01\x03\x00\x00\x006\x00S\x00e\x00n\x00d\
\x00e\x00 \x00e\x00i\x00n\x00e\x00 \x00B\
\x00e\x00n\x00a\x00c\x00h\x00r\x00i\x00c\
\x00h\x00t\x00i\x00g\x00u\x00n\x00g\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x13Send a n\
otification\x07\x00\x00\x00\x0b\
main_window\x01\x03\x00\x00\x00\
\x1a\x00E\x00i\x00n\x00s\x00t\x00e\x00l\x00\
l\x00u\x00n\x00g\x00e\x00n\x08\x00\x00\x00\x00\
\x06\x00\x00\x00\x08Settings\x07\x00\x00\
\x00\x0bmain_window\x01\x03\x00\
\x00\x00B\x00S\x00o\x00n\x00n\x00e\x00n\x00\
a\x00u\x00f\x00g\x00a\x00n\x00g\x00 \x00\
b\x00i\x00s\x00 \x00S\x00o\x00n\x00n\x00\
e\x00n\x00u\x00n\x00t\x00e\x00r\x00g\x00\
a\x00n\x00g\x08\x00\x00\x00\x00\x06\x00\x00\x00\x11S\
unset to Sunrise\
\xfd\xf4\x00\x00\x01\xd7\x00\x89?\xc9\x00\x00\x05x\x02\xcf\
6\x15\x00\x00\x06f\x03^\x05u\x00\x00\x00o\x05/\
\xdfz\x00\x00\x02\x04\x06\x99\x04U\x00\x00\x03\xeb\x07;\
\xe0\x03\x00\x00\x03\x19\x0ai\xf3\xe7\x00\x00\x05\xf1\x0a\xa0\
\x8cG\x00\x00\x00\x00\x0b\x0b\xe8\x0a\x00\x00\x01\x96\x0b\xa1\
\xae>\x00\x00\x04^\x0c\xbb\x01s\x00\x00\x03\xa9\x0e\x0e\
\x8c\xca\x00\x00\x024\x0f\x0ag\xee\x00\x00\x03@\x0fF\
^:\x00\x00\x019i\x00\x00\x06\xb4\x03\x00\x00\x006\
\x00A\x00u\x00t\x00o\x00m\x00a\x00t\x00i\
\x00s\x00c\x00h\x00e\x00r\x00 \x00T\x00h\
\x00e\x00m\x00e\x00n\x00w\x00e\x00c\x00h\
\x00s\x00e\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\x19\
Automatic theme \
switching\x07\x00\x00\x00\x0bma\
in_window\x01\x03\x00\x00\x008\x00\
B\x00e\x00n\x00u\x00t\x00z\x00e\x00r\x00\
d\x00e\x00f\x00i\x00n\x00i\x00e\x00r\x00\
t\x00e\x00r\x00 \x00Z\x00e\x00i\x00t\x00\
r\x00a\x00u\x00m\x08\x00\x00\x00\x00\x06\x00\x00\x00\
\x0fCustom Schedule\
\x07\x00\x00\x00\x0bmain_window\
\x01\x03\x00\x00\x00\x0c\x00D\x00u\x00n\x00k\x00e\
\x00l\x08\x00\x00\x00\x00\x06\x00\x00\x00\x04Dark\
\x07\x00\x00\x00\x0bmain_window\
\x01\x03\x00\x00\x00\xae\x00Z\x00e\x00i\x00t\x00 \
\x00d\x00i\x00e\x00 \x00g\x00e\x00w\x00a\
\x00r\x00t\x00e\x00t\x00 \x00w\x00e\x00r\
\x00d\x00e\x00n\x00 \x00s\x00o\x00l\x00l\
\x00 \x00w\x00\xe4\x00h\x00r\x00e\x00n\x00d\
\x00 \x00d\x00a\x00s\x00 \x00S\x00y\x00s\
\x00t\x00e\x00m\x00 \x00s\x00t\x00a\x00r\
\x00t\x00e\x00t\x00.\x00 \x00S\x00t\x00a\
\x00n\x00d\x00a\x00r\x00d\x00w\x00e\x00r\
\x00t\x00 \x00i\x00s\x00t\x00 \x001\x000\
\x00 \x00S\x00e\x00k\x00u\x00n\x00d\x00e\
\x00n\x00.\x08\x00\x00\x00\x00\x06\x00\x00\x00LTi\
me to wait until\
the system fini\
shed booting. De\
fault value is 1\
0 seconds.\x07\x00\x00\x00\x0bm\
ain_window\x01\x03\x00\x00\x00<\
\x00P\x00o\x00s\x00i\x00t\x00i\x00o\x00n\
\x00 \x00a\x00u\x00t\x00o\x00m\x00a\x00t\
\x00i\x00s\x00c\x00h\x00 \x00b\x00e\x00s\
\x00t\x00i\x00m\x00m\x00e\x00n\x08\x00\x00\x00\
\x00\x06\x00\x00\x00\x1dupdate loc\
ation automatica\
lly\x07\x00\x00\x00\x0bmain_win\
dow\x01\x03\x00\x00\x00\x1e\x00Y\x00i\x00n\x00\
\x00Y\x00a\x00n\x00g\x00 \x00\xf6\x00f\x00\
f\x00n\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\
\x0dOpen Yin Yang\x07\x00\
\x00\x00\x07systray\x01\x03\x00\x00\x00\x0e\
\x00B\x00e\x00e\x00n\x00d\x00e\x00n\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x04Quit\x07\x00\x00\x00\
\x07systray\x01\x88\x00\x00\x00\x02\x01\x01\
\
\x01\x03\x00\x00\x00\x0e\x00D\x00u\x00n\x00k\x00e\
\x00l\x00:\x08\x00\x00\x00\x00\x06\x00\x00\x00\x05Da\
rk:\x07\x00\x00\x00\x0bmain_win\
dow\x01\x03\x00\x00\x00,\x00V\x00e\x00r\x00\
z\x00\xf6\x00g\x00e\x00r\x00u\x00n\x00g\x00\
\x00n\x00a\x00c\x00h\x00 \x00S\x00t\x00\
a\x00r\x00t\x08\x00\x00\x00\x00\x06\x00\x00\x00\x11D\
elay after boot:\
\x07\x00\x00\x00\x0bmain_window\
\x01\x03\x00\x00\x00\x18\x00B\x00r\x00e\x00i\x00t\
\x00e\x00n\x00g\x00r\x00a\x00d\x00:\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x09Latitude\
:\x07\x00\x00\x00\x0bmain_windo\
w\x01\x03\x00\x00\x00\x08\x00H\x00e\x00l\x00l\x08\
\x00\x00\x00\x00\x06\x00\x00\x00\x05Light\x07\x00\
\x00\x00\x0bmain_window\x01\x03\
\x00\x00\x00\x0a\x00H\x00e\x00l\x00l\x00:\x08\x00\
\x00\x00\x00\x06\x00\x00\x00\x06Light:\x07\x00\
\x00\x00\x0bmain_window\x01\x03\
\x00\x00\x00\x16\x00L\x00\xe4\x00n\x00g\x00e\x00n\
\x00g\x00r\x00a\x00d\x00:\x08\x00\x00\x00\x00\x06\
\x00\x00\x00\x0aLongitude:\x07\x00\
\x00\x00\x0bmain_window\x01\x03\
\x00\x00\x00`\x00M\x00a\x00c\x00h\x00e\x00 \
\x00e\x00i\x00n\x00 \x00G\x00e\x00r\x00\xe4\
\x00u\x00s\x00c\x00h\x00,\x00 \x00w\x00e\
\x00n\x00n\x00 \x00d\x00a\x00s\x00 \x00T\
\x00h\x00e\x00m\x00a\x00 \x00g\x00e\x00\xe4\
\x00n\x00d\x00e\x00r\x00t\x00 \x00w\x00i\
\x00r\x00d\x08\x00\x00\x00\x00\x06\x00\x00\x00%Ma\
ke a sound when \
switching the th\
eme\x07\x00\x00\x00\x0bmain_win\
dow\x01\x03\xff\xff\xff\xff\x08\x00\x00\x00\x00\x06\x00\
\x00\x00\x07Plugins\x07\x00\x00\x00\x0bm\
ain_window\x01\x03\x00\x00\x006\
\x00S\x00e\x00n\x00d\x00e\x00 \x00e\x00i\
\x00n\x00e\x00 \x00B\x00e\x00n\x00a\x00c\
\x00h\x00r\x00i\x00c\x00h\x00t\x00i\x00g\
\x00u\x00n\x00g\x08\x00\x00\x00\x00\x06\x00\x00\x00\x13\
Send a notificat\
ion\x07\x00\x00\x00\x0bmain_win\
dow\x01\x03\x00\x00\x00\x1a\x00E\x00i\x00n\x00\
s\x00t\x00e\x00l\x00l\x00u\x00n\x00g\x00\
e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x08Set\
tings\x07\x00\x00\x00\x0bmain_w\
indow\x01\x03\x00\x00\x00B\x00S\x00o\x00\
n\x00n\x00e\x00n\x00a\x00u\x00f\x00g\x00\
a\x00n\x00g\x00 \x00b\x00i\x00s\x00 \x00\
S\x00o\x00n\x00n\x00e\x00n\x00u\x00n\x00\
t\x00e\x00r\x00g\x00a\x00n\x00g\x08\x00\x00\
\x00\x00\x06\x00\x00\x00\x11Sunset to\
Sunrise\x07\x00\x00\x00\x0bmai\
n_window\x01\x03\x00\x00\x00\xae\x00Z\
\x00e\x00i\x00t\x00 \x00d\x00i\x00e\x00 \
\x00g\x00e\x00w\x00a\x00r\x00t\x00e\x00t\
\x00 \x00w\x00e\x00r\x00d\x00e\x00n\x00 \
\x00s\x00o\x00l\x00l\x00 \x00w\x00\xe4\x00h\
\x00r\x00e\x00n\x00d\x00 \x00d\x00a\x00s\
\x00 \x00S\x00y\x00s\x00t\x00e\x00m\x00 \
\x00s\x00t\x00a\x00r\x00t\x00e\x00t\x00.\
\x00 \x00S\x00t\x00a\x00n\x00d\x00a\x00r\
\x00d\x00w\x00e\x00r\x00t\x00 \x00i\x00s\
\x00t\x00 \x001\x000\x00 \x00S\x00e\x00k\
\x00u\x00n\x00d\x00e\x00n\x00.\x08\x00\x00\x00\
\x00\x06\x00\x00\x00LTime to wa\
it until the sys\
tem finished boo\
ting. Default va\
lue is 10 second\
s.\x07\x00\x00\x00\x0bmain_wind\
ow\x01\x03\x00\x00\x00<\x00P\x00o\x00s\x00i\
\x00t\x00i\x00o\x00n\x00 \x00a\x00u\x00t\
\x00o\x00m\x00a\x00t\x00i\x00s\x00c\x00h\
\x00 \x00b\x00e\x00s\x00t\x00i\x00m\x00m\
\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x1dup\
date location au\
tomatically\x07\x00\x00\x00\x0b\
main_window\x01\x03\x00\x00\x00\
\x1e\x00Y\x00i\x00n\x00 \x00Y\x00a\x00n\x00\
g\x00 \x00\xf6\x00f\x00f\x00n\x00e\x00n\x08\
\x00\x00\x00\x00\x06\x00\x00\x00\x0dOpen Yi\
n Yang\x07\x00\x00\x00\x07systr\
ay\x01\x03\x00\x00\x00\x0e\x00B\x00e\x00e\x00n\
\x00d\x00e\x00n\x08\x00\x00\x00\x00\x06\x00\x00\x00\x04\
Quit\x07\x00\x00\x00\x07systray\
\x01\x03\x00\x00\x00&\x00F\x00a\x00r\x00b\x00s\
\x00c\x00h\x00e\x00m\x00a\x00 \x00w\x00e\
\x00c\x00h\x00s\x00e\x00l\x00n\x08\x00\x00\x00\
\x00\x06\x00\x00\x00\x0cToggle the\
me\x07\x00\x00\x00\x07systray\x01\x88\
\x00\x00\x00\x02\x01\x01\
\x00\x00\x07\x22\
\x00\
\x00\x1dUx\xda\xcdYKs\xdb6\x10\xbe\xe7Wp\
Expand Down Expand Up @@ -269,8 +274,8 @@
\x00\x00\x00\x10\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00.\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
\x00\x00\x01\x88\x1fj:\x04\
\x00\x00\x00P\x00\x01\x00\x00\x00\x01\x00\x00\x07%\
\x00\x00\x01\x88)>\x08Z\
\x00\x00\x00P\x00\x01\x00\x00\x00\x01\x00\x00\x07{\
\x00\x00\x01\x84\x01\xd5\x8cC\
"

Expand Down

0 comments on commit 3363a77

Please sign in to comment.