View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017750 | Scribus | OS-MacOSX | public | 2026-02-14 00:42 | 2026-02-14 00:42 |
| Reporter | stepan | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | new | Resolution | open | ||
| Platform | MacBook Air | OS | macOS | OS Version | 26.2 |
| Product Version | 1.7.3.svn | ||||
| Summary | 0017750: Using -g / --no-gui will still pop up a UI Window on macOS | ||||
| Description | Using -g / --no-gui will still pop up a UI Window on macOS. This is particularly annoying when kicking off a larger automated build / conversion of a large number of images from a Makefile. While the make process is running, the machine is basically unusable because Scribus windows keep popping up and vanishing left and right. This is very distracting. With the attached patch Scribus is nicely running in the background when used in script mode. Please consider merging this patch for the next version. Any feedback is welcome. | ||||
| Steps To Reproduce | SCRIBUS := $(shell if [ -x /Applications/Scribus-1.7.3.svn.app/Contents/MacOS/Scribus ]; then echo /Applications/Scribus-1.7.3.svn.app/Contents/MacOS/Scribus; else echo /usr/bin/scribus; fi) SVG2CMYK = ../scripts/svg2cmyk.py [..] figures/%.pdf: figures/%.svg INPUT=$< OUTPUT=$@ $(SCRIBUS) --no-gui -py $(SVG2CMYK) ---- import scribus import sys import os import xml.etree.ElementTree as ET # USAGE: # INPUT=input.svg OUTPUT=output.pdf /path/to/Scribus -g -py svg2cmyk.py def convert_to_points(value): """Convert SVG dimension string to points (1pt = 1/72 inch).""" value = value.strip() if value.endswith('pt'): return float(value[:-2]) elif value.endswith('px'): return float(value[:-2]) * 72.0 / 96.0 elif value.endswith('mm'): return float(value[:-2]) * 72.0 / 25.4 elif value.endswith('cm'): return float(value[:-2]) * 72.0 / 2.54 elif value.endswith('in'): return float(value[:-2]) * 72.0 else: try: # Unitless: treat as points to match Scribus SVG import behavior return float(value) except ValueError: return None def get_svg_dimensions(svg_path): """Parse SVG to get width and height in points.""" tree = ET.parse(svg_path) root = tree.getroot() width = root.get('width') height = root.get('height') if width and height: w = convert_to_points(width) h = convert_to_points(height) if w and h: return w, h # Fall back to viewBox viewbox = root.get('viewBox') if viewbox: parts = viewbox.split() if len(parts) == 4: # Treat as points to match Scribus SVG import behavior return float(parts[2]), float(parts[3]) return None, None def convert(): input_svg = os.environ.get('INPUT') output_pdf = os.environ.get('OUTPUT') if not input_svg or not output_pdf: print("Usage: INPUT=input.svg OUTPUT=output.pdf scribus -g -py svg2cmyk.py") sys.exit(1) input_svg = os.path.abspath(input_svg) output_pdf = os.path.abspath(output_pdf) # Match document size to SVG dimensions w, h = get_svg_dimensions(input_svg) if w is None or h is None: print("Warning: could not parse SVG dimensions, defaulting to A4") w, h = 595, 842 scribus.newDocument( (w, h), (0, 0, 0, 0), scribus.PORTRAIT, 1, scribus.UNIT_POINTS, scribus.NOFACINGPAGES, scribus.FIRSTPAGELEFT, 1 ) scribus.placeSVG(input_svg, 0, 0) # Export as CMYK PDF pdf = scribus.PDFfile() pdf.file = output_pdf pdf.version = 14 # PDF 1.4 (preserves transparency) pdf.outdst = 1 # Printer output (CMYK) pdf.compress = True pdf.resolution = 300 pdf.downsample = 300 pdf.save() scribus.closeDoc() if not scribus.haveDoc(): convert() | ||||
| Additional Information | I am using Scribus to produce CMYK PDFs from SVGs to be used with LaTeX for rendering a manual / book. | ||||
| Tags | No tags attached. | ||||
| Attached Files | scribus_nogui_macos.diff (1,852 bytes)
diff --git a/scribus/main_nix.cpp b/scribus/main_nix.cpp
index a73325103..d7eac662a 100644
--- a/scribus/main_nix.cpp
+++ b/scribus/main_nix.cpp
@@ -25,6 +25,7 @@ for which a new license (GPL+exception) is in place.
* *
***************************************************************************/
+#include <cstring>
#include <iostream>
#include <csignal>
@@ -66,8 +67,24 @@ int mainApp(int argc, char **argv)
{
emergencyActivated = false;
+ // Pre-scan argv for --no-gui/-g before creating QApplication,
+ // so we can select the offscreen platform plugin and prevent
+ // any window or dock icon from appearing
+ bool noGUI = false;
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "--no-gui") == 0 || strcmp(argv[i], "-g") == 0)
+ {
+ noGUI = true;
+ break;
+ }
+ }
+
+ if (noGUI)
+ qputenv("QT_QPA_PLATFORM", "offscreen");
#if !defined(Q_OS_MACOS)
- qputenv("QT_QPA_PLATFORM", "xcb");
+ else
+ qputenv("QT_QPA_PLATFORM", "xcb");
#endif
QImageReader::setAllocationLimit(1024);
diff --git a/scribus/main_win32.cpp b/scribus/main_win32.cpp
index 312bc3c3d..cd0ccb893 100644
--- a/scribus/main_win32.cpp
+++ b/scribus/main_win32.cpp
@@ -99,6 +99,18 @@ int main(int argc, char *argv[])
}
#endif
+ // Pre-scan argv for --no-gui/-g before creating QApplication,
+ // so we can select the offscreen platform plugin and prevent
+ // any window from appearing
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "--no-gui") == 0 || strcmp(argv[i], "-g") == 0)
+ {
+ qputenv("QT_QPA_PLATFORM", "offscreen");
+ break;
+ }
+ }
+
ScribusQApp::setAttribute(Qt::AA_EnableHighDpiScaling);
ScribusQApp::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QImageReader::setAllocationLimit(1024);
| ||||
| Patch | Yes | ||||