mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
macOS: Fix extra dock icons visible when doing a job using Qt WebEngine such as converting to PDF or searching in Get books. Fixes #2023395 [Multiple Dock Icons When Searching for Books](https://bugs.launchpad.net/calibre/+bug/2023395)
Apparently a recent macOS update changed some behavior. Now we need to have LSBackgroundOnly=1 in the Info.plist for calibre-parallel otherwise when using Qt we get a dock icon for the process. Sigh.
This commit is contained in:
parent
565b86b853
commit
fdf95531e0
@ -742,15 +742,24 @@ class Freeze:
|
||||
e = plist['CFBundleDocumentTypes'][0]
|
||||
e['CFBundleTypeExtensions'] = [x.lower() for x in formats]
|
||||
|
||||
def headless_plist(plist):
|
||||
plist['CFBundleDisplayName'] = 'calibre worker process'
|
||||
plist['CFBundleExecutable'] = 'calibre-parallel'
|
||||
plist['CFBundleIdentifier'] = 'com.calibre-ebook.calibre-parallel'
|
||||
plist['LSBackgroundOnly'] = '1'
|
||||
plist.pop('CFBundleDocumentTypes')
|
||||
|
||||
self.create_app_clone('ebook-viewer.app', partial(specialise_plist, 'ebook-viewer', input_formats))
|
||||
self.create_app_clone('ebook-edit.app', partial(specialise_plist, 'ebook-edit', edit_formats),
|
||||
base_dir=join(self.contents_dir, 'ebook-viewer.app', 'Contents'))
|
||||
self.create_app_clone('headless.app', headless_plist,
|
||||
base_dir=join(self.contents_dir, 'ebook-viewer.app', 'Contents', 'ebook-edit.app', 'Contents'))
|
||||
# We need to move the webengine resources into the deepest sub-app
|
||||
# because the sandbox gets set to the nearest enclosing app which
|
||||
# means that WebEngine will fail to access its resources when running
|
||||
# in the sub-apps unless they are present inside the sub app bundle
|
||||
# somewhere
|
||||
base_dest = join(self.contents_dir, 'ebook-viewer.app', 'Contents', 'ebook-edit.app', 'Contents', 'SharedSupport')
|
||||
base_dest = join(self.contents_dir, 'ebook-viewer.app', 'Contents', 'ebook-edit.app', 'Contents', 'headless.app', 'Contents', 'SharedSupport')
|
||||
os.mkdir(base_dest)
|
||||
base_src = os.path.realpath(join(self.frameworks_dir, 'QtWebEngineCore.framework/Resources'))
|
||||
items = [join(base_src, 'qtwebengine_locales')] + glob.glob(join(base_src, '*.pak')) + glob.glob(join(base_src, '*.dat'))
|
||||
|
@ -73,6 +73,9 @@ class Worker:
|
||||
|
||||
@property
|
||||
def executable(self):
|
||||
if ismacos and not hasattr(sys, 'running_from_setup'):
|
||||
base = os.path.dirname(sys.executables_location)
|
||||
return os.path.join(base, 'ebook-viewer.app/Contents/ebook-edit.app/Contents/headless.app/Contents/MacOS', self.exe_name)
|
||||
return exe_path(self.exe_name)
|
||||
|
||||
@property
|
||||
|
Loading…
x
Reference in New Issue
Block a user