!7 cmodule MinimizeToTray > DynPrintLogAndEnabled { transient bool activating; bool fullScreen; start { checkIfFullScreen(); JFrame f = getFrame(dm_desktopPane()); if (f == null) print("No frame found"); else { ownResource(tempOnFrameIconified(f, r { if (!activating) f.setVisible(false) })); ownResource(tempOnWindowStateChanged(f, r checkIfFullScreen)); print("Minimize to tray installed"); } Runnable rShow = r { activating = true; try { activateFrame(dm_desktopPane(), windowsHack := false, maximize := fullScreen); } finally { activating = false; } }; S name = dm_osName(); dm_systemTrayIcon(dm_osIconID(), name, rShow, "Show " + name, rShow); } void checkIfFullScreen { JFrame f = getFrame(dm_desktopPane()); if (f == null) ret; int state = f.getState(); if (state == JFrame.MAXIMIZED_BOTH) setField(fullScreen := true); else if (state == JFrame.NORMAL) setField(fullScreen := false); } bool warnOnDelete() { true; } }