From 2eafea986255b303df28673252a4be54dfd6217d Mon Sep 17 00:00:00 2001 From: fdev31 Date: Tue, 1 Aug 2023 22:34:46 +0200 Subject: [PATCH] sorted imports --- pyprland/command.py | 15 +++++++-------- pyprland/common.py | 2 +- pyprland/ipc.py | 6 +++--- pyprland/plugins/expose.py | 4 ++-- pyprland/plugins/interface.py | 1 + pyprland/plugins/lost_windows.py | 4 ++-- pyprland/plugins/magnify.py | 3 +-- pyprland/plugins/monitors.py | 2 +- pyprland/plugins/scratchpads.py | 10 +++------- pyprland/plugins/shift_monitors.py | 4 ++-- pyprland/plugins/toggle_dpms.py | 4 ++-- pyprland/plugins/workspaces_follow_focus.py | 4 ++-- 12 files changed, 27 insertions(+), 32 deletions(-) diff --git a/pyprland/command.py b/pyprland/command.py index 9ca0320..6f4df52 100755 --- a/pyprland/command.py +++ b/pyprland/command.py @@ -1,16 +1,15 @@ #!/bin/env python -" Pyprland - an Hyprland companion app " import asyncio -from typing import cast -import json -import sys -import os import importlib import itertools +import json +import os +import sys +from typing import cast - -from .ipc import get_event_stream, init as ipc_init -from .common import init_logger, get_logger, PyprError +from .common import PyprError, get_logger, init_logger +from .ipc import get_event_stream +from .ipc import init as ipc_init from .plugins.interface import Plugin CONTROL = f'/tmp/hypr/{ os.environ["HYPRLAND_INSTANCE_SIGNATURE"] }/.pyprland.sock' diff --git a/pyprland/common.py b/pyprland/common.py index 8cd2ed3..8c5947f 100644 --- a/pyprland/common.py +++ b/pyprland/common.py @@ -1,6 +1,6 @@ """ Shared utilities: logging """ -import os import logging +import os __all__ = ["DEBUG", "get_logger", "init_logger"] diff --git a/pyprland/ipc.py b/pyprland/ipc.py index e2e3208..ea269dd 100644 --- a/pyprland/ipc.py +++ b/pyprland/ipc.py @@ -1,12 +1,12 @@ #!/bin/env python """ Interact with hyprland using sockets """ import asyncio -from logging import Logger -from typing import Any import json import os +from logging import Logger +from typing import Any -from .common import get_logger, PyprError +from .common import PyprError, get_logger log: Logger | None = None diff --git a/pyprland/plugins/expose.py b/pyprland/plugins/expose.py index 32213a5..78f8e81 100644 --- a/pyprland/plugins/expose.py +++ b/pyprland/plugins/expose.py @@ -2,9 +2,9 @@ toggle_minimized allows having an "expose" like selection of minimized windows """ from typing import Any, cast -from .interface import Plugin -from ..ipc import hyprctlJSON, hyprctl +from ..ipc import hyprctl, hyprctlJSON +from .interface import Plugin class Extension(Plugin): # pylint: disable=missing-class-docstring diff --git a/pyprland/plugins/interface.py b/pyprland/plugins/interface.py index b48dc19..4613695 100644 --- a/pyprland/plugins/interface.py +++ b/pyprland/plugins/interface.py @@ -1,5 +1,6 @@ " Common plugin interface " from typing import Any + from ..common import get_logger diff --git a/pyprland/plugins/lost_windows.py b/pyprland/plugins/lost_windows.py index 3b7c133..4556dfa 100644 --- a/pyprland/plugins/lost_windows.py +++ b/pyprland/plugins/lost_windows.py @@ -1,8 +1,8 @@ " Moves unreachable client windows to the currently focused workspace" from typing import Any, cast -from .interface import Plugin -from ..ipc import hyprctlJSON, hyprctl +from ..ipc import hyprctl, hyprctlJSON +from .interface import Plugin def contains(monitor, window): diff --git a/pyprland/plugins/magnify.py b/pyprland/plugins/magnify.py index b3d9cc2..fe3a296 100644 --- a/pyprland/plugins/magnify.py +++ b/pyprland/plugins/magnify.py @@ -1,7 +1,6 @@ " Toggles workspace zooming " -from .interface import Plugin - from ..ipc import hyprctl +from .interface import Plugin class Extension(Plugin): # pylint: disable=missing-class-docstring diff --git a/pyprland/plugins/monitors.py b/pyprland/plugins/monitors.py index da4821d..a047132 100644 --- a/pyprland/plugins/monitors.py +++ b/pyprland/plugins/monitors.py @@ -1,9 +1,9 @@ " The monitors plugin " import subprocess from typing import Any, cast -from .interface import Plugin from ..ipc import hyprctlJSON +from .interface import Plugin def configure_monitors(monitors, screenid: str, pos_x: int, pos_y: int) -> None: diff --git a/pyprland/plugins/scratchpads.py b/pyprland/plugins/scratchpads.py index e4da67f..e7b37f3 100644 --- a/pyprland/plugins/scratchpads.py +++ b/pyprland/plugins/scratchpads.py @@ -1,15 +1,10 @@ " Scratchpads addon " -import os import asyncio +import os import subprocess from typing import Any, cast -from ..ipc import ( - hyprctl, - hyprctlJSON, - get_focused_monitor_props, -) - +from ..ipc import get_focused_monitor_props, hyprctl, hyprctlJSON from .interface import Plugin DEFAULT_MARGIN = 60 @@ -230,6 +225,7 @@ async def _alternative_lookup(self): if not class_lookup_hack: return False self.log.debug("Lookup hack triggered") + # hack to update the client info from the provided class for client in await hyprctlJSON("clients"): assert isinstance(client, dict) for pending_scratch in class_lookup_hack: diff --git a/pyprland/plugins/shift_monitors.py b/pyprland/plugins/shift_monitors.py index 29990da..2e6d91c 100644 --- a/pyprland/plugins/shift_monitors.py +++ b/pyprland/plugins/shift_monitors.py @@ -1,8 +1,8 @@ " shift workspaces across monitors " from typing import cast -from .interface import Plugin -from ..ipc import hyprctlJSON, hyprctl +from ..ipc import hyprctl, hyprctlJSON +from .interface import Plugin class Extension(Plugin): # pylint: disable=missing-class-docstring diff --git a/pyprland/plugins/toggle_dpms.py b/pyprland/plugins/toggle_dpms.py index 86c6074..a395519 100644 --- a/pyprland/plugins/toggle_dpms.py +++ b/pyprland/plugins/toggle_dpms.py @@ -1,8 +1,8 @@ " Toggle monitors on or off " from typing import Any, cast -from .interface import Plugin -from ..ipc import hyprctlJSON, hyprctl +from ..ipc import hyprctl, hyprctlJSON +from .interface import Plugin class Extension(Plugin): # pylint: disable=missing-class-docstring diff --git a/pyprland/plugins/workspaces_follow_focus.py b/pyprland/plugins/workspaces_follow_focus.py index 29e2872..24efe8b 100644 --- a/pyprland/plugins/workspaces_follow_focus.py +++ b/pyprland/plugins/workspaces_follow_focus.py @@ -1,8 +1,8 @@ """ Force workspaces to follow the focus / mouse """ from typing import cast -from .interface import Plugin -from ..ipc import hyprctlJSON, hyprctl +from ..ipc import hyprctl, hyprctlJSON +from .interface import Plugin class Extension(Plugin): # pylint: disable=missing-class-docstring