mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 12:04:16 +02:00
[fix][web] not informing StartupWMClass on generated desktop entries
This commit is contained in:
@@ -4,10 +4,11 @@ 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/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [0.8.5] - 2020-03-06
|
## [0.8.5] - 2020-03
|
||||||
### Fixes
|
### Fixes
|
||||||
- Web
|
- Web
|
||||||
- not able to inject javascript fixes ( WhatsApp Web not working) [#74](https://github.com/vinifmor/bauh/issues/74)
|
- not able to inject javascript fixes ( WhatsApp Web not working) [#74](https://github.com/vinifmor/bauh/issues/74)
|
||||||
|
- not informing StartupWMClass on generated desktop entries ( prevents Gnome to link the Favorite shortcut with the app instance [#76](https://github.com/vinifmor/bauh/issues/76) )
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
- AUR
|
- AUR
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import glob
|
import glob
|
||||||
|
import json
|
||||||
import locale
|
import locale
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -688,6 +689,15 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
|
|
||||||
watcher.change_substatus(self.i18n['web.install.substatus.shortcut'])
|
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)
|
desktop_entry_path = self._gen_desktop_entry_path(app_id)
|
||||||
|
|
||||||
entry_content = self._gen_desktop_entry_content(pkg)
|
entry_content = self._gen_desktop_entry_content(pkg)
|
||||||
@@ -720,9 +730,11 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
Icon={icon}
|
Icon={icon}
|
||||||
Exec={exec_path}
|
Exec={exec_path}
|
||||||
{categories}
|
{categories}
|
||||||
|
{wmclass}
|
||||||
""".format(name=pkg.name, exec_path=pkg.get_command(),
|
""".format(name=pkg.name, exec_path=pkg.get_command(),
|
||||||
desc=pkg.description or pkg.url, icon=pkg.get_disk_icon_path(),
|
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:
|
def is_enabled(self) -> bool:
|
||||||
return self.enabled
|
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,
|
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,
|
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,
|
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,
|
super(WebApplication, self).__init__(id=id if id else url, name=name, description=description,
|
||||||
icon_url=icon_url, installed=installed, version=version,
|
icon_url=icon_url, installed=installed, version=version,
|
||||||
categories=categories)
|
categories=categories)
|
||||||
@@ -24,6 +24,7 @@ class WebApplication(SoftwarePackage):
|
|||||||
self.preset_options = preset_options
|
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.save_icon = save_icon # if the icon_url should be used instead of the one retrieved by nativefier
|
||||||
self.options_set = options_set
|
self.options_set = options_set
|
||||||
|
self.package_name = package_name
|
||||||
|
|
||||||
def set_version(self, version: str):
|
def set_version(self, version: str):
|
||||||
self.version = str(version) if version else None
|
self.version = str(version) if version else None
|
||||||
@@ -38,7 +39,7 @@ class WebApplication(SoftwarePackage):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_cached_attrs() -> tuple:
|
def _get_cached_attrs() -> tuple:
|
||||||
return 'id', 'name', 'version', 'url', 'description', 'icon_url', 'installation_dir', \
|
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):
|
def can_be_downgraded(self):
|
||||||
return False
|
return False
|
||||||
@@ -123,13 +124,17 @@ class WebApplication(SoftwarePackage):
|
|||||||
self.icon_url = custom_icon
|
self.icon_url = custom_icon
|
||||||
|
|
||||||
def get_config_dir(self) -> str:
|
def get_config_dir(self) -> str:
|
||||||
if self.installation_dir:
|
if self.package_name:
|
||||||
config_path = '{}/.config'.format(Path.home())
|
config_dir = '{}/.config/{}'.format(str(Path.home()), self.package_name)
|
||||||
|
|
||||||
if os.path.exists(config_path):
|
if os.path.exists(config_dir):
|
||||||
config_dirs = glob.glob('{}/{}-nativefier-*'.format(config_path, self.installation_dir.split('/')[-1]))
|
return config_dir
|
||||||
|
else:
|
||||||
if config_dirs:
|
if self.installation_dir:
|
||||||
return config_dirs[0]
|
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