Skip to content

Commit

Permalink
env var to override the headless platform used by Qt
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Apr 19, 2024
1 parent f0c0378 commit cc9afd6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/calibre/gui2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,10 +1189,9 @@ def __init__(self, args=(), force_calibre_style=False, override_program_name=Non
args = [override_program_name] + args[1:]
self.palette_manager = PaletteManager(force_calibre_style, headless)
if headless:
args.extend(('-platformpluginpath', plugins_loc, '-platform', 'headless'))
args.extend(('-platformpluginpath', plugins_loc, '-platform', os.environ.get('CALIBRE_HEADLESS_PLATFORM', 'headless')))
else:
args.extend(self.palette_manager.args_to_qt)

self.headless = headless
from calibre_extensions import progress_indicator
self.pi = progress_indicator
Expand Down Expand Up @@ -1583,7 +1582,7 @@ def ensure_app(headless=True):
args = sys.argv[:1]
has_headless = ismacos or islinux or isbsd
if headless and has_headless:
args += ['-platformpluginpath', plugins_loc, '-platform', 'headless']
args += ['-platformpluginpath', plugins_loc, '-platform', os.environ.get('CALIBRE_HEADLESS_PLATFORM', 'headless')]
if ismacos:
os.environ['QT_MAC_DISABLE_FOREGROUND_APPLICATION_TRANSFORM'] = '1'
if headless and iswindows:
Expand Down

0 comments on commit cc9afd6

Please sign in to comment.