Skip to content

Commit c268492

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 5cb3e60 commit c268492

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-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

+6
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,11 @@ GlobalShortcutX::GlobalShortcutX() {
6263
}
6364

6465
#ifdef Q_OS_LINUX
66+
if (EnvUtils::waylandIsUsed()) {
67+
qWarning("GlobalShortcutX: Global shortcuts don't work on Wayland (see https://github.com/mumble-voip/mumble/issues/5257)");
68+
return;
69+
}
70+
6571
if (Global::get().s.bEnableEvdev) {
6672
QString dir = QLatin1String("/dev/input");
6773
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"
@@ -532,6 +533,12 @@ Settings::Settings() {
532533
bEnableXboxInput = true;
533534
bEnableUIAccess = true;
534535

536+
#ifdef Q_OS_LINUX
537+
if (EnvUtils::waylandIsUsed()) {
538+
bShortcutEnable = false;
539+
}
540+
#endif
541+
535542
for (int i = Log::firstMsgType; i <= Log::lastMsgType; ++i) {
536543
qmMessages.insert(i,
537544
Settings::LogConsole | Settings::LogBalloon | Settings::LogTTS | Settings::LogMessageLimit);
@@ -1007,6 +1014,13 @@ void Settings::load(QSettings *settings_ptr) {
10071014
LOAD(bEnableXboxInput, "shortcut/windows/xbox/enable");
10081015
LOAD(bEnableUIAccess, "shortcut/windows/uiaccess/enable");
10091016

1017+
#ifdef Q_OS_LINUX
1018+
if (EnvUtils::waylandIsUsed()) {
1019+
// Global shortcuts don't work on Wayland
1020+
bShortcutEnable = false;
1021+
}
1022+
#endif
1023+
10101024
// Search options
10111025
LOAD(searchForUsers, "search/search_for_users");
10121026
LOAD(searchForChannels, "search/search_for_channels");

0 commit comments

Comments
 (0)