style lint

This commit is contained in:
fdev31 2023-07-30 00:18:55 +02:00
parent d48a3f4154
commit 348017c1c8
4 changed files with 18 additions and 16 deletions

View file

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

View file

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

View file

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

View file

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