mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 07:34:16 +02:00
[snap] fix: not showing Launch button after recent application installation
This commit is contained in:
@@ -98,12 +98,9 @@ def read_installed(ubuntu_distro: bool) -> List[dict]:
|
||||
if idx > 0 and app_str:
|
||||
apps.append(app_str_to_json(app_str))
|
||||
|
||||
if ubuntu_distro:
|
||||
path = '/snap/{}/current/meta/snap.yaml'
|
||||
else:
|
||||
path = '/var/lib/snapd/snap/{}/current/meta/snap.yaml'
|
||||
info_path = _get_app_info_path(ubuntu_distro)
|
||||
|
||||
info_out = new_subprocess(['cat', *[path.format(a['name']) for a in apps]]).stdout
|
||||
info_out = new_subprocess(['cat', *[info_path.format(a['name']) for a in apps]]).stdout
|
||||
|
||||
idx = -1
|
||||
for o in new_subprocess(['grep', '-E', '(summary|apps)', '--colour=never'], stdin=info_out).stdout:
|
||||
@@ -119,6 +116,29 @@ def read_installed(ubuntu_distro: bool) -> List[dict]:
|
||||
return apps
|
||||
|
||||
|
||||
def _get_app_info_path(ubuntu_distro: bool) -> str:
|
||||
if ubuntu_distro:
|
||||
return '/snap/{}/current/meta/snap.yaml'
|
||||
else:
|
||||
return '/var/lib/snapd/snap/{}/current/meta/snap.yaml'
|
||||
|
||||
|
||||
def has_apps_field(name: str, ubuntu_distro: bool) -> bool:
|
||||
info_path = _get_app_info_path(ubuntu_distro)
|
||||
|
||||
info_out = new_subprocess(['cat', info_path.format(name)]).stdout
|
||||
|
||||
res = False
|
||||
for o in new_subprocess(['grep', '-E', 'apps', '--colour=never'], stdin=info_out).stdout:
|
||||
if o:
|
||||
line = o.decode()
|
||||
|
||||
if line.startswith('apps:'):
|
||||
res = True
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def search(word: str, exact_name: bool = False) -> List[dict]:
|
||||
apps = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user