added wayland XCB hack for clipboard

This commit is contained in:
Jeremy Borgman
2021-02-05 19:25:48 -06:00
committed by borgmanJeremy
parent 99493cb8d9
commit ddd4eb5b0c

View File

@@ -51,9 +51,24 @@ int waitAfterConnecting(int delay, QCoreApplication& app)
return app.exec();
}
// source: https://github.com/ksnip/ksnip/issues/416
void wayland_hacks()
{
// Workaround to https://github.com/ksnip/ksnip/issues/416
QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
QByteArray sessionType = qgetenv("XDG_SESSION_TYPE").toLower();
if (sessionType.contains("wayland") && (currentDesktop.contains("gnome") ||
sessionDesktop.contains("gnome"))) {
qputenv("QT_QPA_PLATFORM", "xcb");
}
}
int main(int argc, char* argv[])
{
#ifdef Q_OS_LINUX
wayland_hacks();
#endif
spdlog::set_level(spdlog::level::debug); // Set global log level to debug
spdlog::set_pattern("[source %s] [function %!] [line %#] %v");