This guide will help you create an extension with a wbar icon and/or menu entry for a command. As an example, I will use an extension I created for an icon and menu entry to mount my networked mp3 directory. The extension is named zzzmymount.tcz

Create a temporary dir to work from

tc@box:~$ mkdir /tmp/extension && cd /tmp/extension

Write the script

Use your favorite editor (for me its nano)

tc@box:/tmp/extension$ mkdir -p usr/local/bin
tc@box:/tmp/extension$ nano usr/local/bin/mountmp3s
#!/bin/sh
[ -d /home/tc/mnt/mp3s ] || mkdir /home/tc/mnt/mp3s
sudo mount -t cifs //192.168.1.100/mp3s /home/tc/mnt/mp3s -o uid=1001,gid=50,username=tc,password=xxxx

Dont forget to make it executable

tc@box:~$ chmod +x usr/local/bin/mountmp3s

Create the menu entry

(note: even if you do not wish to have a menu entry, you must have a menu file to trigger the setup)

tc@box:/tmp/extension$ mkdir usr/local/tce.menu

If you do not want a menu entry:

tc@box:/tmp/extension$ touch usr/local/tce.menu/zzzmymount

If you do:

tc@box:/tmp/extension$ nano usr/local/tce.menu/zzzmymount
<JWM>
<Program label="Mount MP3s">/usr/local/bin/mountmp3s</Program>
</JWM>

(note: capitalization is important in the tags)

Create icon entry

tc@box:/tmp/extension$ mkdir usr/local/tce.icons
tc@box:/tmp/extension$ nano usr/local/tce.icons/zzzmymount
i: /usr/local/tce.icons/mountmp3s.png
t: Mount MP3s
c: /usr/local/bin/mountmp3s

(note: make sure this file end in a newline. most editors do this automatically)

Add the icon

Search around the web for an icon you like. A good place to look is: www.iconspedia.com Remember to use the name you specified in the icon file above.

tc@box:/tmp/extension$ wget -O usr/local/tce.icons/mountmp3s.png http://www.iconspedia.com/dload.php?up_id=16386

==== Check permissions and ownership ====<

tc@box:/tmp/extension$ cd usr/local
tc@box:/tmp/extension/usr/local$ sudo chown -R root.staff tce*
tc@box:/tmp/extension/usr/local$ sudo chmod 775 tce*

Create the exension

(note: this requires squashfs-tools-4.x.tcz)

tc@box:/tmp/extension$ mksquashfs . ../zzzmymount.tcz

The extension will be in /tmp. You can now load it to test it out:

tc@box:/tmp/extension$ tce-load -i /tmp/zzzmymount.tcz

The icon and menu should now be visible and usable. Finally move the new extension into your personal repo:

tc@box:/tmp/extension$ cp ../zzzmymount.tcz $(cat /opt/.tce_dir)

Troubleshooting

If you are creating icons for a package, pre-existing freedesktop configuration files may conflict with custom wbar icon files and settings. Check for a pre-existing freedesktop configuration at: /usr/local/share/applications/PACKAGENAME.desktop For details on how to configure that file for Tiny Core, read iconmenuinfo.

Print/export
QR Code
QR Code wiki:creating_personal_icons (generated for current page)