Skip to content

Commit ccb5a27

Browse files
authored
config option to disable grim warrning (flameshot-org#3456)
* add config to disable grim warrning close flameshot-org#3186 * fix typo * fix format with clang-format
1 parent c1dac52 commit ccb5a27

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

flameshot.example.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
;; Whether the tray icon is disabled (bool)
4949
;disabledTrayIcon=false
5050
;
51+
;; Disable Grim Warning notification
52+
;disabledGrimWarning=true
53+
;
5154
;; Automatically close daemon when it's not needed (not available on Windows)
5255
;autoCloseIdleDaemon=false
5356
;

src/utils/confighandler.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static QMap<class QString, QSharedPointer<ValueHandler>>
7878
OPTION("showSidePanelButton" ,Bool ( true )),
7979
OPTION("showDesktopNotification" ,Bool ( true )),
8080
OPTION("disabledTrayIcon" ,Bool ( false )),
81+
OPTION("disabledGrimWarning" ,Bool ( false )),
8182
OPTION("historyConfirmationToDelete" ,Bool ( true )),
8283
#if !defined(DISABLE_UPDATE_CHECKER)
8384
OPTION("checkForUpdates" ,Bool ( true )),

src/utils/confighandler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ class ConfigHandler : public QObject
8888
bool)
8989
CONFIG_GETTER_SETTER(filenamePattern, setFilenamePattern, QString)
9090
CONFIG_GETTER_SETTER(disabledTrayIcon, setDisabledTrayIcon, bool)
91+
CONFIG_GETTER_SETTER(disabledGrimWarning, disabledGrimWarning, bool)
9192
CONFIG_GETTER_SETTER(drawThickness, setDrawThickness, int)
9293
CONFIG_GETTER_SETTER(drawFontSize, setDrawFontSize, int)
9394
CONFIG_GETTER_SETTER(keepOpenAppLauncher, setKeepOpenAppLauncher, bool)

src/utils/screengrabber.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "screengrabber.h"
55
#include "abstractlogger.h"
66
#include "src/core/qguiappcurrentscreen.h"
7+
#include "src/utils/confighandler.h"
78
#include "src/utils/filenamehandler.h"
89
#include "src/utils/systemnotification.h"
910
#include <QApplication>
@@ -141,10 +142,12 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
141142
"activate the grim-based general wayland screenshot adapter");
142143
freeDesktopPortal(ok, res);
143144
#else
144-
AbstractLogger::warning()
145-
<< tr("grim's screenshot component is implemented based on "
146-
"wlroots, it may not be used in GNOME or similar "
147-
"desktop environments");
145+
if (!ConfigHandler().disabledGrimWarning()) {
146+
AbstractLogger::warning() << tr(
147+
"grim's screenshot component is implemented based on "
148+
"wlroots, it may not be used in GNOME or similar "
149+
"desktop environments");
150+
}
148151
generalGrimScreenshot(ok, res);
149152
#endif
150153
break;

0 commit comments

Comments
 (0)