#!/bin/sh if [ -z "$DISPLAY" ];then exit 1 fi # Initialize LTSP_RCOMMAND as blank reset_xprop(){ xprop -root -f $1 8u -set $1 "" } reset_xprop LTSP_RCOMMAND reset_xprop LTSP_RCOMMAND_WAIT # Poll for LTSP_RCOMMAND changes and execute xprop -notype -root -spy LTSP_RCOMMAND | while read junk_x junk_y LTSP_RCOMMAND ; do # Strip off leading and trailing double-quotes. LTSP_RCOMMAND=${LTSP_RCOMMAND%\"} LTSP_RCOMMAND=${LTSP_RCOMMAND#\"} # If empty, nothing to execute, return to the loop. test -n "${LTSP_RCOMMAND}" || continue LTSP_RCOMMAND_WAIT=$(xprop -root -notype LTSP_RCOMMAND_WAIT |sed -e 's/^LTSP_RCOMMAND_WAIT = //' -e 's/^"//' -e 's/"$//') if [ -n "${LTSP_RCOMMAND}" ]; then if [ "$LTSP_RCOMMAND_WAIT" = "true" ]; then ssh -Y -t -S ${LDM_SOCKET} ${LDM_SERVER} "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SCANNER $MY_SOUND ${LTSP_RCOMMAND}" else ssh -Y -t -S ${LDM_SOCKET} ${LDM_SERVER} "$CLIENT_ENV $MY_LANG $MY_DISP $MY_SCANNER $MY_SOUND ${LTSP_RCOMMAND}" & fi fi reset_xprop LTSP_RCOMMAND reset_xprop LTSP_RCOMMAND_WAIT done