Skip to content

Commit d7e05bb

Browse files
committed
fix(export): match running apps with exported .desktop entry
The DE (at least Gnome and KDE) tries to match the app_id of the running application with the corresponding .desktop file in this order: - find ${app_id}.desktop - if not found, tries to find a .desktop with StartupWMClass=${app_id} Because when exporting a application we change the name of the .desktop file, the DE can't match the running app, displaying a generic icon. To solve this, change StartupWMClass key of the exported .desktop file to the name of the .desktop inside distrobox (minus the .desktop extension).
1 parent cfc6096 commit d7e05bb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

internal/inside-distrobox/assets/distrobox-export

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,10 +572,9 @@ export_application()
572572
> "/run/host${host_home}/.local/share/applications/${desktop_home_file}"
573573
# in the end we add the final quote we've opened in the "container_command_prefix"
574574

575-
if ! grep -q "StartupWMClass" "/run/host${host_home}/.local/share/applications/${desktop_home_file}"; then
576-
printf "StartupWMClass=%s\n" "${exported_app}" >> "\
577-
/run/host${host_home}/.local/share/applications/${desktop_home_file}"
578-
fi
575+
sed -i -e '/StartupWMClass=/d' -e "/\[Desktop Entry\]/a\StartupWMClass=${desktop_original_file%.desktop}" \
576+
"/run/host${host_home}/.local/share/applications/${desktop_home_file}"
577+
579578
# In case of an icon in a non canonical path, we need to replace the path
580579
# in the desktop file.
581580
if [ -n "${icon_file_absolute_path}" ]; then

0 commit comments

Comments
 (0)