|
@@ -0,0 +1,66 @@
|
|
|
+diff --git a/VulcanBoard.py b/VulcanBoard.py
|
|
|
+index e64c74c..1f6ec1e 100644
|
|
|
+--- a/VulcanBoard.py
|
|
|
++++ b/VulcanBoard.py
|
|
|
+@@ -20,6 +20,7 @@ from os import path, getenv, name
|
|
|
+ import subprocess
|
|
|
+ import sys
|
|
|
+ from dataclasses import dataclass
|
|
|
++from argparse import ArgumentParser
|
|
|
+
|
|
|
+ import yaml
|
|
|
+ from termcolor import colored
|
|
|
+@@ -40,7 +41,7 @@ def log(message: str, color="green") -> None:
|
|
|
+ print(colored("[*] {}".format(message), color)) # pyright: ignore
|
|
|
+
|
|
|
+
|
|
|
+-def get_config_path():
|
|
|
++def get_default_config_path():
|
|
|
+ if name == "nt":
|
|
|
+ return path.join(getenv("APPDATA", ""), "VulcanBoard", "config.yml")
|
|
|
+ xdg_config_home = getenv("XDG_CONFIG_HOME", path.expanduser("~/.config"))
|
|
|
+@@ -59,6 +60,35 @@ def is_valid_hexcolor(hexcolor: str) -> bool:
|
|
|
+ return True
|
|
|
+
|
|
|
+
|
|
|
++@dataclass
|
|
|
++class CmdlineArgs:
|
|
|
++ use_fullscreen: bool
|
|
|
++ config_path: str
|
|
|
++
|
|
|
++
|
|
|
++def parse_argv() -> CmdlineArgs:
|
|
|
++ parser = ArgumentParser(
|
|
|
++ prog="VulcanBoard",
|
|
|
++ description="a hotkey board for desktop touchscreens",
|
|
|
++ )
|
|
|
++ parser.add_argument(
|
|
|
++ "-f",
|
|
|
++ "--fullscreen",
|
|
|
++ action="use_fullscreen",
|
|
|
++ help="open hotkey deck in fullscreen mode",
|
|
|
++ )
|
|
|
++ parser.add_argument(
|
|
|
++ "-c",
|
|
|
++ "--config-file",
|
|
|
++ type=str,
|
|
|
++ help="specify the configuration file to use",
|
|
|
++ default=get_default_config_path(),
|
|
|
++ )
|
|
|
++
|
|
|
++ args = parser.parse_args()
|
|
|
++ return CmdlineArgs(args.fullscreen, args.config_path)
|
|
|
++
|
|
|
++
|
|
|
+ @dataclass
|
|
|
+ class Config:
|
|
|
+ columns: int
|
|
|
+@@ -137,7 +167,7 @@ class ConfigLoader:
|
|
|
+
|
|
|
+ class VulcanBoardApp(App):
|
|
|
+ def build(self) -> GridLayout:
|
|
|
+- config = ConfigLoader(get_config_path())
|
|
|
++ config = ConfigLoader(get_default_config_path())
|
|
|
+
|
|
|
+ button_map = {
|
|
|
+ (btn["position"][0], btn["position"][1]): btn
|