Clint Adams <[EMAIL PROTECTED]> writes:
>> I use job control in my .xsession, but after the latest update it stopped 
>> working.
>> 
>> I have 'setopt monitor' near the top of my .xsession.  I run various jobs in 
>> the background,
>> including my wm which I later foreground.
>
> What do you mean by "stopped working"?

I'd get a:

/home/nowan/.xsession:fg:164: no job control in this shell.

in my .xsession-errors, which would then continue on as if the wm had
exited, logging me out.  I've reverted back to zsh-beta
4.3.2-dev-1+20060815-1 and the problem's disappeared.  Ordinarily I call
it as '#!/bin/zsh', but when the problem showed up I did try it as
'#!/bin/zsh-beta' on the off chance it was confused and going into some
emulation mode.  I've included a copy of my .xsession below, if that's
useful.

I'd be happy to upgrade back to the current zsh-beta and run some tests,
if you'd like.  I admit that when this showed up it was first thing in
the morning, I hadn't had any coffee, and I had to get my daughter to
her first day of first grade, so I probably wasn't terribly thorough
trying to track down the problem.  Sorry about the terseness of my bug
report.

#!/bin/zsh
########################################################################
#
# Personal X startup file.
#
# Time-stamp: <2006-08-19 23:32:45 Jeremy Hankins>
#
########################################################################

# I use job control in here.
setopt monitor

# {{{ Settings

# Window manager
wm="ion3"
#wm="wmii"

# List of applets to start after launching the wm.  Don't run them if
# I'm using wmii, as it doesn't do applets.
if [[ "$wm" != "wmii" ]]; then

    # Seconds to sleep before starting each applet:
    sleep=5

    # Common applets to start:
    applets=(
        "wmcalclock"
        "wmmon -l"
        "wmmon -l -s"
        "wmtop -x ^wm" )

    # Now a few host-specific applets:
    if [[ "$HOST" == "ant.nowan.org" ]]; then
        applets+=(
            "wmnd -w wmwave -s 10 -i wlan0"
            "wmwave"
            "wmacpi" )
    elif [[ "$HOST" == "wasp.nowan.org" ]]; then
        applets+=(
            "wmbiff"
            "wmnd -w wmwave -s 10 -i eth1"
            "wmwave" )
    fi
fi


# }}}
# {{{ Utility functions

# {{{ warn

# This is used to nicely log messages to stdout (.xsession-errors) with
# the time and date.

warn () {
    echo `date +%T:` $*
}

# }}}
# {{{ canrun

# A way to decide whether or not something is runable.

function canrun () {
    [[ -x `builtin whence $1` ]]
}

# }}}
# {{{ start

# This starts an app verbosely (i.e., with logging), if it's available.

function start () {
    if canrun $1; then
        warn "Running: $*"
        $* &
    else
        warn "Couldn't find $1"
    fi
}

# }}}

# }}}
# {{{ Xresources

# Load my .Xresources file.  Is this done by the login manager now?
# Anyway, a bit of redundancy doesn't hurt.

if [[ -r ~/.Xresources ]]; then
    warn "Loading X resources"
    xrdb -override ~/.Xresources
fi

# }}}
# {{{ Keyboard layout

warn "Setting to dvorak layout"

$HOME/zfunc/asdf

# }}}
# {{{ Run ssh-add

# Do this in the foreground to ensure that nothing steals focus:
ssh-add

# }}}
# {{{ Window manager

# Run the window manager, falling back to alternates if necessary.
if canrun $wm; then
    $wm &
    warn "Running $wm"
elif canrun x-window-manager; then
    wm="x-window-manager"
    $wm &
    warn "Running x-window-manager"
else
    error="Couldn't find a window manager; aborting and execing xterm instead."
    warn $error
    xmessage $error
    exec xterm 
fi

# }}}
# {{{ Applications

# Annoyingly, osdsh automatically backgrounds itself, and it's important
# to wait until it's functional to use osdctl.  So here I start a
# background thread to wait 10 seconds and run osdctl.

( start osdsh -p 0 && sleep 10 && start osdctl -S ~/.osdctl ) &

#start emacs
#start myterm -title shell
start xscreensaver
#start unclutter
#start gaim

# }}}
# {{{ Run the applets

# If the applets var isn't set (e.g., it's commented out above), skip
# this part.  Since order matters this will sleep a while to make sure
# the wm is up, then start the applets in turn, waiting a second between
# each one.

if [[ -n "$applets" ]]; then
    sleep $sleep
    warn "Starting applets..."
    for p in $applets; do
        start ${=p}
        sleep 1
    done
fi

# }}}
# {{{ Wait for the wm to exit

# Foreground the wm for the durration of the session.
warn "Foregrounding $wm"
fg %'$wm'

# }}}
# {{{ Logout cleanly

warn "$wm exited; logging out"

# Tell osdsh to exit cleanly
osdctl -x

# And when the wm exits, kill everything.  Theoretically this isn't
# necessary, but this will make sure.

for j in `jobs -p`; do
    kill $j
done

# }}}

# Local Variables:
# folded-file:t
# End:
-- 
Jeremy Hankins <[EMAIL PROTECTED]>
PGP fingerprint: 748F 4D16 538E 75D6 8333  9E10 D212 B5ED 37D0 0A03

Reply via email to