Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QApplication>
#include <QDir>
#include <QLibraryInfo>
#include <QScreen>
#include <QSharedMemory>
#include <QTimer>
#include <QTranslator>
Expand Down Expand Up @@ -148,6 +149,17 @@ int main(int argc, char* argv[])
auto c = Flameshot::instance();
FlameshotDaemon::start();

/* Register handlers for when the screen configuration changes to reinit the app to fix #3505 */
QObject::connect(qApp, &QGuiApplication::screenAdded, [](QScreen *screen){
qDebug() << "Screen added. Reinitializing application.";
configureApp(true);
});
QObject::connect(qApp, &QGuiApplication::screenRemoved, [](QScreen *screen){
// Code to handle screen removed
qDebug() << "Screen removed. Reinitializing application.";
configureApp(true);
});

#if !(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
new FlameshotDBusAdapter(c);
QDBusConnection dbus = QDBusConnection::sessionBus();
Expand Down