Works as desired; thanks! In case it helps someone else, the below updates on idle, re-opening all the windows that were open in the primary desktop after updating. It also prints a line to client console recording update.
Script in shared.gui (edit: improved with @cmaynes suggestion in following post):
from com.inductiveautomation.factorypmi.application.runtime import UpdateAvailableInfoBar
# Is an update available for client?
result = False
for sub in obj.getComponents():
#print "*"*10, type(sub)
if not result:
result = getUpdateNotification(sub)
Script in client event timer script:
from javax.swing import SwingUtilities
# If client has been inactive for an hour, check for update.
if system.util.getInactivitySeconds() > 3600:
# Get windows in main desktop where notification is shown.
windows = system.gui.getOpenedWindows()
# Get root of first window.
root = SwingUtilities.getRoot(windows)
# If there's an update notification, update client.
# Get project name and opened windows.
print "Found update notification info bar while idle. Updating client."
projectName = system.tag.read('[System]Client/System/ProjectName').value
openWindows = system.gui.getOpenedWindowNames()
# Update by retargeting back to same project and open same windows.
system.util.retarget(projectName, None, None, openWindows)