# Move main window to other display from plugin

**URL:** <https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [April 17, 2023, 6:54pm UTC](https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534 "2023-04-17T18:54:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Mo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sebastian_mo/32/680056_2.png) [@Sebastian\_Mo](https://forums.unrealengine.com/u/Sebastian_Mo)\
**Post date:** [April 17, 2023, 6:54pm UTC](https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534/1 "2023-04-17T18:54:17Z")

</div>

Hi,  
Unreal 5.0.3, Linux.  
I’m working on plugin which will detect some OS parameters and modify main app. My HW has 3 displays and we want to choose where to place app by display ID/index.  
First attempt ended with

```auto
	UGameViewportClient* viewportClient = GEngine->GameViewport;

	if (viewportClient)
	{
		TSharedPtr<SWindow> slateWindow = viewportClient->GetWindow();

		if (slateWindow)
		{
			TSharedPtr<FGenericWindow> nativeWindow = slateWindow->GetNativeWindow();

			FDisplayMetrics DisplayMetrics;
			FSlateApplication::Get().GetDisplayMetrics(DisplayMetrics);
			if (MonitorIndex < 0 || MonitorIndex>=DisplayMetrics.MonitorInfo.Num())
			{
				UE_LOG( LogTemp, Warning, TEXT("=> Incorrect monitor index (%d)"), MonitorIndex);
				return;
			}
	
			const FMonitorInfo & MonitorInfo = DisplayMetrics.MonitorInfo[MonitorIndex];
			nativeWindow->SetWindowMode(EWindowMode::Windowed);
			nativeWindow->MoveWindowTo(MonitorInfo.DisplayRect.Left, MonitorInfo.DisplayRect.Top);
			nativeWindow->SetWindowMode(EWindowMode::WindowedFullscreen);
		}
	}

```

Without changing window mode Fullscreen-\>WIndow-\>Fullscreen this doesn’t move game window where I want it. And some slight flicker is visible. I would like to avoid it.

Second idea is to dynamically change FCommandLine to add WinX and WinY with above acquired positions and let GameEngine create GameWindow already where I want it to be.  
But I’m unable to modify FCommandLine (with Get()/Set() or Append()) in a way that it would be visible to GameEngine class.  
Is it possible?  
I would welcome any tips to solve this problem.

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [April 17, 2023, 7:19pm UTC](https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534/2 "2023-04-17T19:19:04Z")

</div>

Hi Sebastian\_Mo,  
Years ago (UE4.1) I made some changes to the code to allow me to pass in a window handle (was windows only, but the same concept would work for linux) via the command line and UE would open in that - it was pretty smooth, no flickers or anything - and it wasn’t a lot of code that had to be changed… Maybe this way could work for you too, create your window first then open UE into it.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Mo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sebastian_mo/32/680056_2.png) [@Sebastian\_Mo](https://forums.unrealengine.com/u/Sebastian_Mo)\
**Post date:** [April 21, 2023, 8:52am UTC](https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534/3 "2023-04-21T08:52:54Z")

</div>

Because we already had some engine patches - I simply added my above mentioned code piece to `UGameEngine::CreateGameWindow()` where WinX/WinY is processed.  
And I achieved my desired result.

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [September 5, 2026, 11:15am UTC](https://forums.unrealengine.com/t/move-main-window-to-other-display-from-plugin/1092534/4 "2026-09-05T11:15:39Z")

</div>

for choosing display by index this is the right track - GetDisplayMetrics + MonitorInfo.

from BP you dont need to touch UGameEngine::CreateGameWindow. just use GetAllMonitors / GetMonitorByIndex to validate index then MoveGameWindowToMonitor(index) at runtime or SetGameWindowFullscreenOnMonitor(index) for fullscreen. it handles finding the Slate window and moving it. you can also get VirtualDesktopRect if you need union bounds.

theres a fab plugin that exposes that to BP (multi-monitor display controller hashem store) if you want BP-only, but your C++ patch in CreateGameWindow is solid too.
