diff --git a/config.example.toml b/config.example.toml index ea05781..f9e3e95 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,5 +1,5 @@ # DO NOT EDIT IT -version = "0.0.5" +version = "0.0.6" [instance] url = "127.0.0.1:8080" @@ -19,6 +19,7 @@ memorySize = "512M" cpuModel = "Cascadelake-Server-v5" # Waiting time for wrapper-manager to start timeout = 80 +showWindow = false [region] # The language of song metadata. Influence song title, author and other information. diff --git a/src/config.py b/src/config.py index 6202cb2..bfa934c 100644 --- a/src/config.py +++ b/src/config.py @@ -5,7 +5,7 @@ from creart import exists_module from creart.creator import AbstractCreator, CreateTargetInfo from pydantic import BaseModel -CONFIG_VERSION = "0.0.5" +CONFIG_VERSION = "0.0.6" class Instance(BaseModel): @@ -20,6 +20,7 @@ class LocalInstance(BaseModel): memorySize: str = "512M" cpuModel: str = "Cascadelake-Server-v5" timeout: int = 30 + showWindow: bool = False class Region(BaseModel): diff --git a/src/qemu.py b/src/qemu.py index e550459..d81fd5b 100644 --- a/src/qemu.py +++ b/src/qemu.py @@ -11,7 +11,7 @@ from src.config import Config from src.logger import GlobalLogger ARGUMENTS = ["qemu-system-x86_64", "-machine q35", f"-cpu {it(Config).localInstance.cpuModel}", - f"-m {it(Config).localInstance.memorySize}", "-display none", "-hda assets/wrapper-manager.qcow2", + f"-m {it(Config).localInstance.memorySize}", "-hda assets/wrapper-manager.qcow2", "-device virtio-net-pci,netdev=net0", "-netdev user,id=net0,hostfwd=tcp:127.0.0.1:32767-:32767"] HWACCEL = f"-accel {it(Config).localInstance.hardwareAccelerator}" @@ -24,6 +24,8 @@ class QemuInstance: await self.get_instance_image() if it(Config).localInstance.enableHardwareAcceleration: ARGUMENTS.insert(3, HWACCEL) + if not it(Config).localInstance.showWindow: + ARGUMENTS.insert(5, "-display none") self.proc = loop.create_task( asyncio.create_subprocess_shell(" ".join(ARGUMENTS), stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE))