#!/bin/sh
# (C) Copyright Collin Doering @!@YEAR@!@
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
# File: .vnc/xstartup
# Author: Collin J. Doering
# Date: Jul 12, 2012
# Description: Acts as a window-manager selector for vnc/freenx sessions
# TODO: - use retval in the case that Xdialog fails to display some message/log
# - remove use of retval for window close and cancel button as they're disabled
# - support a nicer way to add wm's to the radiolist
# - a custom pekwm config so that there are no clicky menus and such
# Set desktop default size
xrandr --output default --mode 640x480
# Start pekwm and keep its pid
pekwm &
PEKWM_PID=$!
# Offer a Xdialog session selector
Xdialog --title "Session Selection" \
--no-cancel \
--no-close \
--radiolist "Choose a session to run:" 25 112 5 \
"XMonad" "a dynamically tiling X11 window manager" off \
"OpenBox" "a highly configurable, next generation WM with extensive standards support" off \
"PekWM" "a window manager that once up on a time was based on the aewm++ window manager" off \
"Awesome" "a highly configurable, next generation framework window manager for X" off \
"StumpWM" "a tiling, keyboard driven X11 Window Manager written entirely in Common Lisp" ON 2>/tmp/wmlist.tmp.$$
# Retain the return value of Xdialog and its choices saved in /tmp/wmlist.tmp.pid where pid is the pid of this shell
retval=$?
choice=`cat /tmp/wmlist.tmp.$$ | tr '[A-Z]' '[a-z]'`
# Remove the temporary file containing Xdialogs choices
rm -f /tmp/wmlist.tmp.$$
# Stop pekwm
kill $PEKWM_PID
# Run a session depending on the return value and choice from Xdialog
case $retval in
0)
exec $HOME/.xinitrc $choice remote
;;
# 1)
# echo "Cancel pressed."
# ;;
# 255)
# echo "Box closed."
# ;;
esac