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] focused = [mon for mon in monitors if mon["focused"]][0]
interval = focused["width"] / (1 + len(lost)) interval = focused["width"] / (1 + len(lost))
intervalY = focused["height"] / (1 + len(lost)) interval_y = focused["height"] / (1 + len(lost))
batch = [] batch = []
workspace: int = focused["activeWorkspace"]["id"] workspace: int = focused["activeWorkspace"]["id"]
margin = interval // 2 margin = interval // 2
marginY = intervalY // 2 margin_y = interval_y // 2
for i, window in enumerate(lost): for i, window in enumerate(lost):
batch.append(f'movetoworkspacesilent {workspace},pid:{window["pid"]}') batch.append(f'movetoworkspacesilent {workspace},pid:{window["pid"]}')
batch.append( 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) await hyprctl(batch)

View file

@ -6,13 +6,13 @@ from .interface import Plugin
from ..ipc import hyprctlJSON 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" "Apply the configuration change"
x_offset = -x if x < 0 else 0 x_offset = -pos_x if pos_x < 0 else 0
y_offset = -y if y < 0 else 0 y_offset = -pos_y if pos_y < 0 else 0
min_x = x min_x = pos_x
min_y = y min_y = pos_y
command = ["wlr-randr"] command = ["wlr-randr"]
other_monitors = [mon for mon in monitors if mon["name"] != screenid] 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) subprocess.call(command)

View file

@ -119,12 +119,12 @@ class Scratch:
"Returns the client address" "Returns the client address"
return str(self.client_info.get("address", ""))[2:] 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" "update the internal client info property, if not provided, refresh based on the current address"
if clientInfo is None: if client_info is None:
clientInfo = await get_client_props_by_address("0x" + self.address) client_info = await get_client_props_by_address("0x" + self.address)
assert isinstance(clientInfo, dict) assert isinstance(client_info, dict)
self.client_info.update(clientInfo) self.client_info.update(client_info)
def __str__(self): def __str__(self):
return f"{self.uid} {self.address} : {self.client_info} / {self.conf}" 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): async def run_toggle_dpms(self):
"""toggles dpms on/off for every monitor""" """toggles dpms on/off for every monitor"""
monitors = await hyprctlJSON("monitors") monitors = await hyprctlJSON("monitors")
poweredOff = any(m["dpmsStatus"] for m in monitors) powered_off = any(m["dpmsStatus"] for m in monitors)
if not poweredOff: if not powered_off:
await hyprctl("dpms on") await hyprctl("dpms on")
else: else:
await hyprctl("dpms off") await hyprctl("dpms off")