File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
22## [ Unreleased] ( https://github.com/MaxBQb/InversionFilterManager/releases/tag/latest ) (2022-07-29)
3+ Features:
4+ - Single-app-instance check can be disabled with ` --allow-multiple ` /` -m ` start param
5+
36Stability:
47- Drop support of non-privileged run (Requires run as Administrator)
58
Original file line number Diff line number Diff line change 1+ import argparse
12from asyncio import run
23
34import inject
45import win32api
6+ import win32con
57import win32event
68from winerror import ERROR_ALREADY_EXISTS
79
810from app_start import AppStartManager
911
1012
11- def lock_instance ():
13+ def lock_instance (allow_multiple = False ):
1214 from _meta import __instance_lock_key__
1315 mutex = win32event .CreateMutex (None , False , __instance_lock_key__ )
1416 if win32api .GetLastError () != ERROR_ALREADY_EXISTS :
1517 return mutex
18+ elif allow_multiple :
19+ return win32event .OpenMutex (win32con .SYNCHRONIZE , False , __instance_lock_key__ )
1620
1721
1822@inject .autoparams ()
@@ -22,8 +26,17 @@ async def main(app: AppStartManager):
2226 await app .run ()
2327
2428
29+ def get_args ():
30+ parser = argparse .ArgumentParser (description = "App, that inverts colors when you opens blinding white windows" )
31+ parser .add_argument ('--allow-multiple' , '-m' ,
32+ action = 'store_true' ,
33+ help = "Disable single-instance check" )
34+ return parser .parse_args ()
35+
36+
2537def bootstrap ():
26- lock = lock_instance ()
38+ args = get_args ()
39+ lock = lock_instance (args .allow_multiple )
2740 if not lock :
2841 print ("WARNING: Program already started!" )
2942 return
You can’t perform that action at this time.
0 commit comments