diff --git a/src/config/generalconf.cpp b/src/config/generalconf.cpp index 7eb2d96f..fe1aad53 100644 --- a/src/config/generalconf.cpp +++ b/src/config/generalconf.cpp @@ -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( diff --git a/src/config/generalconf.h b/src/config/generalconf.h index 58924374..a384039a 100644 --- a/src/config/generalconf.h +++ b/src/config/generalconf.h @@ -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)