11from contextlib import suppress
2+ from dataclasses import dataclass
23from time import sleep
4+ import inject
35from keyboard import press_and_release as hotkey
46from winregal import RegKey
57from os import system
8+ from commented_config import CommentsHolder
9+
10+
11+ @dataclass
12+ class ColorFilterSettings :
13+ """
14+ Set filter settings on startup
15+ """
16+ _comments_ = CommentsHolder ()
17+
18+ setup_filter_state : bool = True
19+ _comments_ .add ("""
20+ [{default!r}] Open settings and setup:
21+ Allow the shortcut key to toggle filter = Checked
22+ Filter type = Inverted [first]
23+ """ , locals ())
24+
25+ close_settings : bool = True
26+ _comments_ .add ("""
27+ [{default!r}] Close settings after setup
28+ """ , locals ())
629
730
831def _get_filter_info (value : str ):
@@ -34,7 +57,11 @@ def toggle():
3457 hotkey ("ctrl+win" , do_press = False )
3558
3659
37- def setup_color_filer_settings ():
60+ @inject .autoparams ()
61+ def setup_color_filer_settings (settings : ColorFilterSettings ):
62+ if not settings .setup_filter_state :
63+ return
64+
3865 hotkey_enabled = is_hotkey_enabled ()
3966
4067 if hotkey_enabled and get_filter_type () == 1 :
@@ -45,7 +72,7 @@ def setup_color_filer_settings():
4572 sleep (1 )
4673 # Windows has bug, when opening easeofaccess-colorfilter
4774 # while this window is already opened
48- # filter will always set to Gray
75+ # filter will always set to Grayscale
4976 # So you must check which filter selected twice :)
5077
5178 options = (was_active , hotkey_enabled , get_filter_type () == 1 )
@@ -59,4 +86,5 @@ def setup_color_filer_settings():
5986 hotkey ("Shift + Tab" )
6087 hotkey ("Space" )
6188
62- hotkey ("Alt + F4" )
89+ if settings .close_settings :
90+ hotkey ("Alt + F4" )
0 commit comments