Permalink
Browse files

Simplify the theme mechanism, just specify an absolute path to a

dialogrc file as $dialogrc, and let dialog(1) worry about the validity
of $dialogrc.

Rename variables:
    $theme -> $dialogrc: make the low level things more transparent.
    $cosolekittime -> $cktimeout: indicate "timeout" here.
  • Loading branch information...
1 parent 64b5c81 commit a7de917b7061f70662747a001aa74570c10fed6b @CasperVector committed Apr 7, 2012
Showing with 14 additions and 28 deletions.
  1. +12 −26 src/cdm
  2. +2 −2 src/cdmrc
View
@@ -35,6 +35,8 @@ success="\e[1;32m==>\e[1;37m"
reset="\e[0m"
# Ignore SIGINT (^C) and SIGTSTP (^Z)
trap "" 2 20
+
+dialogrc=${dialogrc:-}
userclientrc=$HOME/.xinitrc
sysclientrc=/etc/X11/xinit/xinitrc
# userserverrc=$HOME/.xserverrc
@@ -51,7 +53,7 @@ if [[ -f /etc/X11/cdm/cdmrc ]]; then
let count=count+1
done
countfrom=${countfrom:-0}
- consolekittime=${consolekittime:-30}
+ cktimeout=${cktimeout:-30}
else
echo -e "${error} ERROR: A valid cdm configuration was not found!${reset}"
echo -e "${info} Logging out.${reset}"
@@ -67,23 +69,6 @@ if [[ "${#wmbinlist[@]}" -eq 0 ]]; then
wmdisplist=($(echo ${wmbinlist[@]^}))
fi
-unset DIALOGRC
-# Source theme file
-if [[ ! -z ${theme} ]]; then
- if [[ -f /usr/share/cdm/themes/${theme} ]]; then
- DIALOGRC=/usr/share/cdm/themes/${theme}
- else
- echo -e "${info} Theme file ${theme} is invalid, reverting to default theme.${reset}"
- fi
-fi
-if [[ -z $DIALOGRC ]]; then
- if [[ -f /usr/share/cdm/themes/default ]]; then
- DIALOGRC=/usr/share/cdm/themes/default
- else
- echo -e "${info} A valid theme file was not found, using system defaults.${reset}"
- fi
-fi
-
# Based on FreeBSD's /etc/rc.subr
#
# checkyesno var
@@ -172,14 +157,14 @@ mainmenu() {
let halt=halt+countfrom
menu="${menu} ${halt} Shutdown "
fi
-
+
# Override dialog display if only one option is available
if ! $(checkyesno allowconsole) && ! $(checkyesno allowshutdown) && [[ ${#wmdisplist[@]} == 1 ]]; then
wm=$countfrom
else
# Display selection dialog
wm=$(
- DIALOGRC="$DIALOGRC" dialog --colors \
+ DIALOGRC="$dialogrc" dialog --colors \
--backtitle "${name} v${ver}" --stdout \
--ok-label " Select " --cancel-label " Logout " \
--menu "Select Window Manager" 0 0 0 ${menu}
@@ -219,12 +204,12 @@ shutdownmenu() {
# Display shutdown dialog
haltopt=$(
- DIALOGRC="$DIALOGRC" dialog --colors \
+ DIALOGRC="$dialogrc" dialog --colors \
--backtitle "${name} v${ver}" --stdout \
--ok-label " Select " --cancel-label " Cancel " \
--menu "Shutdown" 0 0 0 ${haltmenu}
)
-
+
if [[ $? == 0 ]]; then
clear
if [[ ${haltopt} -eq $countfrom ]]; then
@@ -256,13 +241,13 @@ xstart() {
serverargs=":${display} ${serverargs} vt$((xtty+display))"
if $(checkyesno consolekit); then #do first to avoid race conditions
- echo -ne "${info} Waiting for ConsoleKit to register X session (timeout ${consolekittime}s)..."
+ echo -ne "${info} Waiting for ConsoleKit to register X session (timeout ${cktimeout}s)..."
- sleep $consolekittime &
+ sleep $cktimeout &
clockpid=$!
-
+
trap "echo -e \"Registered! ${reset}\"" USR1
-
+
#have to store pid of dbus-monitor this way since dbus-monitor will run until killed.
fifo=$(mktemp --dry-run)
mkfifo --mode=700 $fifo
@@ -300,3 +285,4 @@ xstart() {
exit 0
}
mainmenu
+
View
@@ -3,7 +3,7 @@
############################
# Set CDM theme and dialog options
-theme=cdm
+dialogrc=/usr/share/cdm/themes/cdm
countfrom=1
# List all WM binary names
@@ -89,7 +89,7 @@ loginshell=no
consolekit=yes
# Timeout for waiting for X session to register with consoleKit
-consolekittime=30
+cktimeout=30
# Additional arguments to pass to X server
# When usexinit=yes, we use ~/.xinitrc when it exists or /etc/X11/xinit/xinitrc

0 comments on commit a7de917

Please sign in to comment.