Page 1 of 1

"Center a window" action

Posted: Fri Aug 09, 2019 8:41 am
by xpclient
Feature request: Center a window (I noticed Minimize, Maximize, Restore but not Center).

Is it possible? Sorry in advance if it exists and I didn't notice it. :P

XMBC Version: 2.18.7
Windows Version: Windows 8.1
Mouse Information (brand/model): Microsoft Bluetooth Mobile Mouse 3600
Relevant Computer Information (CPU, RAM etc): Intel Core i5 Quad Core, 8 GB RAM, 256 GB SSD

Re: "Center a window" action

Posted: Fri Aug 09, 2019 9:02 am
by phil
Its not there (there isn't a Windows API call to do that like there is for min/max etc.) but it should be possible to do something like that.
I presume you are talking about centering it relative to the desktop of the current monitor that the window is on?

Re: "Center a window" action

Posted: Sat Sep 07, 2019 6:33 am
by xpclient
Yes. I found a AutoHotkey to make it work.

Code: Select all

^+Home::
global windowName
global X
global Y
global begWidth
global begHeight
WinGetTitle, windowName, A
WinGetPos, X, Y, begWidth, begHeight, %windowName%
CenterWindow(windowTitleVariable)
{
    WinGetPos,,, Width, Height, %windowTitleVariable%
    WinMove, %windowTitleVariable%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2    )-(Height/2)
}
CenterWindow(windowName)
return
^+End::
WinMove, %windowName%,, X, Y, begWidth, begHeight
return
Ctrl+Shift+Home centers a window, Ctrl+Shift+End restores it. Converted it into an EXE

Re: "Center a window" action

Posted: Sat Sep 07, 2019 10:19 am
by phil
Nice,

I'll still aim to add it natively to XMBC - but good that you have a solution in the meantime.