better -h/--help display
This commit is contained in:
parent
e00490ee5b
commit
04724162ac
6 changed files with 15 additions and 4 deletions
|
@ -137,7 +137,7 @@ async def run_daemon():
|
||||||
|
|
||||||
|
|
||||||
async def run_client():
|
async def run_client():
|
||||||
if sys.argv[1] == "--help":
|
if sys.argv[1] in ("--help", "-h"):
|
||||||
manager = Pyprland()
|
manager = Pyprland()
|
||||||
await manager.load_config(init=False)
|
await manager.load_config(init=False)
|
||||||
print(
|
print(
|
||||||
|
@ -147,12 +147,16 @@ If command is ommited, runs the daemon which will start every configured command
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
|
||||||
reload"""
|
reload Reloads the config file (only supports adding or updating plugins)"""
|
||||||
)
|
)
|
||||||
for plug in manager.plugins.values():
|
for plug in manager.plugins.values():
|
||||||
for name in dir(plug):
|
for name in dir(plug):
|
||||||
if name.startswith("run_") and callable(getattr(plug, name)):
|
if name.startswith("run_"):
|
||||||
print(f" {name[4:]:20} (from {plug.name})")
|
fn = getattr(plug, name)
|
||||||
|
if callable(fn):
|
||||||
|
print(
|
||||||
|
f" {name[4:]:20} {fn.__doc__.strip() if fn.__doc__ else 'N/A'} (from {plug.name})"
|
||||||
|
)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ def contains(monitor, window):
|
||||||
|
|
||||||
class Extension(Plugin):
|
class Extension(Plugin):
|
||||||
async def run_attract_lost(self, *args):
|
async def run_attract_lost(self, *args):
|
||||||
|
"""Brings lost floating windows to the current workspace"""
|
||||||
monitors = await hyprctlJSON("monitors")
|
monitors = await hyprctlJSON("monitors")
|
||||||
windows = await hyprctlJSON("clients")
|
windows = await hyprctlJSON("clients")
|
||||||
lost = [
|
lost = [
|
||||||
|
|
|
@ -8,6 +8,7 @@ class Extension(Plugin):
|
||||||
self.zoomed = False
|
self.zoomed = False
|
||||||
|
|
||||||
async def run_zoom(self, *args):
|
async def run_zoom(self, *args):
|
||||||
|
"""[factor] zooms to "factor" or toggles zoom level ommited"""
|
||||||
if args:
|
if args:
|
||||||
value = int(args[0])
|
value = int(args[0])
|
||||||
await hyprctl(f"misc:cursor_zoom_factor {value}", "keyword")
|
await hyprctl(f"misc:cursor_zoom_factor {value}", "keyword")
|
||||||
|
|
|
@ -196,6 +196,7 @@ class Extension(Plugin):
|
||||||
item.just_created = False
|
item.just_created = False
|
||||||
|
|
||||||
async def run_toggle(self, uid: str) -> None:
|
async def run_toggle(self, uid: str) -> None:
|
||||||
|
"""<name> toggles visibility of scratchpad "name" """
|
||||||
uid = uid.strip()
|
uid = uid.strip()
|
||||||
item = self.scratches.get(uid)
|
item = self.scratches.get(uid)
|
||||||
if not item:
|
if not item:
|
||||||
|
@ -227,6 +228,7 @@ class Extension(Plugin):
|
||||||
self.scratches_by_address[scratch.clientInfo["address"][2:]] = scratch
|
self.scratches_by_address[scratch.clientInfo["address"][2:]] = scratch
|
||||||
|
|
||||||
async def run_hide(self, uid: str, force=False) -> None:
|
async def run_hide(self, uid: str, force=False) -> None:
|
||||||
|
"""<name> hides scratchpad "name" """
|
||||||
uid = uid.strip()
|
uid = uid.strip()
|
||||||
item = self.scratches.get(uid)
|
item = self.scratches.get(uid)
|
||||||
if not item:
|
if not item:
|
||||||
|
@ -262,6 +264,7 @@ class Extension(Plugin):
|
||||||
await hyprctl(f"movetoworkspacesilent special:scratch,{pid}")
|
await hyprctl(f"movetoworkspacesilent special:scratch,{pid}")
|
||||||
|
|
||||||
async def run_show(self, uid, force=False) -> None:
|
async def run_show(self, uid, force=False) -> None:
|
||||||
|
"""<name> shows scratchpad "name" """
|
||||||
uid = uid.strip()
|
uid = uid.strip()
|
||||||
item = self.scratches.get(uid)
|
item = self.scratches.get(uid)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ from ..ipc import hyprctlJSON, hyprctl
|
||||||
|
|
||||||
class Extension(Plugin):
|
class Extension(Plugin):
|
||||||
async def run_toggle_dpms(self):
|
async def run_toggle_dpms(self):
|
||||||
|
"""toggles dpms on/off for every monitor"""
|
||||||
monitors = await hyprctlJSON("monitors")
|
monitors = await hyprctlJSON("monitors")
|
||||||
poweredOff = any(m["dpmsStatus"] for m in monitors)
|
poweredOff = any(m["dpmsStatus"] for m in monitors)
|
||||||
if not poweredOff:
|
if not poweredOff:
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Extension(Plugin):
|
||||||
await hyprctl(batch)
|
await hyprctl(batch)
|
||||||
|
|
||||||
async def run_change_workspace(self, direction: str):
|
async def run_change_workspace(self, direction: str):
|
||||||
|
"""<+1/-1> Switch workspaces of current monitor, avoiding displayed workspaces"""
|
||||||
increment = int(direction)
|
increment = int(direction)
|
||||||
# get focused screen info
|
# get focused screen info
|
||||||
monitors = await hyprctlJSON("monitors")
|
monitors = await hyprctlJSON("monitors")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue