Comment 232 for bug 44082

Revision history for this message
bojo42 (bojo42) wrote :

As the upload tool of launchpad doesn't work right now, here is my lazy lock down script:

#!/bin/sh

### Config
NOTIFY=on #(on/off)
LOCK_TITLE="Panel Lock Down"
LOCK_MSG="Locking the GNOME panel"
UNLOCK_TITLE="Panel Lock Down"
UNLOCK_MSG="Unlocking the GNOME panel"
LOCK_ICON="/usr/share/icons/hicolor/48x48/apps/gdu-encrypted-lock.png"
UNLOCK_ICON="/usr/share/icons/hicolor/48x48/apps/gdu-encrypted-unlock.png"

### Dependency checking
if [ -z "$(which gconftool-2)" ]; then
 if [ -n "$(which gconftool-2)" ]; then
  zenity --warning --text "Error. No binary found for gconftool-2!" --title "Panel Lock Down"
 else
  echo "Panel Lock Down: Error. No binary found for gconftool-2!"
 fi
 exit 1
fi
if [ "$NOTIFY" = "on" ] && [ -z "$(which notify-send)" ]; then
 SCRIPT_LOCATION="$(pwd)/$(basename $0)"
 if [ -n "$(which zenity)" ]; then
  zenity --warning --text "Notifcations failed! Please install the libnotify-bin package or disable notifications in $SCRIPT_LOCATION" --title "Panel Lock Down"
 else
  echo "Panel Lock Down: Notifcations failed! Please install the libnotify-bin package or disable notifications in $SCRIPT_LOCATION"
 fi
 NOTIFY="off"
fi

### Main
if [ "$(gconftool-2 -g /apps/panel/global/locked_down)" = "true" ]; then
 [ "$NOTIFY" = "on" ] && notify-send -i $UNLOCK_ICON "$UNLOCK_TITLE" "$UNLOCK_MSG"
 gconftool-2 -s /apps/panel/global/locked_down --type=bool false
elif [ "$(gconftool-2 -g /apps/panel/global/locked_down)" = "false" ]; then
 [ "$NOTIFY" = "on" ] && notify-send -i $LOCK_ICON "$LOCK_TITLE" "$LOCK_MSG"
 gconftool-2 -s /apps/panel/global/locked_down --type=bool true
else
 if [ -n "$(which zenity)" ]; then
  zenity --warning --text "Error. Undefined state of global panel lock down!" --title "Panel Lock Down"
 else
  echo 'Panel Lock Down: Error. Undefined state of global panel lock down!'
 fi
 exit 1
fi