[wmii] mktemp for $WMII_ADDRESS

From: Kris Maglione <bsdaemon_AT_comcast.net>
Date: Thu, 25 May 2006 21:47:06 -0400

I understand the need for mktemp in creating the filelist, but I don't
understand it for the socket. The previous method for addressing the socket
was based on the conventions of plan9port and was predictable for a reason.
The sockets for acme, plumber, etc. are predictable in the same way and have
been for years. There are only two possible scenarios I can think of that are
prevented by the mktemp solution. 1. wmiiwm fails to make the socket and
wmiirc spins forever, or until another instance can. 2. another process has
created the socket with the same name, which the new wmiiwm now inherits.

I can present two solutions to this problem which do not break the plan9port
namespace conventions. The first one, which I favor, is to add a -r flag to
wmiiwm which takes the name of an rc to run just before it goes into its main
loop. My copy of wmiiwm runs this way. In this case, if wmiiwm fails to open
the socket and dies before wmiirc is open, thus preventing both problems. That
also allows wmii to exec wmiiwm instead of waiting on it.

The second solution is the `wmii` below or some analog:

---------------------
#!/bin/sh
# start wmiiwm and wait for its termination

wmiiwm -c || exit 1

SOCKDIR="/tmp/ns.$USER.$DISPLAY"
SOCKFILE="$SOCKDIR/wmii"

mkdir -p 700 $SOCKDIR 2>/dev/null

if ! ls -ld $SOCKDIR |
     awk -v "user=`whoami`" \
        '{ if ($3 != user || !match($1,"^drwx.-..-"))
              exit 1;
            exit }
         END { exit 1 }' # In case of no dir
then
  echo "The socket directory \"$SOCKDIR\" " \
       "is group or world writable " \
       "or is not owned by you" 1>&2
  exit 1
fi

if [ -S "$SOCKFILE" ]; then
  echo "The socket \"$SOCKFILE\" which is " \
       "needed by wmii already exists" 1>&2
  exit 1
fi

PATH=$PATH:$HOME/.wmii-4:CONFPREFIX/wmii-4 export PATH
WMII_ADDRESS=unix!$SOCKFILE export WMII_ADDRESS

wmiiwm -a $WMII_ADDRESS &
wmiiwmpid=$!
mkdir $HOME/.wmii-4 2>/dev/null && welcome &
wmiirc &
wait $wmiiwmpid
---------------------

And while I'm posting, I propose the following patch (ed) to wmiirc to
alleviate status bar clicks creating empty views:
116i
                wmiir ls /bar/$1 >/dev/null 2>&1 &&
.
wq

Still, I'd prefer seperate events (and namespaces) for status bar clicks and
tab bar clicks.

-- 
Kris Maglione
Received on Fri May 26 2006 - 03:47:41 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:06:54 UTC