Comment 11 for bug 1011482

Revision history for this message
LaƩrcio de Sousa (lbssousa) wrote :

Hi there!

Instead of hacking /usr/sbin/epoptes-client, I've written a wrapper script to be executed instead in /etc/xdg/autostart/epoptes-client.desktop. Here's the code (tested on Xubuntu 15.04):

#!/bin/sh

old_hostname=$(hostname)

[ -x /usr/bin/nm-online ] && nm-online --timeout=600

until [ "$State" = "closing" ]
do
    new_hostname=$(hostname)

    if [ "${new_hostname}" != "${old_hostname}" ]
    then
        cookie=$(xauth list ${old_hostname}/unix${DISPLAY} | cut -f5 -d' ')
        xauth add "${new_hostname}/unix${DISPLAY}" "MIT-MAGIC-COOKIE-1" ${cookie}
        old_hostname=${new_hostname}
    fi

    epoptes-client
    eval $(loginctl show-session ${XDG_SESSION_ID} | grep "State")
done