3

To clarify, I mean the icon that is displayed when the app is running (e.g. inside the dock).

With trial and error, I found out that it uses "/usr/share/pixmap/xfce4-terminal.xpm" as the icon (tested by replacing this file with some other icon).

I was unable to find where it maps the running xterm to this icon.

If I copy the xterm binary to a different name and run that one, it gets a different icon, which shows that there is a possibility to change it.

I already tried setting the "xterm*iconPixmap:" resource, but that appears to have no effect at all.

Sec
  • 7,059
  • 6
  • 31
  • 58

3 Answers3

3

You could try using xseticon

usage: xseticon [options] path/to/icon.png

options:

-name : apply icon to the window of the name supplied -id : apply icon to the window id supplied

Sets the window icon to the specified .png image. The image is loaded from the file at runtime and sent to the X server; thereafter the file does not need to exist, and can be deleted/renamed/modified without the X server or window manager noticing. If no window selection option is specified, the window can be interactively selected using the cursor.

Hints: xseticon -id "$WINDOWID" path/to/icon.png Will set the icon for an xterm.

********** EDIT **********

I think you need the imagemagick program installed to access the convert command. Then, find an icon that you like and convert it to an xbm file:

Code:

convert /path/to/icon/file /path/to/xterm.xbm

Create an ~/.Xresources file with the following content:

Code:

xterm*iconPixmap:   /path/to/xterm.xbm

Then merge in the ~/Xresources file:

Code:

xrdb -merge ~/.Xresources

The update came from: http://forum.xfce.org/viewtopic.php?id=6779

gmaniac
  • 940
  • 1
  • 17
  • 33
  • I was looking for a solution that is more permanent -- changing a single icon during runtime sounds interesting, but somewhere there has to be a place where the default icon is set... – Sec Jan 10 '15 at 01:08
  • 2
    xseticon was nice! I couldn't get it to compile (link, actually) when I tried, but there's a .deb on the same site, where you can extract the binary and pretend that libgd3 is libgd3: https://gist.github.com/unhammer/cfa9cd907adcdf391290 – unhammer Nov 02 '15 at 09:51
3

I finally managed to do by setting *iconHint on the xterm resource. The value needs to be a path to an .xpm file WITHOUT the extension.

X resources that you want to be loaded at login time need to go into an ~/.Xdefaults file.

So a complete solution for an icon my-xterm.xpm would be:

mkdir ~/.icons
mv my-xterm.xpm ~/.icons/
echo 'xterm*iconHint: '$HOME'/.icons/my-xterm' >> ~/.Xdefaults

If you want your changed ~/.Xdefaults to become active without logging in, run xrdb -merge ~/.Xdefaults

If you just want one xterm to have a different icon, you can start the xterm like this:

xterm -xrm 'xterm*iconHint: /full/path/to/icon' …
Sec
  • 7,059
  • 6
  • 31
  • 58
0

Not 100% sure that changing the .desktop file would help in XFCE. But it's a worth a shot.

  1. Find the path to your local icons, here is in the sub path of /usr/local/share/icons.

  2. Then simply copy the .desktop file to you home dir eg:

    cp /usr/share/applications/xterm-color.desktop ~/.local/share/applications/

  3. Then edit the .dekstop fil in an editor, there is a line like this: Icon=xterm-color

    Replace this with a icon name from your icons path and logout and back in and you should be good to go. (The icon should not have the file extention like .png or .svg).

rawzone
  • 1
  • 1
  • 2
  • There is no .desktop file for xterm that I can find. And if I create one for xterm in ~/.local/share/applications/ it does not change anything as far as I can see. – Sec Jan 10 '15 at 01:06