feat(wallpaper_changer): remove hostname, add headless and monitor_file to config
set default monitor_file transfer headless arg to config struct
This commit is contained in:
1 parent
8fa1657381
commit
dc228cee6c
1 file changed
+11
-5
@@ -1,4 +1,3 @@
|
||||
import socket
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
@@ -8,12 +7,13 @@ logger = get_logger(__name__)
|
||||
|
||||
@dataclass
|
||||
class Config:
|
||||
host: str
|
||||
img_dir: Path
|
||||
img_folder: str
|
||||
wallpaper_dir: Path
|
||||
conf_dir: Path
|
||||
private_key: Path
|
||||
monitor_file: Path
|
||||
headless_mode: bool
|
||||
|
||||
@staticmethod
|
||||
def argument_config_file(config_file , hostname: str | None = None) -> Path:
|
||||
@@ -28,7 +28,6 @@ class Config:
|
||||
|
||||
@classmethod
|
||||
def load(cls, args):
|
||||
hostname = socket.gethostname()
|
||||
default_dir = Path().home() / "Nextcloud" / "Stuff" / "Wallpaper"
|
||||
mode_folders = {
|
||||
"default": "Desktop1920x1080/",
|
||||
@@ -63,5 +62,12 @@ class Config:
|
||||
private_key = Path(args.private_key)
|
||||
else:
|
||||
private_key = conf_dir / "IMG_privateKey.pem"
|
||||
|
||||
return cls(hostname, img_dir, img_folder, wallpaper_dir, conf_dir, private_key)
|
||||
headless_mode = False
|
||||
if args.headless:
|
||||
headless_mode = True
|
||||
if args.monitor_file:
|
||||
monitor_file = Path(args.monitor_file)
|
||||
else:
|
||||
monitor_file = Path.home() / ".config" / "monitors.xml"
|
||||
|
||||
return cls(img_dir, img_folder, wallpaper_dir, conf_dir, private_key ,monitor_file, headless_mode)
|
||||
Reference in new issue
Block a user