I recently began running Citrix Receiver and Viewer via FireFox to access my corporate network as we are migrating to a cloud based virtual environment using my iMac/Yosemite OS X and noticed that after a period of inactivity, not only would my Windows 7 session be locked but if the period was long enough the Citrix session would also be disconnected. Since I am switching between several machines this was developing into a real annoyance due to complex (RSA token based auth) login steps that would have to be repeated each time I was disconnected.
A little research took me to the following page discussing App Nap and how to disable it by application or in total (not recommended for energy conservation reasons).
To run the scripts as the article above suggests you will need to locate the correct plist files for the main application and the viewer by opening the /Library/Preferences folder in your user account.
If your user folder does not display the Library subfolder in Yosemite navigate in Finder to your user folder using Shift+⌘+H and press ⌘+J to open the folder preferences pane as shown below and select the Show Library Folder option as seen below.
Note the names of the plist files as detailed for my machine in the scripts and screen shot below.
defaults write com.citrix.receiver.nomas NSAppSleepDisabled -bool YES<return>
defaults write com.citrix.xenappviewer NSAppSleepDisabled -bool YES<return>
After these scripts are executed in the user’s context (i.e., no sudo required) and the applications are restarted the energy tab in activity monitor will show No in the App Nap column as shown below and the disconnects should be corrected.