Add useGrimAdapter option to the config window (#3943)

This commit is contained in:
Harsh Narayan Jha
2025-05-22 00:31:26 +05:30
committed by GitHub
parent f7a049ee78
commit 76f8067b2d
2 changed files with 31 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ GeneralConf::GeneralConf(QWidget* parent)
initAutoCloseIdleDaemon();
#endif
initShowTrayIcon();
initUseGrimAdapter();
initShowDesktopNotification();
initShowAbortNotification();
#if !defined(DISABLE_UPDATE_CHECKER)
@@ -117,6 +118,10 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
m_showTray->setChecked(!config.disabledTrayIcon());
#endif
#if defined(Q_OS_LINUX)
m_useGrimAdapter->setChecked(config.useGrimAdapter());
#endif
}
void GeneralConf::updateComponents()
@@ -149,6 +154,11 @@ void GeneralConf::showAbortNotificationChanged(bool checked)
ConfigHandler().setShowAbortNotification(checked);
}
void GeneralConf::useGrimAdapter(bool checked)
{
ConfigHandler().useGrimAdapter(checked);
}
#if !defined(DISABLE_UPDATE_CHECKER)
void GeneralConf::checkForUpdatesChanged(bool checked)
{
@@ -326,6 +336,24 @@ void GeneralConf::initShowTrayIcon()
#endif
}
void GeneralConf::initUseGrimAdapter()
{
#if defined(Q_OS_LINUX)
m_useGrimAdapter =
new QCheckBox(tr("Use grim to capture screenshots"), this);
m_useGrimAdapter->setToolTip(
tr("Grim is a wayland only utility to capture screens based on the "
"screencopy protocol. Generally only enable on minimal wayland window "
"managers like sway, hyprland, etc."));
m_scrollAreaLayout->addWidget(m_useGrimAdapter);
connect(m_useGrimAdapter,
&QCheckBox::clicked,
this,
&GeneralConf::useGrimAdapter);
#endif
}
void GeneralConf::initHistoryConfirmationToDelete()
{
m_historyConfirmationToDelete = new QCheckBox(

View File

@@ -38,6 +38,7 @@ private slots:
void showSidePanelButtonChanged(bool checked);
void showDesktopNotificationChanged(bool checked);
void showAbortNotificationChanged(bool checked);
void useGrimAdapter(bool checked);
#if !defined(DISABLE_UPDATE_CHECKER)
void checkForUpdatesChanged(bool checked);
#endif
@@ -87,6 +88,7 @@ private:
void initShowSidePanelButton();
void initShowStartupLaunchMessage();
void initShowTrayIcon();
void initUseGrimAdapter();
void initSquareMagnifier();
void initUndoLimit();
void initUploadWithoutConfirmation();
@@ -107,6 +109,7 @@ private:
QCheckBox* m_sysNotifications;
QCheckBox* m_abortNotifications;
QCheckBox* m_showTray;
QCheckBox* m_useGrimAdapter;
QCheckBox* m_helpMessage;
QCheckBox* m_sidePanelButton;
#if !defined(DISABLE_UPDATE_CHECKER)