Fixed Xclient scripts and added some examples (#717)

This commit is contained in:
mattlalumiere 2022-11-18 11:31:41 -05:00 committed by GitHub
parent 6ca35ffab0
commit 6cb18816e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 1 deletions

1
__main__.py Symbolic link
View File

@ -0,0 +1 @@
screen.py

View File

@ -0,0 +1,53 @@
#!/bin/bash
# Change XCLIENT and/or display to your destination xserver (XSDL platform).
# Example: export DISPLAY=192.168.1.101:0
# Note: You will likely want to reserve a DHCP address or set a static IP of the
# Xserver clientso that your IP does not change and require reconfiguration.
export XCLIENT=change_me
export DISPLAY=change_me
if [ $XCLIENT == "change_me" ]; then
echo "launch_klipperscreen.sh for XSDL/XServer Clients has not been cofigured properly. Please edit this file to point to your XServer Client"
exit
fi
# Send script to daemon process so that it does not fail when tty closes.
#
export PYKLIPPERSCREEN=~/.KlipperScreen-env/bin/python
export PYKLIPPERSCREENPARAM=~/KlipperScreen/screen.py
if [ -f $PYKLIPPERSCREEN ]; then
echo "Testing $PYKLIPPERSCREEN"
test -x $PYKLIPPERSCREEN || echo "$PYKLIPPERSCREEN is Not Executable"
fi
if [ -f $PYKLIPPERSCREENPARAM ]; then
echo "Testing $PYKLIPPERSCREENPARAM"
test -f $PYKLIPPERSCREENPARAM || echo "$PYKLIPPERSCREENPARAM is not a file"
fi
case "$1" in
start)
echo -n "Starting Klipper Screen Xclient Deamon .... "
setsid "$PYKLIPPERSCREEN" "$PYKLIPPERPARAM" #>/dev/null 2>&1 < /dev/null &
echo "running"
;;
stop)
echo -n "Stopping Klipper Screen Xclient Deamon .... "
PID=`ps -ef|grep KlipperScreen-env/bin/python|awk '{print $2}'`
kill -9 $PID
echo "stopping"
;;
*)
echo "Usage: $0 start"
exit 1
;;
esac

View File

@ -4,7 +4,12 @@
# Keeps the process alive while the server is active # Keeps the process alive while the server is active
# to mimic default X's behaviour and keep the service happy # to mimic default X's behaviour and keep the service happy
./lauch_klipperscreen.sh if [ -f $PWD/launch_klipperscreen.sh ]; then
exec $PWD/launch_klipperscreen.sh
elif [ ! -f $PWD/launch_klipperscreen.sh ]; then
echo "launch_klipperscreen.sh does not exist"
exit
fi
ret=1 ret=1
timeout=0 timeout=0