Citrix Receiver – use all available external monitors

When working on a remote server over Citrix, it is sometimes useful not having ICAClient to span over all monitors in fullscreen mode. It is possible to tell wfica to only span certain monitors with the -span parameter.

Change /opt/Citrix/ICAClient/wfica.sh to:

#!/bin/bash
ICAROOT=/opt/Citrix/ICAClient
export ICAROOT
LD_LIBRARY_PATH=/opt/Citrix/ICAClient/lib
export LD_LIBRARY_PATH

array_join() {
    local IFS="$1"
    shift
    echo "$*"
}

param=""
number_of_monitors="$(xrandr --query | grep -c " connected ")"

if (( number_of_monitors > 1 )); then
    param="-span"
    monitors=()
    for monitor in $(seq 2 "${number_of_monitors}"); do
        monitors+=("${monitor}")
    done

    param="${param} $(array_join ',' "${monitors[@]}")"
fi

$ICAROOT/wfica ${param} -file $1

This will use all monitors, except for the first one in fullscreen mode (unless you only have one monitor of course).

To get this to work automagically, Firefox has to be told to open *.ica files with this script. Go to Edit, Preferences, Applications, type ica in the search, select Use other... as action and browse to /opt/Citrix/ICAClient/wfica.sh.