# Get Ignition client window size

**URL:** <https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524>\
**Category:** Ignition\
**Created:** [December 20, 2018, 4:58am UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524 "2018-12-20T04:58:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [December 20, 2018, 4:58am UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/1 "2018-12-20T04:58:15Z")

</div>

I’m looking to get the full size of the client window (i.e. the desktop size), not just the individual windows that make up the client display.  
E.g. I want to get the combined size of all docked window(s) and the floating windows.

I’m not sure how to get an object reference to the desktop to do this… from what I can tell, if I can get a reference to the VisionDesktop object, then I can use the getSize method to get its size.

How can I do this?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 20, 2018, 3:35pm UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/2 "2018-12-20T15:35:03Z")

</div>

Import `javax.swing.SwingUtilities` and use [`getRoot`](https://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#getRoot(java.awt.Component)) on some component on the window:

```auto
from javax.swing import SwingUtilities
root = SwingUtilities.getRoot(<reference to some component>)

```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [December 20, 2018, 4:22pm UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/3 "2018-12-20T16:22:43Z")

</div>

The oldies, but goodies...

> [@Scripting with the window size](http://forum.inductiveautomation.com/t/scripting-with-the-size/6145/4):
>
> Sorry, couldn’t let this one pass… This one will get screen resolution for you. import java.awt gd=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() width = gd.getDisplayMode().getWidth() height = gd.getDisplayMode().getHeight()

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 8, 2019, 11:48pm UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/4 "2019-01-08T23:48:25Z")

</div>

Thanks Paul. Next challenge: what if I don’t have any windows open at the time? E.g. on client startup, with no windows set to launch on startup? I want to be able to launch a different header dock window based on if the client is on a PC (high res) or an HMI (low res, typically 1366x768). This would be in the Client startup script

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 9, 2019, 12:26am UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/5 "2019-01-09T00:26:42Z")

</div>

Simple solution: Make a 1x1px ‘null’ window, and in the client startup script, open that, use `getRoot` from that reference, then close it right after.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 9, 2019, 1:34am UTC](https://forum.inductiveautomation.com/t/get-ignition-client-window-size/21524/6 "2019-01-09T01:34:49Z")

</div>

Thanks too Jordon, this actually resolves my other issue as well 🙂
