Use "Extension" for the exported object

This commit is contained in:
fdev31 2023-04-27 23:50:17 +02:00
parent dc8d78881a
commit f0f6e0d8e2
5 changed files with 5 additions and 17 deletions

View file

@ -33,7 +33,7 @@ class Pyprland:
if name not in self.plugins: if name not in self.plugins:
modname = name if "." in name else f"pyprland.plugins.{name}" modname = name if "." in name else f"pyprland.plugins.{name}"
try: try:
plug = importlib.import_module(modname).Exported(name) plug = importlib.import_module(modname).Extension(name)
await plug.init() await plug.init()
self.plugins[name] = plug self.plugins[name] = plug
except Exception as e: except Exception as e:

View file

@ -1,10 +1,7 @@
from .interface import Plugin from .interface import Plugin
from ..ipc import hyprctlJSON, hyprctl, get_workspaces from ..ipc import hyprctlJSON, hyprctl
class Experimental(Plugin): class Extension(Plugin):
pass pass
Exported = Experimental

View file

@ -5,7 +5,7 @@ import subprocess
from ..ipc import hyprctlJSON from ..ipc import hyprctlJSON
class MonitorLayout(Plugin): class Extension(Plugin):
async def event_monitoradded(self, screenid): async def event_monitoradded(self, screenid):
screenid = screenid.strip() screenid = screenid.strip()
@ -43,6 +43,3 @@ class MonitorLayout(Plugin):
subprocess.call( subprocess.call(
["wlr-randr", "--output", screenid, "--pos", f"{x},{y}"] ["wlr-randr", "--output", screenid, "--pos", f"{x},{y}"]
) )
Exported = MonitorLayout

View file

@ -48,7 +48,7 @@ class Scratch:
self.clientInfo.update(clientInfo) self.clientInfo.update(clientInfo)
class ScratchpadManager(Plugin): class Extension(Plugin):
async def init(self): async def init(self):
self.procs: dict[str, subprocess.Popen] = {} self.procs: dict[str, subprocess.Popen] = {}
self.scratches: dict[str, Scratch] = {} self.scratches: dict[str, Scratch] = {}
@ -288,6 +288,3 @@ class ScratchpadManager(Plugin):
await hyprctl(f"focuswindow {pid}") await hyprctl(f"focuswindow {pid}")
await asyncio.sleep(0.2) # ensure some time for events to propagate await asyncio.sleep(0.2) # ensure some time for events to propagate
self.transitioning_scratches.discard(uid) self.transitioning_scratches.discard(uid)
Exported = ScratchpadManager

View file

@ -54,6 +54,3 @@ class Extension(Plugin):
] ]
await hyprctl(f"moveworkspacetomonitor {next_workspace},{monitor['name']}") await hyprctl(f"moveworkspacetomonitor {next_workspace},{monitor['name']}")
await hyprctl(f"workspace {next_workspace}") await hyprctl(f"workspace {next_workspace}")
Exported = Extension