From cf5a6f2635489e57ca649020624d68e7ddb00a96 Mon Sep 17 00:00:00 2001 From: Tupae <71929744+Etupa@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:34:36 +0200 Subject: [PATCH] Add a command line for multimonitor toogle (#2254) * Update DalamudCommands.cs Added a /xlmulti command for toggling multimonitor. Using Dalamud local build encounters Assertion Failure with Umbra plugin enabled. Otherwise works fine. * Update DalamudCommands.cs replaced /xlmulti with /xltogglemultimonitor to be more explicit --------- Co-authored-by: Fractal --- Dalamud/Interface/Internal/DalamudCommands.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Dalamud/Interface/Internal/DalamudCommands.cs b/Dalamud/Interface/Internal/DalamudCommands.cs index 636f71bfa..a3b28d4a8 100644 --- a/Dalamud/Interface/Internal/DalamudCommands.cs +++ b/Dalamud/Interface/Internal/DalamudCommands.cs @@ -152,6 +152,11 @@ internal class DalamudCommands : IServiceType "DalamudCopyLogHelp", "Copy the dalamud.log file to your clipboard."), }); + // Add the new command handler for toggling multi-monitor option + commandManager.AddHandler("/xltogglemultimonitor", new CommandInfo(this.OnToggleMultiMonitorCommand) + { + HelpMessage = Loc.Localize("DalamudToggleMultiMonitorHelp", "Toggle multi-monitor windows."), + }); } private void OnUnloadCommand(string command, string arguments) @@ -416,4 +421,19 @@ internal class DalamudCommands : IServiceType : Loc.Localize("DalamudLogCopyFailure", "Could not copy log file to clipboard."); chatGui.Print(message); } + + private void OnToggleMultiMonitorCommand(string command, string arguments) + { + var configuration = Service.Get(); + var chatGui = Service.Get(); + + configuration.IsDisableViewport = !configuration.IsDisableViewport; + configuration.QueueSave(); + + var message = configuration.IsDisableViewport + ? Loc.Localize("DalamudMultiMonitorDisabled", "Multi-monitor windows disabled.") + : Loc.Localize("DalamudMultiMonitorEnabled", "Multi-monitor windows enabled."); + + chatGui.Print(message); + } }