Add magnify plugin

This commit is contained in:
fdev31 2023-04-29 21:30:37 +02:00
parent 326c707db0
commit e00490ee5b
2 changed files with 36 additions and 1 deletions

View file

@ -0,0 +1,21 @@
from .interface import Plugin
from ..ipc import hyprctlJSON, hyprctl
class Extension(Plugin):
async def init(self):
self.zoomed = False
async def run_zoom(self, *args):
if args:
value = int(args[0])
await hyprctl(f"misc:cursor_zoom_factor {value}", "keyword")
self.zoomed = value != 1
else: # toggle
if self.zoomed:
await hyprctl("misc:cursor_zoom_factor 1", "keyword")
else:
fact = int(self.config.get("factor", 2))
await hyprctl(f"misc:cursor_zoom_factor {fact}", "keyword")
self.zoomed = not self.zoomed