[openbox] Openbox + Bbdock

Jeff Pohlmeyer yetanothergeek at gmail.com
Sun Nov 11 13:11:30 EST 2007


On Nov 11, 2007 11:38 AM, Jacques Bon <jbon at cafcom.net> wrote:

> Would you see a way to exit openbox with a bbdock icon, killing just
> the child's session ?


I'm not sure if I understand your problem, but
here is a script that searches up through its
parent processes for the one that matches
/path/to/openbox, and kills it...

#!/bin/bash

OPENBOX=$(which openbox)
CHILD=$$

while [ 1 ]
do
  if [ "$CHILD" ]
  then
    if  [ -d "/proc/$CHILD" ]
    then
    PARENT=$(awk '/^PPid:/ {print $2}'  /proc/$CHILD/status)
    if [ "$PARENT" ]
    then
      EXE=$(readlink /proc/$PARENT/exe | \
        awk '{gsub(/ +\(deleted\)$/,""); print}' )
      if [ "$EXE" == "$OPENBOX" ]
      then
        kill $PARENT
        exit 0
      fi
      CHILD=$PARENT
    else
      echo "No parent!"
      exit 3
    fi
    else
      echo "No proc/$CHILD"
      exit 2
    fi
  else
   echo "No child!"
   exit 1
  fi
done

( Of course, "child" here refers to "child process" not "student" :-)

 - Jeff



More information about the openbox mailing list