diff --git a/CoilSnake.spec b/CoilSnake.spec index f690ae2d..2046d454 100644 --- a/CoilSnake.spec +++ b/CoilSnake.spec @@ -87,10 +87,10 @@ exe = EXE( upx=True, upx_exclude=[], runtime_tmpdir=None, - console=debug, + hide_console='hide-early', icon='coilsnake/assets/images/CoilSnake.ico', manifest=None, - windowed=True + console=True ) if platform.system() != 'Darwin': diff --git a/script/gui.py b/script/gui.py index c4a8fb94..ecb6ce49 100755 --- a/script/gui.py +++ b/script/gui.py @@ -1,9 +1,24 @@ #!/usr/bin/env python +import os +import subprocess import sys sys.path.append(".") from coilsnake.ui.gui import main +from coilsnake.ui.cli import main as cli_main + +def perform_windows_noconsole_workaround(argv): + return os.name == 'nt' and len(argv) == 1 and argv[0].endswith('.exe') if __name__ == '__main__': - main() + if len(sys.argv) == 2 and sys.argv[1] == '--gui': + main() + elif perform_windows_noconsole_workaround(sys.argv): + # We're on Windows. Start ourselves but with no console window, and then exit. + subprocess.Popen([sys.argv[0], '--gui'], creationflags=subprocess.CREATE_NO_WINDOW) + sys.exit(0) + elif len(sys.argv) > 1: + sys.exit(cli_main()) + else: + main() \ No newline at end of file