# Can you get the monitor which a window is currently on?

**URL:** <https://discourse.glfw.org/t/can-you-get-the-monitor-which-a-window-is-currently-on/2593>\
**Category:** support\
**Created:** [April 9, 2024, 10:05pm UTC](https://discourse.glfw.org/t/can-you-get-the-monitor-which-a-window-is-currently-on/2593 "2024-04-09T22:05:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mort](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/mort/32/895_2.png) [@mort](https://discourse.glfw.org/u/mort)\
**Post date:** [April 9, 2024, 10:05pm UTC](https://discourse.glfw.org/t/can-you-get-the-monitor-which-a-window-is-currently-on/2593/1 "2024-04-09T22:05:35Z")

</div>

The function `glfwGetWindowMonitor` only gives you a monitor if the window is fullscreen. Is there a way to get the monitor which a non-fullscreen window is on?

I understand that windows can span multiple monitors, but usually it’s “primarily” associated with one monitor at a time. This is the monitor whose DPI scaling applies to the window contents, the monitor which the window is vsynced against, etc.

I believe the SDL2 function `SDL_GetWindowDisplayIndex` does essentially what I want, and I’m wondering if there’s a GLFW equivalent.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [April 10, 2024, 10:39am UTC](https://discourse.glfw.org/t/can-you-get-the-monitor-which-a-window-is-currently-on/2593/2 "2024-04-10T10:39:10Z")

</div>

Hi @mort and welcome to the GLFW forum,

> Is there a way to get the monitor which a non-fullscreen window is on?

Currently no, but there is an issue with some example code and a couple of PRs for this, see:

> <https://github.com/glfw/glfw/issues/1699>
>
> macOS and Windows both have some concept of which monitor is "current" when mult…iple displays are attached.
> 
> macOS: \[\`\[NSScreen main\]\`\](https://developer.apple.com/documentation/appkit/nsscreen/1388371-main) returns the monitor which contains the window which currently has keyboard focus.
> Windows: \`MonitorFromWindow(GetForegroundWindow())\` does the same. (\[MonitorFromWindow\](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-monitorfromwindow), \[GetForegroundWindow\](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow))
> 
> It would be great to be able to get this information through glfw to support the use case of opening a window on the "correct" display.
