I accomplished this using Home Assistant (specifically using HASS Agent on my computer connected to Home Assistant on another device/server). I have the same setup where one display is in my office and one is my living room TV. This works even when the PC is locked.
On HASS Agent, I setup two commands:
(1) "Gaming_PC_DisplayFusion_OLED_Only"
(2) "Gaming_PC_DisplayFusion_LvngRm_Only"
Each of these commands is Type: "PowerShell"; Entity Type: "Button".
The PowerShell command for (1) "Gaming_PC_DisplayFusion_OLED_Only" is:
& "C:\Program Files\DisplayFusion\DisplayFusionCommand.exe" -monitorloadprofile "OLED Only"
The PowerShell command for (2) "Gaming_PC_DisplayFusion_LvngRm_Only" is:
& "C:\Program Files\DisplayFusion\DisplayFusionCommand.exe" -monitorloadprofile "Living Room TCL Only"
Note that "OLED Only" and "Living Room TCL Only" are the exact names of my DisplayFusion profiles.
Then in Home Assistant, I have the ability to "click" the virtual button that tells HASS Agent to fire the chosen PowerShell command, which in turn tells DisplayFusion to load the chosen profile.
If you get into Home Assistant, you'll find you can trigger these actions from a voice assistant, dashboard, phone shortcut, webhook, tv input selection, etc.,
.........................
Sorry its not a super clean setup, but it works well enough.
.........................
My final thing to add is feedback to Home Assistant once a profile is loaded, to confirm it worked/errored out... but DisplayFusion is having issues triggering when a profile is changed (I have this issue in an open discussion with the DisplayFusion team).
Here is a DisplayFusion function (to use in lieu with a DisplayFusion trigger(s)) to send notice to Home Assistant upon profile changes:
using System;
using System.Net;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
using (var client = new WebClient())
{
client.UploadString(
"http://HomeAssistantIPhere:HomeAssistantPortHere/api/webhook/displayfusion_monitor_changed",
"POST",
""
);
}
}
}
Then in Home Assistant, a 'webhook triggered' automation(s) can be setup.
This section is not stricly necessary though...
.........................
If you end up going this route and have any questions, please let me know!