Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: floppy on January 29, 2011, 03:02:04 PM

Title: Question: how to create a new wbar icon for "Midnight Commander"
Post by: floppy on January 29, 2011, 03:02:04 PM
hello,
I use midnight commander as text editor, ftp..
I have to go into a terminal: "mc -x" or "sudo mc -x" (if I have to edit the "menu.lst". Is there a description here how to create a "MC user" or "MC root" as icon in the wbar?
Thanks.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Lee on January 29, 2011, 09:40:31 PM
Try this.

Edit /usr/local/tce.icons as follows:

Find the trio of lines beginning with  i:   t: and  c: where the t:  and c:  lines refer to aterm and make an additional copy of them (in the same file).

On the new copy of the t: line, change "Aterm" to "MC user".
On the new copy of the c: line, change "exec aterm" to "exec aterm -e mc -x"

Save the file.
Right-click on your wbar to have it re-read the tce.icons file.

You should now see an additional icon that looks just like the Aterm icon but when you mouse-over the new one, the label will be  MC user and it will run  mc -x  when you click it.  You can find or create a more suitable icon and plug its path/filename into the  i:  line if you want.

Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: jls on January 29, 2011, 10:04:54 PM
better for the community to add it in the tcz
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Guy on January 29, 2011, 10:31:11 PM
I have not done this. I also don't use midnight commander.

I suspect Lee's method will not survive across reboots.

You could get a suitable picture file for the icon and put it in /usr/local/share/pixmaps/ in the midnight commander extension.

Do you know how to add files to an extension, and make a new extension with the added files?

Can midnight commander be started from the menu? I don't use it.

If not, you probably also need to add a menu entry for it.

The basic idea is to see how it is done in other extensions, and do it the same way. Do you understand enough to see how it is done in other extensions, and copy the idea?

I have not done it myself. This is just ideas for starting.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Rich on January 29, 2011, 11:54:21 PM
Midnight commander is a pretty fast and light file manager that runs in a terminal.
It has a file viewer, editor, ftp, and a bunch of other stuff built in. It can be configured
as single pane, dual pane with files in each pane, or dual pane with files on one side
and statistics on the other.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Lee on January 30, 2011, 07:20:28 AM
I have to watch myself so I don't get too verbose, as I hate when my listeners fall asleep while I'm going on and on.  :)  I had to consciously suppress the urge to start about persistence and menus.  I didn't have so work too hard to avoid the bit about adding files to the extension - that's just way out of scope (Hmmm... I wish I could effectively use that phrase at work).

Big thanks to floppy for bringing this up and to Rich for describing mc.  I hadn't tried it out before and now I'm wondering why not.  What a useful little tool.  Does anyone remember Michael Mefford's "dirmagic" utility from the MS-DOS days?  If mc is half that good (and I suspect it is twice that good), it will stay in my toolbox!

And yeah, an icon and menu item in the extension would be great, especially now that those who don't want the icon can exclude it at will.  Other extensions could have icons, too (sgmixer...).
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Rich on January 30, 2011, 08:22:12 AM
I don't recall ever using dirmagic. I used to use one called ffm, it was similar to mc. The
only problem was it was not maintained, so when drives finally exceeded 528Mb it
would choke. After that I found a better one called list. It could switch how it displayed
files from 1 through 5 columns wide by hitting one of the number keys. Fewer columns,
more info, and it was fast as hell.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Guy on January 30, 2011, 07:46:05 PM
1. What is the general consensus? Do others think that mc, in the official repository, should have an icon?

If not, it is still possible for some users to add an icon.

2. If anyone can make or find a suitable image for the icon, share it.

3. I can explain how to add an icon to the extension, and make a new extension with the icon. However, there is more to it than that. There are other things needed to make it start from the icon. I don't fully understand. There are others who do.

4. Why do you start it with mc -x and not just mc?

5. Does anyone feel that any other apps, which don't have an icon, should have an icon?

6. If anyone can make or find suitable images for the icons, share them.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Guy on January 30, 2011, 07:54:48 PM
If anyone can explain what other additions or modifications need to be made in the extension, it would be nice if you could explain it.

The command to start mc when not in the terminal is:

exec aterm -e mc -x

or

exec aterm -e mc

I am not thinking just about this situation. There may be others who want to add icons to other apps. This information may be useful them.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: jls on January 30, 2011, 08:23:28 PM
in the extension there should be a .desktop and of course the icon
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Lee on January 30, 2011, 09:16:37 PM
I'm thinking the icon for "mc" would just -have- to infringe the golden arches trademark.  That's just too good to pass up.   ;)
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: bmarkus on January 31, 2011, 01:14:29 AM
You do not have to create an icon for mc, it has already its own. Why dont you visit the upstream vendors WEB site first?

I added icon to the extension, see how it looks like:

(http://tc.hasix.org/scrcap/wbarmc1.jpg)

In general it is not a good idea to add icon for console applications, mc is one of the exceptions.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Guy on January 31, 2011, 01:22:08 AM
bmarkus

Is this available in the repository? Or will it be available in the repository in the future?
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: bmarkus on January 31, 2011, 01:41:58 AM
Is this available in the repository? Or will it be available in the repository in the future?

Repository was updated last time on January 10 due to Ibiblio issues, see

http://forum.tinycorelinux.net/index.php?topic=8497.0

I will submit the updated but don't know when it will appear. As a temporary solution I can email to those who need.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: floppy on February 01, 2011, 05:46:49 AM
You do not have to create an icon for mc, it has already its own. Why dont you visit the upstream vendors WEB site first?

I added icon to the extension, see how it looks like:

(http://tc.hasix.org/scrcap/wbarmc1.jpg)

In general it is not a good idea to add icon for console applications, mc is one of the exceptions.
MC with the blue icon in the WBAR would be great.
And additionally to this, the same Icon design with a red background for a sudo command "exec aterm -e sudo mc -x"?
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: bmarkus on February 01, 2011, 06:13:02 AM
Icon is the official Midnight Commander icon found at www.midnight-commander.com I'm not planning to add a desktop entry for root neither to change colors of the icon, it is in fact not needed. There are several simple ways to start mc as root.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: Guy on February 02, 2011, 03:00:45 PM
While an icon has been added to midnight commander. Here is an explanation of how an icon can be added to an application, in case someone wants to add an icon to another app.

To make a new extension you need the mksquashfs extension installed.

You need a suitable image for the extension. Look upstream, there may be one available. If not, look at the images of the other icons, and make something compatible. You can find these in tmp/tc/loop/(app-name)/usr/local/share/pixmaps/. (Apps need to be mounted to access them. If they are in OnDemand, start them and then close them.)

You need to add or modify the .desktop file. Look at the desktop files of other apps, and make something similar. These can be seen in tmp/tc/loop/(app-name)/usr/local/share/applications/. If your app already has a .desktop file, you may only need to add the line about the icon image.

When you have an suitable image file, and a suitable .desktop file you can make the new extension.

You need to have your app mounted. If it is in OnDemand, start it, then close it.

Using a file manager, create a new directory in /home/tc. Let's call it myext.

Create a new directory in /home/tc/myext. Use the name of the app. Let's call it app-name.

Go to tmp/tcloop/app-name. Copy the contents, normally a directory usr. In some cases there may also be other directories. Paste this to /home/tc/myext/app-name.

Go to /home/tc/myext/app-name/usr/local/share. Create two new directories. One called pixmaps, the other called applications.

Copy and paste the icon image to pixmaps. Copy the app-name.desktop file to applications.

Open the terminal and type:

sudo su
cd /home/tc/myext
mksquashfs app-name/ app-name.tcz

Using a file manager, remove the original app from /tce/optional. Copy and paste the new app to /tce/optional.

Remove the app from OnBoot or OnDemand.

Reboot the computer.

Add the app to OnBoot or OnDemand.
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: gerald_clark on February 07, 2011, 06:51:03 PM
mc.desktop has both
Exec=aterm -e mc
and
Terminal=true
It should be

Exec=mc
Terminal=true

or

Exec=aterm -e mc
Terminal=false
Title: Re: Question: how to create a new wbar icon for "Midnight Commander"
Post by: bmarkus on February 07, 2011, 09:50:35 PM
Thanks for reporting. Yes, I already recognised, it was a test version.

Will fix it.