Change icons of the Alt-Tab windows switcher

Hi guys, googling around I wasn’t able to find anything useful.
When I open the Alt-Tab windows switcher, several app icons are missing (e.g. zathura).
I have created a zathura.desktop file in /usr/share/applications, but that seems to control only the icon that appears in the Mate Menu, and the switcher is not affected.

Do you have idea about how the windows switcher associate app and icons?

thanks in advance!

That popup when you press Alt+Tab is handled by the window manager (Marco).

I have no idea how Marco gets the icons for that popup. It could take it straight from the Xwindow property or from the icon theme.

As an experiment, I made a small bash script that launches a yad (yet another dialog) list with all of the open windows. Once a window in list item is selected, it will focus the window. It works even if the window is on another workspace.
Launching it from mate-panel launcher seems appropriate.


It’s a bit slow because this is a VM and takes time to convert the icons from pam to png image format and resize them to 32x32 pixels.
The script: https://pastebin.com/h3V1zZe1
I wonder if the icons would show up with this script.

requires to install yad and xdotool on 17.10
uses wmctrl also

Icons do not show up!


(You can see that the zathura icon -- shown in Albert -- is not shown )

OK @meme
I’ve figured it out. Zathura is missing a configuration file.

You must create the config file in your home directory eg /home/meme/.config/zathura/zathurarc
with the content

set window-icon /path/to/zathura.png

It will show after that

By the way, there is a man page, run in terminal

man zathurarc

wow it’s great, thank you! You’re a genius!

Do you have any clue on how to make it more general, for any application? For example another app I use a lot, and has the same identical issue, is tabbed, but the man page does not mention anything about the window icon.

Yes, you could use xseticon http://www.leonerd.org.uk/code/xseticon/
It’s an application that can set any window icon.
I’s a little old and needs a couple small patches in the source code and Makefile but it works .

Install build depends: sudo apt install libx11-dev libxmu-dev libgd2-xpm-dev
Also make sure you have installed build-essential and pkg-config

download the tar.gz file and extract it.
Open the text editor and patch the xseticon.c and Makefile

Patch to make it comipile in ubuntu mate 17.10:

xseticon.c line 312:

    printf("Have selected window 0x%08x\n", window);

change it to

    printf("Have selected window 0x%08lx\n", window);

xseticon.c at line 32 add next:

#include <string.h>

Patch the Makefile:
Line 21

	gcc ${LIBS} $^ -o $@

Replace it with:

	 gcc $^ -o $@ ${LIBS}

Then open terminal and change directory to the folder you extracted

cd ~/Downloads/xseticon-0.1+bzr13

run make

make

Don’t run “sudo make install” just copy the binary to the home dir /home/meme/bin
and use it to set the icon.

You’ll need a wrapper script for each application.

This is an example for zathura:

[code]#!/bin/bash
zathura $@ & APP_PID=$!

until xdotool getwindowname $(xdotool search --pid “$APP_PID” | tail -1) &>/dev/null; do # sleep until the window opens
sleep 0.1
done

One second extra

sleep 1

get window name

WINDOW_NAME="$(xprop -id $(xdotool search --pid “$APP_PID” | tail -1) _NET_WM_NAME | awk -F’"’ ‘{print $2}’)"
~/Downloads/xseticon-0.1+bzr13/xseticon -name “$WINDOW_NAME” /path/to/icon.png

wait $APP_PID
echo $?[/code]

great, works perfectly! Many thanks for your time

Excelent! Don’t mention it.
Ciao @meme