slitaz-tools rev 294
desktopbox: add notification support
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri Feb 20 00:05:58 2009 +0100 (2009-02-20) |
parents | 0ff827264caa |
children | c90e38d22ae6 |
files | tinyutils/desktopbox |
line diff
1.1 --- a/tinyutils/desktopbox Wed Feb 18 16:42:49 2009 +0100 1.2 +++ b/tinyutils/desktopbox Fri Feb 20 00:05:58 2009 +0100 1.3 @@ -66,6 +66,8 @@ 1.4 new-file Create a new empty file or SHell script on the desktop. 1.5 add-icons Add a system icon on the desktop. 1.6 calendar Display a calendar under mouse pointer. 1.7 + notify Display a notification message (center/no decoration). 1.8 + Ex: `basename $0` notify \"Message to display\" 4 1.9 logout Prompt for X session exit or system halt/reboot.\n" 1.10 } 1.11 1.12 @@ -203,7 +205,7 @@ 1.13 # X session/system logout. 1.14 # 1.15 DESKTOP_DIALOG=" 1.16 -<window title=\"SliTaz Desktop logout\" icon-name=\"user-desktop\"> 1.17 +<window title=\"SliTaz Desktop logout\" icon-name=\"user-desktop\" skip_taskbar_hint=\"true\"> 1.18 <vbox> 1.19 <pixmap> 1.20 <input file>/usr/share/icons/Tango/32x32/places/user-desktop.png</input> 1.21 @@ -266,6 +268,26 @@ 1.22 </vbox> 1.23 </window>" 1.24 export DESKTOP_DIALOG=${DESKTOP_DIALOG}${TAZUSB_DIALOG}${ACTIONS} ;; 1.25 + notify) 1.26 + # Nofification message without window decoration. 1.27 + MSG="$2" 1.28 + SEC=$3 1.29 + [ -z $SEC ] && SEC=2 1.30 + export NOTIFY_BOX=" 1.31 +<window decorated=\"false\" skip_taskbar_hint=\"true\"> 1.32 +<vbox> 1.33 + <text width-chars=\"64\" use-markup=\"true\"> 1.34 + <label>\" 1.35 +$MSG 1.36 + \"</label> 1.37 + </text> 1.38 +</vbox> 1.39 +</window>" 1.40 + gtkdialog --center --program=NOTIFY_BOX >/dev/null & 1.41 + sleep $SEC 1.42 + pid=`ps | grep NOTIFY_BOX | awk '{ print $1 }'` 1.43 + kill $pid 2>/dev/null 1.44 + exit 0 ;; 1.45 *) 1.46 # Usage if executed from cmdline. 1.47 #