From 58aee20e219eb2a5484b0da1f8297aaa727bb313 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 24 Oct 2022 08:13:14 -0300 Subject: [PATCH] [gems.appimage] improvement: removing the TryExec field from the installed desktop entries to avoid issues with some DEs --- CHANGELOG.md | 6 ++++++ bauh/gems/appimage/util.py | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e4d4b9..c229e96f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [STAGING] + +### Fixes +- AppImage + - some desktop entries not being displayed on the desktop environment menu (requires the AppImage to be reinstalled) [#287](https://github.com/vinifmor/bauh/issues/287) + ## [0.10.3] 2022-05-30 ### Features diff --git a/bauh/gems/appimage/util.py b/bauh/gems/appimage/util.py index 43edda03..ba5b387d 100644 --- a/bauh/gems/appimage/util.py +++ b/bauh/gems/appimage/util.py @@ -2,7 +2,7 @@ import os import re from typing import Optional -RE_DESKTOP_EXEC = re.compile(r'(Exec\s*=(.+)(\n?))') +RE_DESKTOP_EXEC = re.compile(r'(\w*Exec\s*=(.+)(\n?))') RE_MANY_SPACES = re.compile(r'\s+') @@ -24,6 +24,11 @@ def replace_desktop_entry_exec_command(desktop_entry: str, appname: str, file_pa for exec_groups in execs: full_match = exec_groups[0] + + if full_match.startswith("TryExec"): # TryExec cause issues in some DE to display the app icon + final_entry = final_entry.replace(full_match, "") + continue + cmd = RE_MANY_SPACES.sub(' ', exec_groups[1].strip()) if cmd: words = cmd.split(' ')