Permalink
Browse files

Code messing with X should only be run if an X program is to be run.

  • Loading branch information...
1 parent a5df0f9 commit a80d9cb9c1b7814df6ae71b56cc9335fc28ff422 @CasperVector committed Apr 7, 2012
Showing with 28 additions and 28 deletions.
  1. +28 −28 src/cdm
View
56 src/cdm
@@ -57,34 +57,6 @@ if [[ "${#wmbinlist[@]}" -eq 0 ]]; then
wmdisplist=($(echo ${wmbinlist[@]^}))
fi
-# If X is already running and locktty=yes, activate it,
-# otherwise, increment.
-if $(yesno locktty); then
- # Verify display exists
- if [[ -n "${display//[0-9]/}" ]]; then
- display=0
- fi
- # Activate existing X session
- if xdpyinfo -display :${display}.0 &> /dev/null; then
- let tty=display+xtty
- chvt ${tty}
- exit 0
- fi
-else
- # Get the first empty display
- display=0
- while [[ ${display} -lt 7 ]]; do
- if dpyinfo=$(xdpyinfo -display :${display}.0 2>&1 1>/dev/null); then
- let display=display+1
- elif [[ $dpyinfo = No\ protocol\ specified* ]]; then
- # Display is in use by another user
- let display=display+1
- else
- break
- fi
- done
-fi
-
mainmenu() {
# Generate main menu
count=0
@@ -184,6 +156,34 @@ shutdownmenu() {
}
xstart() {
+ # If X is already running and locktty=yes, activate it,
+ # otherwise, increment.
+ if $(yesno locktty); then
+ # Verify display exists
+ if [[ -n "${display//[0-9]/}" ]]; then
+ display=0
+ fi
+ # Activate existing X session
+ if xdpyinfo -display :${display}.0 &> /dev/null; then
+ let tty=display+xtty
+ chvt ${tty}
+ exit 0
+ fi
+ else
+ # Get the first empty display
+ display=0
+ while [[ ${display} -lt 7 ]]; do
+ if dpyinfo=$(xdpyinfo -display :${display}.0 2>&1 1>/dev/null); then
+ let display=display+1
+ elif [[ $dpyinfo = No\ protocol\ specified* ]]; then
+ # Display is in use by another user
+ let display=display+1
+ else
+ break
+ fi
+ done
+ fi
+
# Start X
if $(yesno usexinit); then
if [[ -f $userclientrc ]]; then

0 comments on commit a80d9cb

Please sign in to comment.