Autostart an app

Anyone know if there’s a way to auto-start a Shotgun Desktop app after login on a per-machine or per-user basis?


If its a custom app, you can do the same as tk-multi-workfiles2 app using a QtCore.QTimer.singleShot:

Or if you want to open an app without changing it, you can create a core/hooks/ hook. In the post_context_change method, you can find your app by using self.parent.apps[“your-app-name”] and call any method you want from there.

Thanks, Michael. So if we want it to only be on one machine, we can use a hook in the config and add an if/then based on something like the computer name?

Yes you can have in the config the list of machine/users you want to autostart the app and use it line 108 (in the example above) instead of the self.get_settings(“launch_at_startup”).

it can be:

user = sgtk.util.get_current_user()
if user and user["login"] in self.get_setting("launch_at_startup_users"):
  from sgtk.platform.qt import QtCore
  QtCore.QTimer.singleShot(200, self.show_file_open_dlg)