mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 22:04:15 +02:00
[fix][web] not informing StartupWMClass on generated desktop entries
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import glob
|
||||
import json
|
||||
import locale
|
||||
import os
|
||||
import re
|
||||
@@ -688,6 +689,15 @@ class WebApplicationManager(SoftwareManager):
|
||||
|
||||
watcher.change_substatus(self.i18n['web.install.substatus.shortcut'])
|
||||
|
||||
try:
|
||||
package_info_path = '{}/resources/app/package.json'.format(pkg.installation_dir)
|
||||
with open(package_info_path) as f:
|
||||
package_info_path = json.loads(f.read())
|
||||
pkg.package_name = package_info_path['name']
|
||||
except:
|
||||
self.logger.info("Could not read the the package info from '{}'".format(package_info_path))
|
||||
traceback.print_exc()
|
||||
|
||||
desktop_entry_path = self._gen_desktop_entry_path(app_id)
|
||||
|
||||
entry_content = self._gen_desktop_entry_content(pkg)
|
||||
@@ -720,9 +730,11 @@ class WebApplicationManager(SoftwareManager):
|
||||
Icon={icon}
|
||||
Exec={exec_path}
|
||||
{categories}
|
||||
{wmclass}
|
||||
""".format(name=pkg.name, exec_path=pkg.get_command(),
|
||||
desc=pkg.description or pkg.url, icon=pkg.get_disk_icon_path(),
|
||||
categories='Categories={}'.format(';'.join(pkg.categories)) if pkg.categories else '')
|
||||
categories='Categories={}'.format(';'.join(pkg.categories)) if pkg.categories else '',
|
||||
wmclass="StartupWMClass={}".format(pkg.package_name) if pkg.package_name else '')
|
||||
|
||||
def is_enabled(self) -> bool:
|
||||
return self.enabled
|
||||
|
||||
@@ -13,7 +13,7 @@ class WebApplication(SoftwarePackage):
|
||||
def __init__(self, id: str = None, url: str = None, name: str = None, description: str = None, icon_url: str = None,
|
||||
installation_dir: str = None, desktop_entry: str = None, installed: bool = False, version: str = None,
|
||||
categories: List[str] = None, custom_icon: str = None, preset_options: List[str] = None, save_icon: bool = True,
|
||||
options_set: List[str] = None):
|
||||
options_set: List[str] = None, package_name: str = None):
|
||||
super(WebApplication, self).__init__(id=id if id else url, name=name, description=description,
|
||||
icon_url=icon_url, installed=installed, version=version,
|
||||
categories=categories)
|
||||
@@ -24,6 +24,7 @@ class WebApplication(SoftwarePackage):
|
||||
self.preset_options = preset_options
|
||||
self.save_icon = save_icon # if the icon_url should be used instead of the one retrieved by nativefier
|
||||
self.options_set = options_set
|
||||
self.package_name = package_name
|
||||
|
||||
def set_version(self, version: str):
|
||||
self.version = str(version) if version else None
|
||||
@@ -38,7 +39,7 @@ class WebApplication(SoftwarePackage):
|
||||
@staticmethod
|
||||
def _get_cached_attrs() -> tuple:
|
||||
return 'id', 'name', 'version', 'url', 'description', 'icon_url', 'installation_dir', \
|
||||
'desktop_entry', 'categories', 'custom_icon', 'options_set', 'save_icon'
|
||||
'desktop_entry', 'categories', 'custom_icon', 'options_set', 'save_icon', 'package_name'
|
||||
|
||||
def can_be_downgraded(self):
|
||||
return False
|
||||
@@ -123,13 +124,17 @@ class WebApplication(SoftwarePackage):
|
||||
self.icon_url = custom_icon
|
||||
|
||||
def get_config_dir(self) -> str:
|
||||
if self.installation_dir:
|
||||
config_path = '{}/.config'.format(Path.home())
|
||||
if self.package_name:
|
||||
config_dir = '{}/.config/{}'.format(str(Path.home()), self.package_name)
|
||||
|
||||
if os.path.exists(config_path):
|
||||
config_dirs = glob.glob('{}/{}-nativefier-*'.format(config_path, self.installation_dir.split('/')[-1]))
|
||||
|
||||
if config_dirs:
|
||||
return config_dirs[0]
|
||||
if os.path.exists(config_dir):
|
||||
return config_dir
|
||||
else:
|
||||
if self.installation_dir:
|
||||
config_path = '{}/.config'.format(str(Path.home()))
|
||||
|
||||
if os.path.exists(config_path):
|
||||
config_dirs = glob.glob('{}/{}-nativefier-*'.format(config_path, self.installation_dir.split('/')[-1]))
|
||||
|
||||
if config_dirs:
|
||||
return config_dirs[0]
|
||||
|
||||
Reference in New Issue
Block a user