diff --git a/src/config/generalconf.cpp b/src/config/generalconf.cpp index d303e5e5..4fc0743a 100644 --- a/src/config/generalconf.cpp +++ b/src/config/generalconf.cpp @@ -204,8 +204,7 @@ void GeneralConf::initShowTrayIcon() { #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) m_showTray = new QCheckBox(tr("Show tray icon"), this); - ConfigHandler config; - bool checked = !config.disabledTrayIconValue(); + bool checked = !ConfigHandler().disabledTrayIconValue(); m_showTray->setChecked(checked); m_showTray->setToolTip(tr("Show the systemtray icon")); m_layout->addWidget(m_showTray); @@ -281,8 +280,7 @@ void GeneralConf::initCheckForUpdates() void GeneralConf::initAutostart() { m_autostart = new QCheckBox(tr("Launch at startup"), this); - ConfigHandler config; - bool checked = config.startupLaunchValue(); + bool checked = ConfigHandler().startupLaunchValue(); m_autostart->setChecked(checked); m_autostart->setToolTip(tr("Launch Flameshot")); m_layout->addWidget(m_autostart); diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 41ebf41e..b92db6a1 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -382,6 +382,7 @@ void Controller::openLauncherWindow() void Controller::enableTrayIcon() { + ConfigHandler().setDisabledTrayIcon(false); if (m_trayIcon) { m_trayIcon->show(); return; @@ -391,7 +392,6 @@ void Controller::enableTrayIcon() Q_ASSERT(m_trayIconMenu); } - ConfigHandler().setDisabledTrayIcon(false); QAction* captureAction = new QAction(tr("&Take Screenshot"), this); connect(captureAction, &QAction::triggered, this, [this]() { #if defined(Q_OS_MACOS) @@ -508,7 +508,7 @@ void Controller::enableTrayIcon() void Controller::disableTrayIcon() { -#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) || defined(Q_OS_MACOS) if (m_trayIcon) { m_trayIcon->hide(); }