diff --git a/pyprland/plugins/scratchpads/__init__.py b/pyprland/plugins/scratchpads/__init__.py index 3f39522..e88a730 100644 --- a/pyprland/plugins/scratchpads/__init__.py +++ b/pyprland/plugins/scratchpads/__init__.py @@ -92,13 +92,13 @@ async def die_in_piece(scratch: Scratch) -> None: async def on_reload(self) -> None: """Config loader.""" # Create new scratches with fresh config items - scratches = {name: Scratch(name, options) for name, options in self.config.items()} + scratches = {name: Scratch(name, self.config) for name, options in self.config.items()} scratches_to_spawn = set() for name in scratches: scratch = self.scratches.get(name) if scratch: # if existing scratch exists, overrides the conf object - scratch.set_config(scratches[name].conf) + scratch.set_config(self.config) else: # else register it self.scratches.register(scratches[name], name) diff --git a/pyprland/plugins/scratchpads/objects.py b/pyprland/plugins/scratchpads/objects.py index 5a53784..6e91f92 100644 --- a/pyprland/plugins/scratchpads/objects.py +++ b/pyprland/plugins/scratchpads/objects.py @@ -65,8 +65,18 @@ def forced_monitor(self) -> str | None: return cast(str, forced_monitor) return None - def set_config(self, opts: dict[str, Any]) -> None: + def set_config(self, full_config: dict[str, Any]) -> None: """Apply constraints to the configuration.""" + opts = full_config[self.uid].copy() + if "inherit" in opts: + inheritance = opts["inherit"] + if isinstance(inheritance, str): + inheritance = [inheritance] + for source in inheritance: + opts.update(full_config.get(source, {})) + + opts.update(full_config[self.uid]) + if "class_match" in opts: # NOTE: legacy, to be removed opts["match_by"] = "class" if self.cast_bool(opts.get("preserve_aspect")): diff --git a/pyprland/version.py b/pyprland/version.py index 458de15..3b4878e 100644 --- a/pyprland/version.py +++ b/pyprland/version.py @@ -1,3 +1,3 @@ """Package version.""" -VERSION = "2.4.0-52" +VERSION = "2.4.0-54"