Can I change the icon of an application?

Duncan 1i5t5.duncan at
Sat Oct 1 05:26:12 BST 2011

Dun Peal posted on Fri, 30 Sep 2011 21:23:22 -0500 as excerpted:

> By copy-pasting the Konsole item in kmenuedit, I create a new item
> "Konsole-2". I then clicked on its icon, and changed it from the black
> miniature terminal to a new icon. I then saved and exited kmenuedit.
> In Kickstart, "Konsole-2" now appears under the "System" sub-menu, with
> the new icon. When I click to launch it, the new icon bounces next to my
> mouse cursor as its being launched. However, once it's fully launched,
> the icon in the bottom panel (i.e. the "task bar") is the same old black
> miniature terminal. In the task switcher (<Alt>-<Tab>) the old icon
> reigns supreme, too. In fact I didn't see that the new icon took hold
> anywhere, except in the launcher and during initial execution.
> Is there anything I forgot to do?

Two possibilities, ensure that the various kde components have updated 
their info, and if that fails, we try a command-line option available to 
all kde apps.

First, try running kbuildsycoca4.  SyCoCa takes the first two letters of 
each word from SYstem COnfig CAche, which is what it is, provided you 
think of "System" in the context of KDE, not in the context of the entire 
computer, where the kernel caches would be more correctly "system", and 
the config is in /proc and /sys, both memory-based pseudo-filesystems, so 
it's already cached in memory.  But back to kbuildsycoca.  What running 
it does is re-scan kde's umpteen text-base config files at both the 
system and user level, updating kde's sycoca, which caches that 
information in binary form.  kbuildsycoca then notifies running apps so 
they can recheck the info they get from ksycoca.  Obviously, I'm thinking 
that perhaps kde's task manager was still using stale info.

If that doesn't do it, since the taskbar is part of plasma, and kwin 
controls the icon in the titlebar, try restarting them.  In krunner:

killall plasma-desktop; sleep 2; plasma-desktop

That's three commands, but entered as a single command-line.  (You can do 
the same thing with kquitapp, the kde-specific method, but I prefer the 
traditional GNU/Linux killall utility.)

Then the same for kwin (doing the three-as-one wasn't really critical for 
plasma, but it's a bit more so for kwin, as without a window manager it 
can be difficult or impossible to focus the line to enter the 
resurrecting command, and you may have to either terminate kde and 
restart it or browse to and click on the kwin binary to start it, I've 
had to do that before, because mouse clicks worked but keyboard entry 
wouldn't, without a window manager to decide where the focus went):

killall kwin; sleep 2; kwin

Of course, the same effect should be had by simply restarting kde, if 
desired, rather than restarting individual components, or for that matter 
restarting the whole computer, if you want.  But it's still worth running 
kbuildsycoca4, since while it should update on kde restart, sometimes 
there's a bug and it doesn't until you do it manually.

If that doesn't work, then it's time for the command line option.  To see 
this for yourself, start with the --help option that most commands 
(including but not limited to kde commands) offer when run on the command-
line (in konsole, in this case).

konsole --help

Notice the --help-kde option for common kde options, and try it.

konsole --help-kde

Now, notice this line:

 --icon <icon>             Use 'icon' as the application icon

OK, so what you need to do now is go back to that new menu item you 
created and edit its command line, adding the --icon option.  AFAIK you 
can either use the full path, or if it's a normal icon in the scheme, 
just list it by name (the icon browser you used before lists the icon 
names, hover over them for a tooltip if they're cutoff) and I /believe/ 
kde should just find it.  

FWIW, I've not actually tried this option before, myself, tho I just 
tried it now and it seems to do what you're after, only noted it reading 
the various help output.  (I don't even have a taskbar plasmoid 
configured as I have dual monitors so don't need it /that/ much, and I 
use tab-switching, desktop-grid, etc, when a window does get buried.  So 
I haven't verified that but I did test that the --icon set icon appears 
in the titlebar and in the tab-switcher.)  I didn't think the --icon 
option was going to be necessary before, thus my not mentioning it, but 
it looks like it may be necessary after all, if the problem isn't just 
stale data screwing things up.

Meanwhile, for some rather interesting entertainment, notice this entry 
under --help-qt.

  --reverse                 mirrors the whole layout of widgets

Try adding that one to a few selected menu entries if you have friends/
family that regularly use the computer, and watch their bewilderment as 
it changes the interface just enough... <evil grin>

Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

This message is from the kde mailing list.
Account management:
More info:

More information about the kde mailing list