-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonscreenkeyboard.cpp
More file actions
37 lines (34 loc) · 1.07 KB
/
Copy pathonscreenkeyboard.cpp
File metadata and controls
37 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "onscreenkeyboard.h"
#include <QStandardPaths>
#include <QtGlobal>
QStringList OnScreenKeyboard::candidates()
{
#ifdef Q_OS_LINUX
// Prefer Wayland-native keyboards on Wayland: an X11 keyboard there can
// start (reporting success) and then immediately exit.
const bool onWayland = !qgetenv("WAYLAND_DISPLAY").isEmpty();
return onWayland
? QStringList{"onboard", "squeekboard", "wvkbd", "maliit-keyboard",
"florence", "kvkbd", "matchbox-keyboard"}
: QStringList{"onboard", "florence", "xvkbd", "kvkbd", "matchbox-keyboard"};
#else
return {};
#endif
}
QString OnScreenKeyboard::findInstalled()
{
for (const QString& kb : candidates())
if (!QStandardPaths::findExecutable(kb).isEmpty())
return kb;
return {};
}
QString OnScreenKeyboard::windowsOskPath()
{
#ifdef Q_OS_WIN
const QString sysRoot = QString::fromLocal8Bit(qgetenv("SystemRoot"));
return (sysRoot.isEmpty() ? QStringLiteral("C:\\Windows") : sysRoot)
+ QStringLiteral("\\System32\\osk.exe");
#else
return {};
#endif
}