Skip to content

Commit

Permalink
small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Sep 27, 2024
1 parent d11186e commit 442f9cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions pyprland/plugins/scratchpads/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from ...aioops import aiexists, aiopen
from ...common import CastBoolMixin, state
from ...ipc import notify_error
from ...types import ClientInfo, MonitorInfo, VersionInfo
from .helpers import OverridableConfig, get_match_fn

Expand Down Expand Up @@ -67,18 +66,20 @@ def forced_monitor(self) -> str | None:

def set_config(self, full_config: dict[str, Any]) -> None:
"""Apply constraints to the configuration."""
opts = full_config[self.uid].copy()
opts = {}
if "inherit" in opts:
inheritance = opts["inherit"]
if isinstance(inheritance, str):
inheritance = [inheritance]
for source in inheritance:
opts.update(full_config.get(source, {}))
try:
opts.update(full_config[source])
except KeyError:
text = f"Scratchpad {self.uid} tried to inherit from {source}, but it doesn't exist"
self.log.exception(text)

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")):
opts["lazy"] = True
if not opts.get("process_tracking", True):
Expand Down Expand Up @@ -114,11 +115,6 @@ async def initialize(self, ex: "_scratchpads_extension_m.Extension") -> None:
self.client_info = m_client
assert self.client_info, "couldn't find a matching client"
await ex.hyprctl(f"movetoworkspacesilent special:scratch_{self.uid},address:{self.full_address}")
if "class_match" in self.conf: # NOTE: legacy, to be removed
await notify_error(
f'scratchpad {self.uid} should use match_by="class" instead of the deprecated class_match',
logger=self.log,
)
self.meta.initialized = True

async def is_alive(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion pyprland/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version."""

VERSION = "2.4.0-54"
VERSION = "2.4.0-55"

0 comments on commit 442f9cc

Please sign in to comment.