#!/bin/sh # # script to logout from a running fluxbox with yesno-dialog at the end. # # Copyright (c) 2004 Mathias Gumz # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. check_in_path() { if which "$1" &> /dev/null; then echo "${0##*/}error, [$1] not in PATH, exit." >&2; exit 1;fi } display_help() { cat << EOF ABOUT fblogout - logout dialog for fluxbox USAGE fblogout [-h] [xmessage|gdialog|zenity|kdialog] -h --help displays this help xmessage is the default method to confirm the logout prozess. EXAMPLE ~/.fluxbox/keys: Control Mod1 Mod4 :ExecCommand fblogout ~/.fluxbox/menu: [submenu] (fluxbox) {system...} [restart] (fluxbox) [exec] (logout) {fblogout} [end] AUTHOR mathias gumz < gumz at cs.uni-magdeburg.de > EOF exit 0 } pid=`xprop -root _BLACKBOX_PID | cut -d '=' -f 2` mode="xmessage" question="really logout from fluxbox?" [ -n "$1" ] && mode="$1" case "$mode" in --help | -h ) display_help exit 0 ;; gdialog ) check_in_path gdialog && gdialog --yesno "$question" ;; zenity ) check_in_path zenity && zenity --question --text="$question" ;; xmessage | gxmessage ) check_in_path $mode && $mode -nearmouse -buttons no:1,yes:0 "$question" ;; kdialog ) check_in_path kdialog && kdialog --yesno "$question" ;; * ) echo "error, not a supported *dialog, exit." exit 1 ;; esac if [ $? = 0 ] then #echo "now i would send a SIGTERM to $pid" kill -s KILL $pid exit 0 fi