Skip to content

Commit 76f8067

Browse files
Add useGrimAdapter option to the config window (#3943)
1 parent f7a049e commit 76f8067

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/config/generalconf.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ GeneralConf::GeneralConf(QWidget* parent)
3737
initAutoCloseIdleDaemon();
3838
#endif
3939
initShowTrayIcon();
40+
initUseGrimAdapter();
4041
initShowDesktopNotification();
4142
initShowAbortNotification();
4243
#if !defined(DISABLE_UPDATE_CHECKER)
@@ -117,6 +118,10 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
117118
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
118119
m_showTray->setChecked(!config.disabledTrayIcon());
119120
#endif
121+
122+
#if defined(Q_OS_LINUX)
123+
m_useGrimAdapter->setChecked(config.useGrimAdapter());
124+
#endif
120125
}
121126

122127
void GeneralConf::updateComponents()
@@ -149,6 +154,11 @@ void GeneralConf::showAbortNotificationChanged(bool checked)
149154
ConfigHandler().setShowAbortNotification(checked);
150155
}
151156

157+
void GeneralConf::useGrimAdapter(bool checked)
158+
{
159+
ConfigHandler().useGrimAdapter(checked);
160+
}
161+
152162
#if !defined(DISABLE_UPDATE_CHECKER)
153163
void GeneralConf::checkForUpdatesChanged(bool checked)
154164
{
@@ -326,6 +336,24 @@ void GeneralConf::initShowTrayIcon()
326336
#endif
327337
}
328338

339+
void GeneralConf::initUseGrimAdapter()
340+
{
341+
#if defined(Q_OS_LINUX)
342+
m_useGrimAdapter =
343+
new QCheckBox(tr("Use grim to capture screenshots"), this);
344+
m_useGrimAdapter->setToolTip(
345+
tr("Grim is a wayland only utility to capture screens based on the "
346+
"screencopy protocol. Generally only enable on minimal wayland window "
347+
"managers like sway, hyprland, etc."));
348+
m_scrollAreaLayout->addWidget(m_useGrimAdapter);
349+
350+
connect(m_useGrimAdapter,
351+
&QCheckBox::clicked,
352+
this,
353+
&GeneralConf::useGrimAdapter);
354+
#endif
355+
}
356+
329357
void GeneralConf::initHistoryConfirmationToDelete()
330358
{
331359
m_historyConfirmationToDelete = new QCheckBox(

src/config/generalconf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private slots:
3838
void showSidePanelButtonChanged(bool checked);
3939
void showDesktopNotificationChanged(bool checked);
4040
void showAbortNotificationChanged(bool checked);
41+
void useGrimAdapter(bool checked);
4142
#if !defined(DISABLE_UPDATE_CHECKER)
4243
void checkForUpdatesChanged(bool checked);
4344
#endif
@@ -87,6 +88,7 @@ private slots:
8788
void initShowSidePanelButton();
8889
void initShowStartupLaunchMessage();
8990
void initShowTrayIcon();
91+
void initUseGrimAdapter();
9092
void initSquareMagnifier();
9193
void initUndoLimit();
9294
void initUploadWithoutConfirmation();
@@ -107,6 +109,7 @@ private slots:
107109
QCheckBox* m_sysNotifications;
108110
QCheckBox* m_abortNotifications;
109111
QCheckBox* m_showTray;
112+
QCheckBox* m_useGrimAdapter;
110113
QCheckBox* m_helpMessage;
111114
QCheckBox* m_sidePanelButton;
112115
#if !defined(DISABLE_UPDATE_CHECKER)

0 commit comments

Comments
 (0)