Describe the bug
After opening Teams for Linux in elementary OS, with its default dock (an elementary-patched version of Plank), a second, low-resolution icon appears in the dock in addition to the main high-resolution icon (which remains if pinned, and disappears after a few seconds if not).
To Reproduce
Steps to reproduce the behavior:
Expected behavior
One (high resolution) icon that hosts all Teams for Linux windows.
Screenshots

Desktop (please complete the following information):
Additional context
I've identified the following issues / solutions:
StartupWMClass=teams-for-linux, but according to xprop the WM_CLASS of each window is actually "teams for linux" "Teams for Linux" (note the spaces instead of hyphens).StartupWMClass="teams for linux" doesn't work (not with Plank, anyway--I'm not sure if other docks / window managers work better with spaces in WM_CLASS). "productName": "Teams for Linux" entry in package.json. I confirmed this by removing the productName and rebuilding; the "name": "teams-for-linux" entry took precedence, WM_CLASS was set to to "teams-for-linux" "teams-for-linux", and the dock's window matching issue was resolved.$HOME/.config/Teams for Linux becoming $HOME/.config/teams-for-linux (meaning users will lose their configuration). It may be preferable to set WM_CLASS manually in some other way.Locally, I've returned to stock 0.3.0 and worked around the problem by creating a user-specific desktop file (at ~/.local/share/applications):
[Desktop Entry]
Name=Microsoft Teams for Linux
Comment=Unofficial client for Microsoft Teams for Linux
Exec=/bin/bash /home/lina/Code/random-scripts/linux/start-teams-for-linux.sh %U
Terminal=false
Type=Application
Icon=teams-for-linux
StartupWMClass=teams-for-linux
MimeType=application/sip;
Categories=Chat;Network;Office;
And here's the Bash script:
#!/bin/bash
set -euo pipefail
"/opt/Teams for Linux/teams-for-linux" "$@" &
TEAMS_PID=$!
while ps -p "$TEAMS_PID" >/dev/null; do
sleep 5
TEAMS_WINDOWS=($(xwininfo -tree -root | grep -E '\("teams for linux" "Teams for Linux"\)[ 0-9+x-]*$' | grep -Eio '\b0x[0-9a-f]+\b')) || continue
for TEAMS_WINDOW in "${TEAMS_WINDOWS[@]}"; do
xprop -id "$TEAMS_WINDOW" -f WM_CLASS 8u -set WM_CLASS "teams-for-linux"
done
done
Even this is imperfect, as Plank still associates the app's windows with the system-wide .desktop file, so you can't "pin" your user-specific launcher. Always launch from the Applications Menu.
Hi, it will be great to add a pr with the fix (just removing the product name). Needing to log in again and copy a couple of files across should not be much of a problem for people using Linux. Thanks!!
Thanks @IsmaelMartinez. The one-line PR is in.
Thanks a lot!! Now, lets see how much it breaks ! (it should not break anything but you will be surprise of how different each packaging system is...)
I will close but might re-open if the snap people starts reporting issues. The snap edge channel is the 1st to get any stuff... for the good or the bad :) Thanks again for finding the issue and, even better, fixing it!
Most helpful comment
Hi, it will be great to add a pr with the fix (just removing the product name). Needing to log in again and copy a couple of files across should not be much of a problem for people using Linux. Thanks!!