Add magnify plugin
This commit is contained in:
parent
326c707db0
commit
e00490ee5b
2 changed files with 36 additions and 1 deletions
16
README.md
16
README.md
|
@ -34,6 +34,7 @@ A single config file `~/.config/hypr/pyprland.json` is used, using the following
|
|||
- `workspaces_follow_focus` provides commands and handlers allowing a more flexible workspaces usage on multi-monitor setups. If you think the multi-screen behavior of hyprland is not usable or broken/unexpected, this is probably for you.
|
||||
- `lost_windows` brings lost floating windows to the current workspace
|
||||
- `toggle_dpms` toggles the DPMS status of every plugged monitor
|
||||
- `magnify` toggles zooming of viewport or sets a specific scaling factor
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -89,6 +90,19 @@ Create a configuration file in `~/.config/hypr/pyprland.json` enabling a list of
|
|||
|
||||
# Configuring plugins
|
||||
|
||||
## `magnify` plugin
|
||||
|
||||
### Command
|
||||
|
||||
- `zoom [value]`: if no value, toggles magnification. If an integer is provided, it will set as scaling factor.
|
||||
|
||||
### Configuration
|
||||
|
||||
|
||||
#### `factor`
|
||||
|
||||
Scaling factor to be used when no value is provided.
|
||||
|
||||
## `toggle_dpms` plugin
|
||||
|
||||
### Command
|
||||
|
@ -242,7 +256,7 @@ Just add a method called `run_<name of your command>`, eg with "togglezoom" comm
|
|||
|
||||
```python
|
||||
async def init(self):
|
||||
self.zommed = False
|
||||
self.zoomed = False
|
||||
|
||||
async def run_togglezoom(self, args):
|
||||
if self.zoomed:
|
||||
|
|
21
pyprland/plugins/magnify.py
Normal file
21
pyprland/plugins/magnify.py
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue