Default tray icon (red X)

Using applications, configuring, problems
Post Reply
Message
Author
Jasper

Default tray icon (red X)

#1 Post by Jasper »

Hi readers,

I would appreciate a "how to" link a distinct
tray icon to any pet lacking a specific icon.

I use Precise 5.5 with JWM.

My regards

PS It's not important, but it would be nice.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#2 Post by Karl Godt »

Tray apps normally have their icons somewhere in /usr/share/PROGRAMNAME

like retrovol for example :

bash-3.2# ls /usr/local/share/retrovol/images
audio-volume-high.png audio-volume-medium.png
audio-volume-low.png audio-volume-muted.png

Jasper

#3 Post by Jasper »

Hi Karl et al,

Karl, thank you very much for your response which I studied, but I couldn't figure how to use your "retrovol" example in another application.
-------------------
So if there is a generic method to allocate a tray icon to an app which doesn't have one, might it help to look at "Simple Menu" from technosaurus (where in his opening post in the link below he specifically wrote "... for whatever reason I decided not to make a menu entry[/tray icon] for it").

http://www.murga-linux.com/puppy/viewtopic.php?t=77660

Scrolling down there are posts from:
* technosaurus re smenu-0.2.pet
* LIBL and jemimah re non-English use
[which may be of general interest to some readers who might like to try Simple Menu, with or without any interest in the tray icon aspect].

My regards

With Simple Menu a tray icon seems to be superfluous, but I have other pet and sfs apps where it would be nice to be able to use a choice of tray icon in place of the default icon.

I have not asked technosaurus, partly because likely he's busy and, to me, it would seem impolite.

User avatar
`f00
Posts: 807
Joined: Thu 06 Nov 2008, 19:13
Location: the Western Reserve

#4 Post by `f00 »

Hi Jasper - yes, the default red-X icon is kind of a job to get around if indeed it can be done.

Mostly jwm gets it right and uses the app-specific icon, but if it can't then it uses the 'generic' (for gtk-dialog-based mini-apps and so on). Possibly you might be able to use jwm's group tag - see the jwm man for more info - to set a preferred icon, but then again you'd have to narrow the group (class) to a specific subgroup (name) and it could defeat your intent if you don't get everything properly done.

Dotdesktop files are the usual source for icons in the rootmenu, but sometimes the icon is different (or generic) in titlebar/tasklist for jwm.

xprop is a good tool for determining various window properties (class, name, icon and so forth). It's been awhile, but if I recall correctly xdotool can be used to manipulate those to some extent.

Funny, slacko55 has been giving me somewhat of a related issue lately - medit shows a correct red pen icon in menus but I get a printer icon in titlebar/tasklist.. minor but annoying :|

Jasper

#5 Post by Jasper »

Hi `f00,

Thank you for your contribution, which I will study in detail and with interest tomorrow, though I may not try to implement your possible work arounds.

I have used xdotool before with success, but it took some three hours for me do a simple task which experts would accomplish in minutes or even seconds.

My regards to all

PS PupMenu, from radky, in Full Mode gives lots of information on apps and enables easy viewing and editing of extensive data as well as many other useful functions.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#6 Post by npierce »

Hi Jasper,

When I read your first post, I thought I understood your question, but after reading your other posts I am now not so sure.
Jasper wrote:Post subject: Default tray icon (red X)
Subject description: How to change that?
1. I first assumed that you wanted to change the default window icon so that all applications that didn't specify an icon would use the new default icon instead of the red X.

Perhaps that was a correct assumption.

2. But perhaps you just want to know how to assign an icon to an application which currently doesn't have one -- not change the default.
Jasper wrote:. . . I have other pet and sfs apps where it would be nice to be able to use a choice of tray icon in place of the default icon.
Yes, that sounds more like #2. You don't want to actually change the default icon; you want the application to use an icon other than the default.

So I'll now assume that the latter is what you are asking. (I hope that is the case, because the answer to #2 is easier than the answer to #1, since I think the default icon is actually hard-coded inside the jwm executable and changing it would require patching the source and recompiling or doing some precision editing of the executable.)

Many applications supply a window icon and request that the window manager use it by passing the _NET_WM_ICON hint. Those that don't do that can have a window icon associated with it, for use by JWM, by placing an image file with a basename that matches the resource name for the application in one of JWM's IconPaths.

What are JWN's IconPaths? They can be found by looking in the /root/.jwmrc file. For instance, here are the IconPaths in my /root/.jwmrc file:

Code: Select all

# grep IconPath /root/.jwmrc | grep -v '<!-'
<IconPath>/usr/local/lib/X11/mini-icons</IconPath>
<IconPath>/usr/local/lib/X11/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps</IconPath>
<IconPath>/usr/local/share/pixmaps</IconPath>
Your results may vary, but it looks like these four paths are fairly common in recent Puppies, since I've found the same in Racy 5.2.2, Slacko 5.5-PAE, and Precise 5.5.

What is a "resource name"? It is a name passed to the window manager by the application in the WM_CLASS hint. Not all applications pass a WM_CLASS hint. For those that do, you can see the resource name of the application by using the xprop utility recommended by `f00 in his post above. Enter the following command and then click on the application's window:

Code: Select all

xprop | grep WM_CLASS
This will spit out two names. The first is the resource name; the second is the resource class. Often the resource name will be the same as the name of the executable, but that is not always the case.

So, let's say you have an application named whatever. You use the above command and find out that the resource name is also whatever. So you create an icon file and name it whatever.xpm, and you place it in the /usr/local/lib/X11/mini-icons/ directory because that was one of the IconPaths in your /root/.jwmrc file.

With any luck you can than restart JWM, then launch the application and see the new icon on its title bar and in JWM's tray.


As for the icons in the menus, they are defined differently. As `f00 mentioned above, they are defined in the .desktop files. If you want to add or modify a menu icon, find the .desktop file for the application in the /usr/share/applications/ directory, then add or modify the "Icon=" line. If you want, you can use the same icon as you used for the window icon. For instance:

Code: Select all

Icon=whatever.xpm
Again, the icon file should live in one of the directories shown in the <IconPath> fields in your /root/.jwmrc file. If you want to use an icon file in a directory that is not in one of JWM's IconPaths, you can provide the absolute pathname of the icon file. For instance:

Code: Select all

Icon=/root/my-icons/whatever.xpm
For more details on this stuff see JWM Configuration: Icons

Good luck.

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#7 Post by CatDude »

Hi

@ `f00
`f00 wrote:...Funny, slacko55 has been giving me somewhat of a related issue lately - medit shows a correct red pen icon in menus but I get a printer icon in titlebar/tasklist.. minor but annoying :|
I first noticed similar behaviour back with Slacko-5331 (IIRC) when using Psip Puppy Phone,
if i was to IM someone, i had a strange icon on that window (but not on the two main windows). (see pics)

After a little hunting, i figured out the cause and a solution.

For your particular issue, try the following:

If you look in: /usr/share/icons/hicolor/16x16/apps/ (i have 4351 items in here :shock: )
you will probably find this:
  • medit.xpm is a symbolic link to m.xpm
    which is also a symbolic link pointing to printer.xpm
Simply replace the medit.xpm symbolic link for an actual icon of your choice,
then update the icon cache.

Code: Select all

gtk-update-icon-cache -f -i /usr/share/icons/hicolor
Now fire up your app and see if the right icon is displayed.


Hope this helps
CatDude

P.S
The IP in my images was edited to protect the innocent :lol:
.
Attachments
default.png
(92.59 KiB) Downloaded 350 times
fixed.png
(91.29 KiB) Downloaded 345 times
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

Jasper

#8 Post by Jasper »

Hi npierce,

Success. Your your instructions are a model of clarity, simplicity and excellence.

Thank you very much.

My regards to all, especially the responders

PS I'm not just pleased. I'm delighted.

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#9 Post by npierce »

Jasper,

You're very welcome.

Thanks for taking the time to provide feedback. I do make an effort to be clear, and it is good to hear that (at least sometimes) I succeed. :) It is nice to know the effort is appreciated.

User avatar
`f00
Posts: 807
Joined: Thu 06 Nov 2008, 19:13
Location: the Western Reserve

#10 Post by `f00 »

Thank you, CatDude! - yep, that icon dir is a bit large (one can only wonder what it would do to iconfinder's load time :shock: if that utility were in slacko).

Indeed your solution does help :D thanks again for the hunting/kb

Also props to npierce for a good rundown of _NET_WM_ICON hint - I tend to get lost in that :oops:

npierce
Posts: 858
Joined: Tue 29 Dec 2009, 01:40

#11 Post by npierce »

`f00,
`f00 wrote:. . I tend to get lost in that
Me too. I try to remember to bring a lot of bread crumbs with me when I venture into that forest. :)


CatDude,

Thanks for the explanation of the medit icons. It clarified something for me, and inspired me to look deeper into how GTK apps find their icons.

Post Reply