diff --git a/pyprland/plugins/lost_windows.py b/pyprland/plugins/lost_windows.py index d6c5a54..84ae53b 100644 --- a/pyprland/plugins/lost_windows.py +++ b/pyprland/plugins/lost_windows.py @@ -29,14 +29,14 @@ class Extension(Plugin): ] focused = [mon for mon in monitors if mon["focused"]][0] interval = focused["width"] / (1 + len(lost)) - intervalY = focused["height"] / (1 + len(lost)) + interval_y = focused["height"] / (1 + len(lost)) batch = [] workspace: int = focused["activeWorkspace"]["id"] margin = interval // 2 - marginY = intervalY // 2 + margin_y = interval_y // 2 for i, window in enumerate(lost): batch.append(f'movetoworkspacesilent {workspace},pid:{window["pid"]}') batch.append( - f'movewindowpixel exact {int(margin + focused["x"] + i*interval)} {int(marginY + focused["y"] + i*intervalY)},pid:{window["pid"]}' + f'movewindowpixel exact {int(margin + focused["x"] + i*interval)} {int(margin_y + focused["y"] + i*interval_y)},pid:{window["pid"]}' ) await hyprctl(batch) diff --git a/pyprland/plugins/monitors.py b/pyprland/plugins/monitors.py index fa6cc86..dfaf40f 100644 --- a/pyprland/plugins/monitors.py +++ b/pyprland/plugins/monitors.py @@ -6,13 +6,13 @@ from .interface import Plugin from ..ipc import hyprctlJSON -def configure_monitors(monitors, screenid: str, x: int, y: int) -> None: +def configure_monitors(monitors, screenid: str, pos_x: int, pos_y: int) -> None: "Apply the configuration change" - x_offset = -x if x < 0 else 0 - y_offset = -y if y < 0 else 0 + x_offset = -pos_x if pos_x < 0 else 0 + y_offset = -pos_y if pos_y < 0 else 0 - min_x = x - min_y = y + min_x = pos_x + min_y = pos_y command = ["wlr-randr"] other_monitors = [mon for mon in monitors if mon["name"] != screenid] @@ -31,7 +31,9 @@ def configure_monitors(monitors, screenid: str, x: int, y: int) -> None: ] ) - command.extend(["--output", screenid, "--pos", f"{x+x_offset},{y+y_offset}"]) + command.extend( + ["--output", screenid, "--pos", f"{pos_x+x_offset},{pos_y+y_offset}"] + ) subprocess.call(command) diff --git a/pyprland/plugins/scratchpads.py b/pyprland/plugins/scratchpads.py index 97a26bd..b10c1a5 100644 --- a/pyprland/plugins/scratchpads.py +++ b/pyprland/plugins/scratchpads.py @@ -119,12 +119,12 @@ class Scratch: "Returns the client address" return str(self.client_info.get("address", ""))[2:] - async def updateClientInfo(self, clientInfo=None) -> None: + async def updateClientInfo(self, client_info=None) -> None: "update the internal client info property, if not provided, refresh based on the current address" - if clientInfo is None: - clientInfo = await get_client_props_by_address("0x" + self.address) - assert isinstance(clientInfo, dict) - self.client_info.update(clientInfo) + if client_info is None: + client_info = await get_client_props_by_address("0x" + self.address) + assert isinstance(client_info, dict) + self.client_info.update(client_info) def __str__(self): return f"{self.uid} {self.address} : {self.client_info} / {self.conf}" diff --git a/pyprland/plugins/toggle_dpms.py b/pyprland/plugins/toggle_dpms.py index ece811b..1f7483e 100644 --- a/pyprland/plugins/toggle_dpms.py +++ b/pyprland/plugins/toggle_dpms.py @@ -7,8 +7,8 @@ class Extension(Plugin): async def run_toggle_dpms(self): """toggles dpms on/off for every monitor""" monitors = await hyprctlJSON("monitors") - poweredOff = any(m["dpmsStatus"] for m in monitors) - if not poweredOff: + powered_off = any(m["dpmsStatus"] for m in monitors) + if not powered_off: await hyprctl("dpms on") else: await hyprctl("dpms off")