From ea0574b86c312f1d59050dbcdde36c2eb7031471 Mon Sep 17 00:00:00 2001 From: James Addison Date: Tue, 28 Jan 2025 00:47:50 +0000 Subject: [PATCH] app: allow `gimp` command-line to run in console mode When non-interactive mode is requested (the -i command-line flag), _and_ we've compiled the app with UI support enabled, allow `gimp` to branch into the console-based version of the app -- equivalent to running it using `gimp-console`. This avoids GTK-related failures open a display when one is not not available (for example, when running `gimp` within a container or a VM without a graphical display). --- app/app.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/app.c b/app/app.c index 2bc02dcf4b..4ebf157545 100644 --- a/app/app.c +++ b/app/app.c @@ -242,7 +242,14 @@ app_run (const gchar *full_prog_name, g_clear_object (&default_folder); #ifndef GIMP_CONSOLE_COMPILATION - app = gimp_app_new (gimp, no_splash, quit, as_new, filenames, batch_interpreter, batch_commands); + if (no_interface) + { + app = gimp_console_app_new (gimp, quit, as_new, filenames, batch_interpreter, batch_commands); + } + else + { + app = gimp_app_new (gimp, no_splash, quit, as_new, filenames, batch_interpreter, batch_commands); + } #else app = gimp_console_app_new (gimp, quit, as_new, filenames, batch_interpreter, batch_commands); #endif