Skip to content

Commit 2b38553

Browse files
committed
FIX(client): Disable broken shortcuts on Wayland
Our global shortcut system currently doesn't work when using Wayland (mumble-voip#5257). Therefore, this commit makes sure that the global shortcut system is not even started on such systems. Furthermore, it informs the user about the shortcuts being disabled. Fixes mumble-voip#5303
1 parent 91ae85b commit 2b38553

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

src/mumble/GlobalShortcut.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "Channel.h"
1010
#include "ClientUser.h"
1111
#include "Database.h"
12+
#include "EnvUtils.h"
1213
#include "MainWindow.h"
1314
#include "Global.h"
1415
#include "GlobalShortcutButtons.h"
@@ -525,6 +526,16 @@ GlobalShortcutConfig::GlobalShortcutConfig(Settings &st) : ConfigWidget(st) {
525526

526527
qcbEnableGlobalShortcuts->setVisible(canDisable);
527528

529+
qlWaylandNote->setVisible(false);
530+
#ifdef Q_OS_LINUX
531+
if (EnvUtils::waylandIsUsed()) {
532+
// Our global shortcut system doesn't work with Wayland
533+
qlWaylandNote->setVisible(true);
534+
535+
qgbShortcuts->setEnabled(false);
536+
}
537+
#endif
538+
528539
#ifdef Q_OS_MAC
529540
// Help Mac users enable accessibility access for Mumble...
530541
# if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
@@ -750,6 +761,7 @@ QTreeWidgetItem *GlobalShortcutConfig::itemForShortcut(const Shortcut &sc) const
750761
void GlobalShortcutConfig::reload() {
751762
std::stable_sort(qlShortcuts.begin(), qlShortcuts.end());
752763
qtwShortcuts->clear();
764+
753765
foreach (const Shortcut &sc, qlShortcuts) {
754766
QTreeWidgetItem *item = itemForShortcut(sc);
755767
qtwShortcuts->addTopLevelItem(item);

src/mumble/GlobalShortcut.ui

+13
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@
9595
</layout>
9696
</widget>
9797
</item>
98+
<item>
99+
<widget class="QLabel" name="qlWaylandNote">
100+
<property name="text">
101+
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Mumble's Global Shortcuts system does currently not work in combination with the Wayland protocol. For more information, visit &lt;a href=&quot;https://github.com/mumble-voip/mumble/issues/5257&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;https://github.com/mumble-voip/mumble/issues/5257&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
102+
</property>
103+
<property name="wordWrap">
104+
<bool>true</bool>
105+
</property>
106+
<property name="openExternalLinks">
107+
<bool>true</bool>
108+
</property>
109+
</widget>
110+
</item>
98111
<item>
99112
<widget class="QGroupBox" name="qgbShortcuts">
100113
<property name="title">

src/mumble/GlobalShortcut_unix.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "GlobalShortcut_unix.h"
77

8+
#include "EnvUtils.h"
89
#include "Settings.h"
910
#include "Global.h"
1011

@@ -62,6 +63,12 @@ GlobalShortcutX::GlobalShortcutX() {
6263
}
6364

6465
#ifdef Q_OS_LINUX
66+
if (EnvUtils::waylandIsUsed()) {
67+
qWarning("GlobalShortcutX: Global shortcuts don't work on Wayland (see "
68+
"https://github.com/mumble-voip/mumble/issues/5257)");
69+
return;
70+
}
71+
6572
if (Global::get().s.bEnableEvdev) {
6673
QString dir = QLatin1String("/dev/input");
6774
QFileSystemWatcher *fsw = new QFileSystemWatcher(QStringList(dir), this);

src/mumble/Settings.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "AudioInput.h"
99
#include "Cert.h"
10+
#include "EnvUtils.h"
1011
#include "Log.h"
1112
#include "SSL.h"
1213
#include "Global.h"
@@ -531,6 +532,12 @@ Settings::Settings() {
531532
bEnableXboxInput = true;
532533
bEnableUIAccess = true;
533534

535+
#ifdef Q_OS_LINUX
536+
if (EnvUtils::waylandIsUsed()) {
537+
bShortcutEnable = false;
538+
}
539+
#endif
540+
534541
for (int i = Log::firstMsgType; i <= Log::lastMsgType; ++i) {
535542
qmMessages.insert(i, Settings::LogConsole | Settings::LogBalloon | Settings::LogTTS);
536543
qmMessageSounds.insert(i, QString());
@@ -1004,6 +1011,13 @@ void Settings::load(QSettings *settings_ptr) {
10041011
LOAD(bEnableXboxInput, "shortcut/windows/xbox/enable");
10051012
LOAD(bEnableUIAccess, "shortcut/windows/uiaccess/enable");
10061013

1014+
#ifdef Q_OS_LINUX
1015+
if (EnvUtils::waylandIsUsed()) {
1016+
// Global shortcuts don't work on Wayland
1017+
bShortcutEnable = false;
1018+
}
1019+
#endif
1020+
10071021
// Search options
10081022
LOAD(searchForUsers, "search/search_for_users");
10091023
LOAD(searchForChannels, "search/search_for_channels");

0 commit comments

Comments
 (0)