From 29ac546cfa780427dd9705bec6bf9549a02a4738 Mon Sep 17 00:00:00 2001 From: Lin Htut Kyaw Date: Tue, 8 Jul 2025 16:47:49 +0630 Subject: [PATCH] added -s option to frog cli so that frog -e can work well without the gui --- bin/frog.in | 3 ++- frog/main.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/frog.in b/bin/frog.in index 533c7c2..6d35c8a 100755 --- a/bin/frog.in +++ b/bin/frog.in @@ -36,10 +36,11 @@ import locale VERSION = '@VERSION@' pkgdatadir = '@pkgdatadir@' +pythondir = '@pythondir@' localedir = '@localedir@' project_name = '@projectname@' -sys.path.insert(1, pkgdatadir) +sys.path.insert(1, pythondir) signal.signal(signal.SIGINT, signal.SIG_DFL) # L10n diff --git a/frog/main.py b/frog/main.py index 1089f98..01d8e4a 100644 --- a/frog/main.py +++ b/frog/main.py @@ -72,6 +72,15 @@ def __init__(self, version=None): None ) + self.add_main_option( + 'server', + ord('s'), + GLib.OptionFlags.NONE, + GLib.OptionArg.NONE, + _("Run in server mode without GUI."), + None + ) + # Initialize tesseract data files storage. language_manager.init_tessdata() @@ -124,6 +133,11 @@ def do_command_line(self, command_line): options = command_line.get_options_dict() options = options.end().unpack() + if "server" in options: + logger.info("Server mode activated. Backend is running.") + self.hold() + return 0 + if "extract_to_clipboard" in options: self.backend.capture(self.settings.get_string("active-language"), True) return 1