Move the autostart key to a variable
This commit is contained in:
1 parent
63d0c4a712
commit
515c86d1fa
1 file changed
+3
-2
@@ -1032,6 +1032,7 @@ class _SettingsVars(TypedDict):
|
|||||||
|
|
||||||
class SettingsPanel:
|
class SettingsPanel:
|
||||||
AUTOSTART_NAME: str = "TwitchDropsMiner"
|
AUTOSTART_NAME: str = "TwitchDropsMiner"
|
||||||
|
AUTOSTART_KEY: str = "HKCU/Software/Microsoft/Windows/CurrentVersion/Run"
|
||||||
|
|
||||||
def __init__(self, manager: GUIManager, master: ttk.Widget):
|
def __init__(self, manager: GUIManager, master: ttk.Widget):
|
||||||
self._twitch = manager._twitch
|
self._twitch = manager._twitch
|
||||||
@@ -1172,10 +1173,10 @@ class SettingsPanel:
|
|||||||
self_path = f'"{SELF_PATH.resolve()!s}"'
|
self_path = f'"{SELF_PATH.resolve()!s}"'
|
||||||
if tray:
|
if tray:
|
||||||
self_path += " --tray"
|
self_path += " --tray"
|
||||||
with RegistryKey("HKCU/Software/Microsoft/Windows/CurrentVersion/Run") as key:
|
with RegistryKey(self.AUTOSTART_KEY) as key:
|
||||||
key.set(self.AUTOSTART_NAME, ValueType.REG_SZ, self_path)
|
key.set(self.AUTOSTART_NAME, ValueType.REG_SZ, self_path)
|
||||||
else:
|
else:
|
||||||
with RegistryKey("HKCU/Software/Microsoft/Windows/CurrentVersion/Run") as key:
|
with RegistryKey(self.AUTOSTART_KEY) as key:
|
||||||
key.delete(self.AUTOSTART_NAME, silent=True)
|
key.delete(self.AUTOSTART_NAME, silent=True)
|
||||||
|
|
||||||
def set_games(self, games: abc.Iterable[Game]) -> None:
|
def set_games(self, games: abc.Iterable[Game]) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user