# How to find out if program is running in wayland or x11 at runtime

**URL:** https://discourse.glfw.org/t/how-to-find-out-if-program-is-running-in-wayland-or-x11-at-runtime/2841
**Category:** support
**Created:** [February 12, 2025, 1:11pm UTC](https://discourse.glfw.org/t/how-to-find-out-if-program-is-running-in-wayland-or-x11-at-runtime/2841 "2025-02-12T13:11:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![constantitus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/constantitus/32/994_2.png) [@constantitus](https://discourse.glfw.org/u/constantitus)
#### Post date: [February 12, 2025, 1:11pm UTC](https://discourse.glfw.org/t/how-to-find-out-if-program-is-running-in-wayland-or-x11-at-runtime/2841/1 "2025-02-12T13:11:18Z")

</div>

On linux, glfw will pick from either x11 or wayland depending on which is available. Can I check whick one it initialized at runtime ? I need to implement some backend specific functionality and I need to do it for both of them.

---

<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: [February 12, 2025, 1:47pm UTC](https://discourse.glfw.org/t/how-to-find-out-if-program-is-running-in-wayland-or-x11-at-runtime/2841/2 "2025-02-12T13:47:39Z")

</div>

You should check out the [GLFW documentation on runtime platform selection, including querying the current platform](https://www.glfw.org/docs/latest/intro_guide.html#platform).

---

<div class="post-metadata">

### Author: ![constantitus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/constantitus/32/994_2.png) [@constantitus](https://discourse.glfw.org/u/constantitus)
#### Post date: [February 12, 2025, 2:01pm UTC](https://discourse.glfw.org/t/how-to-find-out-if-program-is-running-in-wayland-or-x11-at-runtime/2841/3 "2025-02-12T14:01:50Z")

</div>

Thanks, glfwGetPlatform() was it.
