Created
January 27, 2020 07:04
-
-
Save Geofferey/42690fa86df0a740491acdc9d9100a28 to your computer and use it in GitHub Desktop.
nx-session-chooser.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## A simple session chooser for NX virtual desktops written using Zenity dialog boxes. | |
## Change the node.cfg default desktop to thid script | |
# DefaultDesktopCommand "/usr/bin/nx-session-choose.sh | |
## This script should easily be adaptable to suit ones needs. | |
sleep 4.5 | |
export NX_SESSION=1 | |
metacity & | |
onboard & | |
PROMPT0=`zenity --list --title="NX Session Chooser" --column="0" "LXDE" "MATE" "Plasma" "Kodi" "XDMCP" --width=100 --height=300 --hide-header` | |
if [ "$PROMPT0" == "LXDE" ]; then | |
PROMPT1=`zenity --list --title="LXDE Session Chooser" --column="0" "LXDE (NX audio)" "LXDE (ext pulseaudio)" --width=100 --height=300 --hide-header` | |
#export NX_SESSION=1 | |
#unset PULSE_SERVER | |
#killall metacity | |
#exec startlxde | |
fi | |
if [ "$PROMPT0" == "Plasma" ]; then | |
#PROMPT1=`zenity --list --title="LXDE Session Chooser" --column="0" "LXDE (NX audio)" "LXDE (ext pulseaudio)" --width=100 --height=300 --hide-header` | |
export NX_SESSION=1 | |
#unset PULSE_SERVER | |
killall metacity | |
exec startkde | |
fi | |
if [ "$PROMPT0" == "MATE" ]; then | |
PROMPT1=`zenity --list --title="MATE Session Chooser" --column="0" "MATE (NX audio)" "MATE (ext pulseaudio)" --width=100 --height=300 --hide-header` | |
fi | |
if [ "$PROMPT0" == "Kodi" ]; then | |
export NX_SESSION=0 | |
killall metacity | |
exec kodi-standalone | |
fi | |
if [ "$PROMPT0" == "XDMCP" ]; then | |
PROMPT1=`zenity --list --title="XDCMP Session Chooser" --column="0" "Local" "Other" --width=100 --height=300 --hide-header` | |
fi | |
if [ "$PROMPT1" == "LXDE (NX audio)" ]; then | |
export NX_SESSION=1 | |
killall onboard | |
killall metacity | |
exec /etc/X11/Xsession default | |
fi | |
if [ "$PROMPT1" == "LXDE (ext pulseaudio)" ]; then | |
NX_PULSE_SERVER=$(echo $PULSE_SERVER) | |
#unset PULSE_SERVER | |
PULSE_SERVER=$(zenity --entry --text="Address to server:" --title="Pulse Server") | |
if [[ -z $PULSE_SERVER ]]; then | |
export PULSE_SERVER=$NX_PULSE_SERVER | |
fi | |
export NX_SESSION=1 | |
export PULSE_SERVER=$PULSE_SERVER | |
killall onboard | |
killall metacity | |
exec startlxde | |
fi | |
if [ "$PROMPT1" == "Local" ]; then | |
export NX_SESSION=0 | |
unset PULSE_SERVER | |
export PULSE_SERVER=127.0.0.1 | |
killall onboard | |
sleep 1 | |
exec Xephyr -once -dumb -fakexa -fullscreen -resizeable -query 127.0.0.1 :10010 | |
fi | |
if [ "$PROMPT1" == "Other" ]; then | |
while true; do | |
ADDRESS=$(zenity --entry --text="Address to query:" --title="Query Adress") | |
case ${ADDRESS} in | |
*\ * ) true ;; | |
* ) false ;; | |
esac | |
export NX_SESSION=0 | |
unset PULSE_SERVER | |
export PULSE_SERVER=127.0.0.1 | |
killall onboard | |
sleep 1 | |
exec Xephyr -once -dumb -fullscreen -resizeable -query ${ADDRESS} :10010 | |
done | |
fi | |
if [ "$PROMPT1" == "MATE (NX audio)" ]; then | |
export NX_SESSION=1 | |
killall onboard | |
killall metacity | |
exec mate-session | |
fi | |
if [ "$PROMPT1" == "MATE (ext pulseaudio)" ]; then | |
NX_PULSE_SERVER=$(echo $PULSE_SERVER) | |
PULSE_SERVER=$(zenity --entry --text="Address to server:" --title="Pulse Server") | |
if [[ -z $PULSE_SERVER ]]; then | |
export PULSE_SERVER=$NX_PULSE_SERVER | |
fi | |
export NX_SESSION=1 | |
export PULSE_SERVER=$PULSE_SERVER | |
killall onboard | |
killall metacity | |
exec mate-session | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment