desktop-base-kde/bin/kickoffcfg
2011-06-02 15:59:13 +02:00

35 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
[ "$1" -a "$2" ] || {
echo "KDE4 kickoff configuration tool"
echo
echo "Usage: kickoffcfg {--add-favorite|--del-favorite} /path/to/desktopfile.desktop"
echo
exit 1
}
FAVORITES=`kreadconfig --file /opt/kde/share/config/kickoffrc --group Favorites --key FavoriteURLs 2>/dev/null`
if [ "$1" = "--add-favorite" ]; then
# ADD
echo "$FAVORITES" | grep $2 >/dev/null || {
if [ "$FAVORITES" ]; then
FAVORITES="$FAVORITES,$2"
else
FAVORITES="$2"
fi
kwriteconfig --file /opt/kde/share/config/kickoffrc --group Favorites --key FavoriteURLs $FAVORITES
}
elif [ "$1" = "--del-favorite" ]; then
# DELETE
MODFAVORITES=`echo "$FAVORITES" | sed "s|$2||" | sed "s| ,||" | sed "s|,,|,|"`
if [ ! "$MODFAVORITES" ]; then
kwriteconfig --file /opt/kde/share/config/kickoffrc --group Favorites --key FavoriteURLs ''
elif [ "$FAVORITES" != "$MODFAVORITES" ]; then
kwriteconfig --file /opt/kde/share/config/kickoffrc --group Favorites --key FavoriteURLs $MODFAVORITES
fi
else
echo "Invalid option $1; aborting."
exit 1
fi
exit 0