@@ -85,7 +85,7 @@ TrayIcon::TrayIcon(QObject* parent)
8585 connect (ConfigHandler::getInstance (),
8686 &ConfigHandler::fileChanged,
8787 this ,
88- [this ]() {});
88+ [this ]() { updateCaptureActionShortcut (); });
8989}
9090
9191TrayIcon::~TrayIcon ()
@@ -104,8 +104,11 @@ void TrayIcon::initMenu()
104104{
105105 m_menu = new QMenu ();
106106
107- auto * captureAction = new QAction (tr (" &Take Screenshot" ), this );
108- connect (captureAction, &QAction::triggered, this , [this ]() {
107+ m_captureAction = new QAction (tr (" &Take Screenshot" ), this );
108+
109+ updateCaptureActionShortcut ();
110+
111+ connect (m_captureAction, &QAction::triggered, this , [this ]() {
109112#if defined(Q_OS_MACOS)
110113 auto currentMacOsVersion = QOperatingSystemVersion::current ();
111114 if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
@@ -170,7 +173,7 @@ void TrayIcon::initMenu()
170173 Flameshot::instance (),
171174 &Flameshot::openSavePath);
172175
173- m_menu->addAction (captureAction );
176+ m_menu->addAction (m_captureAction );
174177 m_menu->addAction (launcherAction);
175178 m_menu->addSeparator ();
176179#ifdef ENABLE_IMGUR
@@ -188,6 +191,18 @@ void TrayIcon::initMenu()
188191 m_menu->addAction (quitAction);
189192}
190193
194+ void TrayIcon::updateCaptureActionShortcut ()
195+ {
196+ #if defined(Q_OS_MACOS)
197+ if (!m_captureAction) {
198+ return ;
199+ }
200+
201+ QString shortcut = ConfigHandler ().shortcut (" TAKE_SCREENSHOT" );
202+ m_captureAction->setShortcut (QKeySequence (shortcut));
203+ #endif
204+ }
205+
191206#if !defined(DISABLE_UPDATE_CHECKER)
192207void TrayIcon::enableCheckUpdatesAction (bool enable)
193208{
0 commit comments