Is there a way to change the icon of an application's window from the command line?

For instance, I'd like to have separate icons for Firefox windows under different profiles (different processes), change the icon of the terminal if it runs tmux, etc.

By 'icon' I mean the small picture shown by window switcher, typically invoked with Alt+Tab. In particular, I'm interested for this to work under xfwm4, but a more general solution would only be welcome.

Apparently, neither xdotool nor wmctrl are capable of this.

  • Did you ever find a solution for this? I am also only able to change for some windows. E.g. kitty terminal works, but not xfce4-terminal. Beside xseticon I have also tried this benizi.com/set-icon and the like (but no luck). xprop show the new icon, but not in e.g Alt+Tab
    – ibuprofen
    Jan 28, 2021 at 2:31

3 Answers 3


xseticon allows you to do exactly that.

  • 1
    The release of xseticon at the link in this post no longer works on Ubuntu 22.04, but this fork does. Jul 22, 2023 at 14:53

If you run xprop and click on a window, you see that the icon is among the "metadata" assigned to the window structure in your X server, under name and type _NET_WM_ICON(CARDINAL). These parameters can be changed by other X applications, for instance, window managers write and change a whole bunch of stuff in there. The key function will be XChangeProperty.

I'm not aware of any tools that do this easily from commandline but this doesn't mean they don't exist.

In any case, it could be written from scratch, it's not hard (even though writing in raw xlib will make your chest hair stand on end and probably give you PTSD).

  • I have tried xseticon as recommended by @dakatine. It uses _NET_WM_ICON, and has changed the icon, in the top left corner (in the title bar). However there is no change in the task-bar, or system tray (when an app has an icon here). Do you know why the task-bar is not changing. Sep 10, 2017 at 12:48

It could be different for different OSes / flavours. Mostly by editing the desktop file directly at /usr/share/applications or by copying or creating the desktop file at /home/username/.local/share/applications/ , this could be achieved.


Please refer http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html

  • 1
    Yhank you, I know that. I need to change the icon of a window dynamically; I suppose it's somehow standard under X11.
    – 9000
    Jan 15, 2015 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .