From ac0ae71ae8a0935e3cc9af9e1ce47382b941cc60 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 16 Oct 2023 18:04:30 +0530 Subject: [PATCH] E-book viewer: Add a command line flag --new-instance to force the viewer to open a new window even if the option to always use a single viewer window is set. Fixes #2038760 [Enhancement Request: Parameter to open second instance of viewer](https://bugs.launchpad.net/calibre/+bug/2038760) --- src/calibre/gui2/viewer/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index 3cdd57c850..4df005c5df 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -137,6 +137,8 @@ View an e-book. )) a('--continue', default=False, action='store_true', dest='continue_reading', help=_('Continue reading the last opened book')) + a('--new-instance', default=False, action='store_true', help=_( + 'Open a new viewer window even when the option to use only a single viewer window is set')) setup_gui_option_parser(parser) return parser @@ -204,7 +206,7 @@ def main(args=sys.argv): oat.startswith('epubcfi(/') or is_float(oat) or oat.startswith('ref:') or oat.startswith('search:') or oat.startswith('regex:')): raise SystemExit(f'Not a valid --open-at value: {opts.open_at}') - if get_session_pref('singleinstance', False): + if not opts.new_instance and get_session_pref('singleinstance', False): from calibre.gui2.listener import Listener from calibre.utils.lock import SingleInstance with SingleInstance(singleinstance_name) as si: