u/CalmAmity

Disabling monitor using keybinds in 0.55

I have my PC hooked up to two monitors; let's call them DP and TV. I'm only ever using one monitor at a time, while the other one is switched off. I don't want new workspaces appearing on the turned-off monitor, because they would be invisible. So I want to tell Hyprland, for instance: "TV is switched off, so move all existing workspaces to DP and open any new workspaces there as well". I want to switch between the monitors using keybinds.

In 0.54 and before, I solved this using hyprctl. I had a bind that ran a script that did

hyprctl keyword monitor "DP, preferred, auto, auto"
hyprctl keyword monitor "TV, disabled"

and a separate bind with a separate script that did the reverse.

Now in 0.55, these scripts don't work anymore. I tried:

The original hyprctl command

keyword can't work with non-legacy parsers. Use eval.

Converting the command to the new Lua syntax and using hyprctl eval

hyprctl eval 'hl.monitor({ output = "TV", disabled = true })'  
hyprctl eval 'hl.monitor({ output = "DP", mode = "preferred", position = "auto", scale = "auto" })'

The first command (disable) works, but the second (enable) doesn't seem to do anything. I end up with both monitors turned off :(

The dpms dispatcher

hl.dispatch(hl.dsp.dpms({ action = "disable", monitor = "TV" })) cuts output to TV, but doesn't actually move its workspaces to DP (or prevent any new workspaces from being created on TV).

Using workspace rules

hyprctl eval 'hl.workspace_rule({ workspace = "r[1-10]", monitor = "DP-2" })' doesn't seem to do anything - it seems like workspace rules can't be modified through hyprctl.

Any ideas as to how I can achieve this?

reddit.com
u/CalmAmity — 21 hours ago