"The SSH connection you are initiating stays up only as long as:
The commands you've specified are running. There are active X11 connections.
In your case, when you specify ""someapp; sleep 1"", this means that after ""someapp"" exits, there is a 1 second time window in which a new X11 connection must be established, before the connection is terminated.
SSH cannot know by itself when it should terminate, if someapp starts another application in the background, which will only later connect to the X display - hence you need to work out something to give it that information. Like a wrapper script that doesn't exit until the program spawned by the launcher exits.