Commit 734fcd41 authored by Jeremy White's avatar Jeremy White

Add sample connection scripts for Gnome.

These scripts save the current desktop background,
and then turn it red while a connection is active.
parent ea966669
......@@ -28,6 +28,8 @@ x11spice_SOURCES = \
x11spice.h \
main.c
dist_bin_SCRIPTS=x11spice_connected_gnome x11spice_disconnected_gnome
dist_man_MANS = data/x11spice.1
nobase_sysconf_DATA = xdg/x11spice/x11spice.conf
......
#!/bin/bash
#-----------------------------------------------------------------------------
# x11spice_connected_gnome
# A sample script to use with the x11spice 'on_connect' function.
# This script is called when a connection occurs.
# This sample script saves the current desktop background, and turns it red.
#-----------------------------------------------------------------------------
G=`which gconftool-2`
BG_DIR=/desktop/gnome/background
SAVE_KEY=$BG_DIR/x11spice_save_background
if [ -z "$G" ] ; then
echo Error: gconftool-2 not available 1>&2
exit -1
fi
# Remove our backup key before we snapshot the current desktop background
$G --unset $SAVE_KEY
# Snapshot the current desktop background
save=`$G --dump $BG_DIR`
$G --set -t string $SAVE_KEY "$save"
# Turn the screen red
$G --set -t string $BG_DIR/primary_color "#FFFF00000000"
$G --set -t string $BG_DIR/color_shading_type solid
$G --set -t boolean $BG_DIR/draw_background false
exit 0
#!/bin/bash
#-----------------------------------------------------------------------------
# x11spice_connected_gnome
# A sample script to use with the x11spice 'on_connect' function.
# This script is called when a connection occurs.
# This sample script saves the current desktop background, and turns it red.
#-----------------------------------------------------------------------------
G=`which gconftool-2`
BG_DIR=/desktop/gnome/background
SAVE_KEY=$BG_DIR/x11spice_save_background
if [ -z "$G" ] ; then
echo Error: gconftool-2 not available 1>&2
exit -1
fi
# Save the backup XML to a temporary file
dump_file=`mktemp`
$G --get $SAVE_KEY >$dump_file 2>/dev/null
c=`wc -c $dump_file | cut -f 1 -d ' '`
if [ $c -eq 0 ] ; then
echo Error: Could not load $SAVE_KEY 1>&2
rm -f $dump_file
exit -2
fi
# Restore the backup XML and then clear the backup key
$G --load="$dump_file"
$G --unset $SAVE_KEY
rm -f $dump_file
exit 0
......@@ -53,8 +53,8 @@
# Make sure that they are atomic, process quickly, and cannot linger.
#
#-----------------------------------------------------------------------------
#on-connect=/usr/bin/connect_x11spice
#on-disconnect=/usr/bin/disconnect_x11spice
#on-connect=/usr/bin/x11spice_connected_gnome
#on-disconnect=/usr/bin/x11spice_disconnected_gnome
#-----------------------------------------------------------------------------
# allow-control If set to true, indicates that a remote client is permitted to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment