[plasma/spectacle] /: Add --scaled modifier for -f/--fullscreen to capture all screens scaled

Noah Davis null at kde.org
Mon Mar 16 20:36:13 GMT 2026


Git commit 2f22353c57f3393d53ac40e07405c3a120ffea85 by Noah Davis, on behalf of Matthias Kurz.
Committed on 16/03/2026 at 20:35.
Pushed by ndavis into branch 'master'.

Add --scaled modifier for -f/--fullscreen to capture all screens scaled

Instead of a standalone flag, --scaled acts as a modifier to -f/--fullscreen,
mapping to the AllScreensScaled grab mode. Using --scaled without -f emits
a warning and is ignored.

Usage: spectacle -f --scaled -b -o screenshot.png

M  +7    -0    doc/man-spectacle.1.docbook
M  +8    -3    src/CommandLineOptions.h
M  +5    -1    src/SpectacleCore.cpp

https://invent.kde.org/plasma/spectacle/-/commit/2f22353c57f3393d53ac40e07405c3a120ffea85

diff --git a/doc/man-spectacle.1.docbook b/doc/man-spectacle.1.docbook
index b8e41cf89..3a7409043 100644
--- a/doc/man-spectacle.1.docbook
+++ b/doc/man-spectacle.1.docbook
@@ -68,6 +68,13 @@
 </listitem>
 </varlistentry>
 
+<varlistentry>
+<term><option>--scaled</option></term>
+<listitem>
+<para>When used with <option>-f</option>/<option>--fullscreen</option>, capture all screens scaled to the same size. Has no effect without <option>-f</option>.</para>
+</listitem>
+</varlistentry>
+
 <varlistentry>
 <term><option>-m, --current</option></term>
 <listitem>
diff --git a/src/CommandLineOptions.h b/src/CommandLineOptions.h
index dc4b8ffaf..b2a523b19 100644
--- a/src/CommandLineOptions.h
+++ b/src/CommandLineOptions.h
@@ -21,6 +21,10 @@ struct CommandLineOptions {
         {u"f"_s, u"fullscreen"_s},
         i18n("Capture the entire desktop (default)")
     };
+    const QCommandLineOption scaled = {
+        {u"scaled"_s},
+        i18n("When used with -f/--fullscreen, capture all screens scaled to the same size")
+    };
     const QCommandLineOption current = {
         {u"m"_s, u"current"_s},
         i18n("Capture the current monitor")
@@ -112,14 +116,15 @@ struct CommandLineOptions {
     const QCommandLineOption releaseCapture = {{u"k"_s, u"release-capture"_s}, i18n("Accept region selection on click-and-release")};
 
     const QList<QCommandLineOption> allOptions = {
-        fullscreen, current,     activeWindow, windowUnderCursor, transientOnly, region,       record,         launchOnly,
-        gui,        background,  dbus,         noNotify,          output,        delay,        copyImage,      copyPath,
-        onClick,    newInstance, pointer,      noDecoration,      noShadow,      editExisting, releaseCapture,
+        fullscreen, scaled,      current,      activeWindow, windowUnderCursor, transientOnly, region,       record,         launchOnly,
+        gui,        background,  dbus,         noNotify,     output,            delay,         copyImage,    copyPath,
+        onClick,    newInstance, pointer,      noDecoration, noShadow,          editExisting,  releaseCapture,
     };
 
     // Keep order in sync with allOptions
     enum Option {
         Fullscreen,
+        Scaled,
         Current,
         ActiveWindow,
         WindowUnderCursor,
diff --git a/src/SpectacleCore.cpp b/src/SpectacleCore.cpp
index 7b5613011..1d40946d1 100644
--- a/src/SpectacleCore.cpp
+++ b/src/SpectacleCore.cpp
@@ -1002,7 +1002,7 @@ void SpectacleCore::activate(const QStringList &arguments, const QString &workin
     using GrabMode = ImagePlatform::GrabMode;
     auto cliGrabMode = [&]() -> std::optional<GrabMode> {
         if (m_cliOptions[Option::Fullscreen]) {
-            return GrabMode::AllScreens;
+            return m_cliOptions[Option::Scaled] ? GrabMode::AllScreensScaled : GrabMode::AllScreens;
         } else if (m_cliOptions[Option::Current]) {
             return GrabMode::CurrentScreen;
         } else if (m_cliOptions[Option::ActiveWindow]) {
@@ -1028,6 +1028,10 @@ void SpectacleCore::activate(const QStringList &arguments, const QString &workin
     };
     auto grabMode = cliGrabMode().value_or(m_startMode == StartMode::Background ? GrabMode::AllScreens : launchActionGrabMode());
 
+    if (m_cliOptions[Option::Scaled] && !m_cliOptions[Option::Fullscreen]) {
+        qWarning().noquote() << i18nc("@info:shell", "--scaled is only allowed together with -f/--fullscreen and will be ignored");
+    }
+
     using RecordingMode = VideoPlatform::RecordingMode;
     RecordingMode recordingMode = RecordingMode::NoRecordingModes;
     if (m_cliOptions[Option::Record]) {


More information about the kde-doc-english mailing list