Kaynağa Gözat

add confif acutally

Noah Vogt 5 ay önce
ebeveyn
işleme
4e3b83ac65
2 değiştirilmiş dosya ile 86 ekleme ve 0 silme
  1. 66 0
      config.diff
  2. 20 0
      config.yml

+ 66 - 0
config.diff

@@ -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

+ 20 - 0
config.yml

@@ -0,0 +1,20 @@
+columns: 6
+rows: 4
+buttons:
+  - position: [0, 0]
+    cmd: "curl http://localhost:8000/cd_archiv"
+    txt: "API\nCall"
+    bg_color: "fffaaa"
+    fg_color: "0c0c0c"
+    fontsize: 60
+  - position: [1, 1]
+    cmd: "echo 'Hello, World!'"
+    span: [1, 2]  # Spans 1 row and 2 columns
+    txt: "Say\nHello"
+    # bg_color: "aaaaff"
+    fontsize: 70
+  - position: [0, 1]
+    cmd: "sleep 10; echo 'Hello, delayed World!'"
+    txt: "Say\nDelayed\nHello"
+    bg_color: "aaa0ff"
+    fontsize: 50