Change icon for an application from the command line?
Solution 1
xseticon allows you to do exactly that.
Solution 2
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).
Related videos on Youtube
9000
I constantly try to expand the little I know about programming.
Updated on September 18, 2022Comments
-
9000 over 1 year
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
norwmctrl
are capable of this.-
ibuprofen over 3 yearsDid 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
-
-
9000 over 9 yearsYhank you, I know that. I need to change the icon of a window dynamically; I suppose it's somehow standard under X11.
-
ctrl-alt-delor over 6 yearsI 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.