Skip to content

Commit ddd4eb5

Browse files
committed
added wayland XCB hack for clipboard
1 parent 99493cb commit ddd4eb5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,24 @@ int waitAfterConnecting(int delay, QCoreApplication& app)
5151
return app.exec();
5252
}
5353

54-
int main(int argc, char* argv[])
54+
// source: https://github.com/ksnip/ksnip/issues/416
55+
void wayland_hacks()
5556
{
57+
// Workaround to https://github.com/ksnip/ksnip/issues/416
58+
QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
59+
QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
60+
QByteArray sessionType = qgetenv("XDG_SESSION_TYPE").toLower();
61+
if (sessionType.contains("wayland") && (currentDesktop.contains("gnome") ||
62+
sessionDesktop.contains("gnome"))) {
63+
qputenv("QT_QPA_PLATFORM", "xcb");
64+
}
65+
}
5666

67+
int main(int argc, char* argv[])
68+
{
69+
#ifdef Q_OS_LINUX
70+
wayland_hacks();
71+
#endif
5772
spdlog::set_level(spdlog::level::debug); // Set global log level to debug
5873
spdlog::set_pattern("[source %s] [function %!] [line %#] %v");
5974

0 commit comments

Comments
 (0)