feat(hyprlua): add T/G scale adjust and Enter save+quit to monitor-manager
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main
parent
e840072f69
commit
280a41133f
|
|
@ -1,9 +1,7 @@
|
|||
-- https://wiki.hypr.land/Configuring/Basics/Monitors/
|
||||
-- generated by monitor-manager -- do not edit by hand
|
||||
hl.monitor({
|
||||
output = "",
|
||||
mode = "highres",
|
||||
position = "auto",
|
||||
scale = 2,
|
||||
output = "eDP-1",
|
||||
mirror = "none",
|
||||
})
|
||||
|
||||
hl.config({
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ Keys (normal mode):
|
|||
h j k l move monitor (50 px)
|
||||
H J K L move monitor (10 px fine)
|
||||
u / i rotate CCW / CW
|
||||
T / G scale up / scale down (0.25 steps)
|
||||
m toggle mirror (pick target) / un-mirror
|
||||
n / N cycle display mode forward / backward
|
||||
s save to hypr/usr/monitors.lua
|
||||
Enter save & quit
|
||||
q / Esc quit (prompts if unsaved changes)
|
||||
|
||||
Mirror-pick mode:
|
||||
|
|
@ -35,6 +37,9 @@ from typing import List, Optional
|
|||
MONITORS_LUA = Path.home() / "Dotfiles/desktopenvs/hyprlua/hypr/usr/monitors.lua"
|
||||
MOVE_STEP = 50
|
||||
MOVE_STEP_FINE = 10
|
||||
SCALE_STEP = 0.25
|
||||
MIN_SCALE = 0.25
|
||||
MAX_SCALE = 4.0
|
||||
MIN_BOX_W = 14
|
||||
MIN_BOX_H = 4
|
||||
INFO_W = 32
|
||||
|
|
@ -380,6 +385,11 @@ class App:
|
|||
self.rotate_monitor(-1)
|
||||
elif ch == ord("i"):
|
||||
self.rotate_monitor(+1)
|
||||
# Scale
|
||||
elif ch == ord("T"):
|
||||
self.scale_monitor(+SCALE_STEP)
|
||||
elif ch == ord("G"):
|
||||
self.scale_monitor(-SCALE_STEP)
|
||||
# Mirror
|
||||
elif ch == ord("m"):
|
||||
if mon.mirror_of:
|
||||
|
|
@ -402,6 +412,10 @@ class App:
|
|||
# Save
|
||||
elif ch == ord("s"):
|
||||
self._save()
|
||||
# Save & quit
|
||||
elif ch in (curses.KEY_ENTER, ord("\n"), ord("\r")):
|
||||
self._save()
|
||||
return "quit"
|
||||
# Quit
|
||||
elif ch in (ord("q"), 27): # q or Esc
|
||||
if self.dirty:
|
||||
|
|
@ -457,6 +471,20 @@ class App:
|
|||
self.dirty = True
|
||||
self.status_msg = err or f"Rotated {mon.name} → {TRANSFORM_LABEL[mon.transform]}"
|
||||
|
||||
def scale_monitor(self, delta: float):
|
||||
mon = self.monitors[self.selected_idx]
|
||||
new_scale = round(max(MIN_SCALE, min(MAX_SCALE, mon.scale + delta)), 10)
|
||||
# round to nearest SCALE_STEP to avoid floating-point drift
|
||||
new_scale = round(new_scale / SCALE_STEP) * SCALE_STEP
|
||||
if new_scale == mon.scale:
|
||||
self.status_msg = f"Scale already at {mon.scale}x (limit)"
|
||||
return
|
||||
mon.scale = new_scale
|
||||
err = apply_monitor(mon)
|
||||
mon.dirty = True
|
||||
self.dirty = True
|
||||
self.status_msg = err or f"{mon.name} scale → {mon.scale}x"
|
||||
|
||||
def cycle_mode(self, delta: int):
|
||||
mon = self.monitors[self.selected_idx]
|
||||
if not mon.available_modes:
|
||||
|
|
@ -634,7 +662,7 @@ class App:
|
|||
if self.mode == "mirror_pick":
|
||||
text = "Tab:cycle-target Enter:confirm Esc:cancel"
|
||||
else:
|
||||
text = "Tab:next hjkl:move HJK L:fine u/i:rot m:mirror n/N:mode s:save q:quit"
|
||||
text = "Tab:next hjkl:move HJKL:fine u/i:rot T/G:scale m:mirror n/N:mode s:save Enter:save+quit q:quit"
|
||||
safe_addstr(self.stdscr, row, 0, text[:cols - 1], curses.color_pair(6))
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue