I fixed another long-time annoyance today: the missing window icon of the Slack desktop app (also missing from my pager). This is a common problem with applications that come from outside the traditional Linux ecosystem and are a bit half-assedly integrated, especially with pre-XDG standard environments. Like Fluxbox, which is what I use.
The issue is that the app doesn't set a `_NET_WM_ICON` property on its window. In an environment that supports XDG, you can work around this by setting properties in the `.desktop` file -- so if you use one of those, don't do this; do that instead. But Fluxbox doesn't use those files. There are various scripts that can generate a Fluxbox menu from the XDG application tree, but it's not a native feature. So you need something older to apply the property to the window at runtime.
There's a utility called `xseticon` (this one https://github.com/xeyownt/xseticon, not the other one) that does this (converting an input PNG icon to the appropriate format). You can install it as a snap, but then you have to give it special permissions to access icon files outside your home dir, so I suggest building from source (it's straightforward).
`xseticon` needs the window's name or ID. There are multiple tools that can find this for you. I picked `xdotool search`, because it has a `--sync` flag that makes it block until it has output, so I didn't have to hack in my own solution to wait for the Slack window to be found immediately after it is launched. I had to combine a bunch of search parameters to find the correct Slack window and not any of the incorrect ones (searching for visible windows up to a specific depth narrows it down enough).
Then I wrote a wrapper script to launch Slack and fix the icon, and put it in my `~/bin`:
```
/usr/bin/slack "$@" &
WINDOW_ID=`xdotool search --sync --maxdepth 2 --onlyvisible --class slack`
xseticon -id $WINDOW_ID /usr/share/pixmaps/slack.png
```
Note that if you call the wrapper `slack`, as I did, it's EXTREMELY IMPORTANT that you call the real Slack executable with its full path and not an unqualified name, unless you want to fork bomb yourself and crash your computer. I didn't do it this time, because I did it the last time I made a wrapper like this.
#linux
1/2