Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: althalus on December 29, 2009, 03:00:18 AM
-
I loved the idea of the OnDemand script, however the current version in TC works only for FLWM, which isn't much good for anyone using anything else..
This is a version I hacked together for those of us making use of the LXDE desktop environment.
#!/bin/sh
# (c) Robert Shingledecker 2009
# Edited by Justin Steward (Althalus) for compatibility with LXDE.
[ "$DESKTOP" == "lxde" ] || exit 1
[ -s /opt/.tce_dir ] || exit 1
TCEDIR="$(cat /opt/.tce_dir)"
TMP=/tmp/ondemand.$$.tmp
ls "$TCEDIR"/optional | grep -E .tcz[ml]*$ > "$TMP"
select "OnDemand Tool for LXDE" "$TMP"
EXTN="$(cat /tmp/select.ans)"
rm "$TMP"
[ "$EXTN" == "" ] && exit
APPNAME="${EXTN%%.*}"
TITLE="$APPNAME"
echo
echo -n "Title: $TITLE (to change enter): "; read ANS
if [ "$ANS" != "" ]; then
TITLE="$ANS"
echo "Title changed to: $TITLE"
fi
BINARY="$APPNAME"
echo
echo -n "Binary: $BINARY (to change enter or 'none'): "; read ANS
if [ "$ANS" != "" ]; then
BINARY="$ANS"
echo "Binary changed to: $BINARY"
fi
[ -d /home/"$USER"/.ondemand ] || mkdir -p /home/"$USER"/.ondemand
FILE=/home/"$USER"/.ondemand/"$TITLE"
echo '#!/bin/sh' > "$FILE"
echo '[ -e /opt/.tce_dir ] || exit 1' >> "$FILE"
echo 'read TCEDIR < /opt/.tce_dir' >> "$FILE"
echo '[ -e /usr/local/tce.installed/'"$APPNAME"' ] && exit 0' >> "$FILE"
echo 'tce-load -i "$TCEDIR"/optional/'"$EXTN" >> "$FILE"
if [ "$BINARY" != "none" ]; then
echo '[ $(which '"$BINARY"') ] && '"$BINARY" >> "$FILE"
fi
chmod +x "$FILE"
[ -d /home/${USER}/.local/share/applications ] || mkdir -p /home/${USER}/.local/share/applications
MENUENTRY="/home/${USER}/.local/share/applications/${BINARY}.desktop"
echo "[Desktop Entry]" > ${MENUENTRY}
echo "Name=${TITLE} OnDemand" >> ${MENUENTRY}
echo "Comment=${TITLE} OnDemand" >> ${MENUENTRY}
echo "Exec=${FILE}" >> ${MENUENTRY}
echo "Terminal=False" >> ${MENUENTRY}
echo "Type=Application" >> ${MENUENTRY}
echo "Categories=OnDemand;" >> ${MENUENTRY}
Currently, entries show up in "Other" - Creating a new directory doesn't seem as easy as creating an application entry in the menu - Maybe this could be included as part of the lxpanel extension?
-
Did you try it ?
http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/tcz/tc2freedesktop.tcz.info
-
I'm not sure how that relates to the OnDemand feature? TC2freedesktop works with wbar icons, neither the flwm version of ondemand nor mine create wbar icons.
-
I'm not sure how that relates to the OnDemand feature? TC2freedesktop works with wbar icons, neither the flwm version of ondemand nor mine create wbar icons.
Common is that both are creating standard menu entries for LXDE. Of course they are different.
-
#!/bin/sh
# (c) Robert Shingledecker 2009
# Edited by Justin Steward (Althalus) for compatibility with LXDE.
[ "$DESKTOP" == "lxde" ] || exit 1
[ -s /opt/.tce_dir ] || exit 1
TCEDIR="$(cat /opt/.tce_dir)"
TMP=/tmp/ondemand.$$.tmp
ls "$TCEDIR"/optional | grep -E .tcz[ml]*$ > "$TMP"
select "OnDemand Tool for LXDE" "$TMP"
EXTN="$(cat /tmp/select.ans)"
rm "$TMP"
[ "$EXTN" == "" ] && exit
APPNAME="${EXTN%%.*}"
TITLE="$APPNAME"
echo
echo -n "Title: $TITLE (to change enter): "; read ANS
if [ "$ANS" != "" ]; then
TITLE="$ANS"
echo "Title changed to: $TITLE"
fi
BINARY="$APPNAME"
echo
echo -n "Binary: $BINARY (to change enter or 'none'): "; read ANS
if [ "$ANS" != "" ]; then
BINARY="$ANS"
echo "Binary changed to: $BINARY"
fi
[ -d /home/"$USER"/.ondemand ] || mkdir -p /home/"$USER"/.ondemand
FILE=/home/"$USER"/.ondemand/"$TITLE"
echo '#!/bin/sh' > "$FILE"
echo '[ -e /opt/.tce_dir ] || exit 1' >> "$FILE"
echo 'read TCEDIR < /opt/.tce_dir' >> "$FILE"
echo '[ -e /usr/local/tce.installed/'"$APPNAME"' ] && exit 0' >> "$FILE"
echo 'tce-load -i "$TCEDIR"/optional/'"$EXTN" >> "$FILE"
if [ "$BINARY" != "none" ]; then
echo '[ $(which '"$BINARY"') ] && '"$BINARY" >> "$FILE"
fi
chmod +x "$FILE"
[ -d /home/${USER}/.local/share/applications ] || mkdir -p /home/${USER}/.local/share/applications
MENUENTRY="/home/${USER}/.local/share/applications/${FILE}.desktop"
echo "[Desktop Entry]" > ${MENUENTRY}
echo "Name=${TITLE} OnDemand" >> ${MENUENTRY}
echo "Comment=${TITLE} OnDemand" >> ${MENUENTRY}
echo "Exec=${BINARY}" >> ${MENUENTRY}
echo "Terminal=False" >> ${MENUENTRY}
echo "Type=Application" >> ${MENUENTRY}
echo "Categories=OnDemand;" >> ${MENUENTRY}
Slightly corrected version.
-
bmarkus, I installed tc2freedesktop.tcz, then I installed other applications like vlc and opera however I didn't see them pop-up in the LXDE menu. Is there something else I need to do?
-
bmarkus, I installed tc2freedesktop.tcz, then I installed other applications like vlc and opera however I didn't see them pop-up in the LXDE menu. Is there something else I need to do?
VLC installs its menu for LXDE/Xfce4 itself, no need for any extra step. See LXDE Sound & Video menu.
You must run tc2freedesktop in a console or add to LXDE startup. Opera will be added to 'System Tools' menu.