Today I stumbled over the fact that '/usr/share/applications' contains .desktop files that have invalid entries for 'X-FullPathIcon':tc@box:/usr/share/applications$ grep 'X-FullPathIcon=' *.desktop | sed 's#:.*=# #' | while read FILE ICON ; do [ -f $ICON ] || printf "no %-37s for %s\n" $ICON $FILE ; done
no /usr/share/pixmaps/tc/appbrowser.png for tinycore-appbrowser.desktop
no /usr/share/pixmaps/tc/logo.png for tinycore-appsaudit.desktop
no /usr/share/pixmaps/tc/aterm.png for tinycore-aterm.desktop
no /usr/share/pixmaps/tc/cpanel.png for tinycore-cpanel.desktop
no /usr/share/pixmaps/tc/power.png for tinycore-exit.desktop
no /usr/share/pixmaps/tc/logo.png for tinycore-wbar_exclude.desktop
We might not have seen this causing problems as the 'SystemTools' menu does not use icons, and for "wbar" the icon entries in '/usr/share/wbar/dot.wbar' are correct.
Now, this made me wonder if having those hard-coded entries in '/usr/share/wbar/dot.wbar' is still appropriate in light of the tendency to make use of .desktop files: I thought that trimming back '/usr/share/wbar/dot.wbar' to just the first 4 lines and injecting some appropriate 'wbar_update.sh' commands in '/usr/bin/wbar_setup.sh' might be more consistent.
For a rather "ad hoc" test I used:--- wbar_setup.sh-orig
+++ wbar_setup.sh
@@ -2,9 +2,18 @@
2>/dev/null read TCEDIR < /opt/.tce_dir || exit 1
TCEWBAR="/usr/local/tce.icons"
[ -e "$TCEWBAR" ] && sudo rm -rf "$TCEWBAR"
-sudo cp /usr/share/wbar/dot.wbar "$TCEWBAR"
+head -4 /usr/share/wbar/dot.wbar | sudo tee "$TCEWBAR" > /dev/null
sudo chown root.staff "$TCEWBAR"
sudo chmod g+w "$TCEWBAR"
+SYSAPPS=/usr/share/applications
+FREEDESK=/usr/local/share/applications
+[ -d "$FREEDESK" ] || sudo mkdir -p "$FREEDESK"
+for ENTRY in exit aterm cpanel appbrowser ; do
+ [ -f "${FREEDESK}/tinycore-${ENTRY}.desktop" ] \
+ || sudo ln -s "${SYSAPPS}/tinycore-${ENTRY}.desktop" \
+ "${FREEDESK}/tinycore-${ENTRY}.desktop"
+ wbar_update.sh "tinycore-${ENTRY}"
+done
INSTALLED=/usr/local/tce.installed
ONDEMAND="$TCEDIR"/ondemand
As this change would cost a few CPU cycles I wanted to find out how badly it would do. I ran each version via a loop 100 times and divided the (hand-stopped) result by 100: the original took ca. 0.1 sec and the changed version 0.5 sec (using QEMU 0.11.1 on a not particular speedy WinXP host). So that might be notiecable as the "$ICONS"_setup.sh call is in 'startx' and would therefore delay the start of the X server by a fraction of a second. I guess this could be partly mitigated by moving the execution of the script into '~/.xsession' instead.
Well, all up this is maybe a matter of taste and depends on how much weight one puts on consistency. I for one would possibly put the names of the four .desktop files in a text files, from which they would be read during the 'wbar_setup.sh' execution (instead of hardcoding them there).
I can imagine some further improvements are possible: As I had to do this work-around for the fact that 'wbar_update.sh' needs for .desktop files to be in '/usr/local/share/applications'. But in the end I only went for the minimal changes shown above.