Hyprland version
PASTE YOUR HYPRLAND VERSION HERE (0.55.2), BETWEEN THE BACKTICKS. DO NOT REMOVE ANY FORMATTING.
I’m attempting to automate the process of switching between my main monitor and a connected TV on my PC using a shell script. However, I’d like to leverage hyprctl to automate this process. I have been modifying the config file manually to set it previously and now I’m using the lua configuration. Example:
-- Default Configuration
hl.monitor({ output = "DP-1", mode = "[email protected]", position = "0x0", scale = "1" })
hl.monitor({ output = "HDMI-A-1", disabled = true })
-- TV configuration
-- hl.monitor({ output = "HDMI-A-1", mode = "[email protected]", position = "0x0", scale = "1", bitdepth = 10 })
-- hl.monitor({ output = "DP-1", disabled = true })
These configurations work as expected, but I’d like to automate the process using a shell script.
game_tv() {
hyprctl --batch "
eval hl.monitor({ output = 'HDMI-A-1', mode = '[email protected]', position = '0x0', scale = 1, bitdepth = 10 }) ;
eval hl.monitor({ output = 'DP-1', disabled = true })
"
}
However, when I run the script using hyprctl --batch, it doesn’t apply the changes as expected.
Troubleshooting Attempts
I’ve tried running the command manually and without the --batch flag to see if it was a batch mode issue. Unfortunately, none of these attempts have resolved the problem.
hyprctl --batch "
eval hl.monitor({ output = 'HDMI-A-1', mode = '[email protected]', position = '0x0', scale = 1, bitdepth = 10 }) ;
eval hl.monitor({ output = 'DP-1', disabled = true })
"
ok
ok
hyprctl eval 'hl.monitor({ output = "HDMI-A-1", mode = "[email protected]", position = "0x0", scale = 1, bitdepth = 10 })'
ok
I’d appreciate any assistance in resolving this issue.