diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7267bc1e..86e6c2b1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -559,8 +559,8 @@ if(HAVE_GLOBALSHORTCUTS)
SOURCES globalshortcuts/globalshortcut-x11.cpp
)
optional_source(HAVE_DBUS
- SOURCES globalshortcuts/globalshortcutbackend-gsd.cpp
- HEADERS globalshortcuts/globalshortcutbackend-gsd.h
+ SOURCES globalshortcuts/globalshortcutbackend-gsd.cpp globalshortcuts/globalshortcutbackend-kde.cpp
+ HEADERS globalshortcuts/globalshortcutbackend-gsd.h globalshortcuts/globalshortcutbackend-kde.h
)
optional_source(WIN32
SOURCES globalshortcuts/globalshortcut-win.cpp
@@ -634,6 +634,14 @@ if(UNIX AND HAVE_DBUS)
dbus/org.gnome.SettingsDaemon.MediaKeys.xml
dbus/gnomesettingsdaemon)
+ # org.kde.KGlobalAccel interface
+ qt6_add_dbus_interface(SOURCES
+ dbus/org.kde.KGlobalAccel.xml
+ dbus/kglobalaccel)
+ qt6_add_dbus_interface(SOURCES
+ dbus/org.kde.KGlobalAccel.Component.xml
+ dbus/kglobalaccelcomponent)
+
else()
# MPRIS 2.0 DBUS interfaces
@@ -662,6 +670,14 @@ if(UNIX AND HAVE_DBUS)
dbus/org.gnome.SettingsDaemon.MediaKeys.xml
dbus/gnomesettingsdaemon)
+ # org.kde.KGlobalAccel interface
+ qt5_add_dbus_interface(SOURCES
+ dbus/org.kde.KGlobalAccel.xml
+ dbus/kglobalaccel)
+ qt5_add_dbus_interface(SOURCES
+ dbus/org.kde.KGlobalAccel.Component.xml
+ dbus/kglobalaccelcomponent)
+
endif()
# org.freedesktop.Avahi.Server interface
diff --git a/src/dbus/org.kde.KGlobalAccel.Component.xml b/src/dbus/org.kde.KGlobalAccel.Component.xml
new file mode 100644
index 00000000..8a785c54
--- /dev/null
+++ b/src/dbus/org.kde.KGlobalAccel.Component.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/dbus/org.kde.KGlobalAccel.xml b/src/dbus/org.kde.KGlobalAccel.xml
new file mode 100644
index 00000000..984fd29e
--- /dev/null
+++ b/src/dbus/org.kde.KGlobalAccel.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/globalshortcuts/globalshortcutbackend-kde.cpp b/src/globalshortcuts/globalshortcutbackend-kde.cpp
new file mode 100644
index 00000000..fb25a0a3
--- /dev/null
+++ b/src/globalshortcuts/globalshortcutbackend-kde.cpp
@@ -0,0 +1,200 @@
+/*
+ * Strawberry Music Player
+ * Copyright 2020, Jonas Kvinge
+ *
+ * Strawberry is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Strawberry is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Strawberry. If not, see .
+ *
+ */
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+# include
+#endif
+
+#include "core/logging.h"
+#include "core/closure.h"
+
+#include "globalshortcutbackend-kde.h"
+
+const char *GlobalShortcutBackendKDE::kKdeService = "org.kde.kglobalaccel";
+const char *GlobalShortcutBackendKDE::kKdePath = "/kglobalaccel";
+
+GlobalShortcutBackendKDE::GlobalShortcutBackendKDE(GlobalShortcuts *parent) : GlobalShortcutBackend(parent), interface_(nullptr), component_(nullptr) {}
+
+bool GlobalShortcutBackendKDE::DoRegister() {
+
+ qLog(Debug) << "Registering";
+
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(kKdeService)) {
+ qLog(Warning) << "KGlobalAccel is not registered";
+ return false;
+ }
+
+ if (!interface_) {
+ interface_ = new OrgKdeKGlobalAccelInterface(kKdeService, kKdePath, QDBusConnection::sessionBus(), this);
+ }
+
+ for (const GlobalShortcuts::Shortcut &shortcut : manager_->shortcuts().values()) {
+ RegisterShortcut(shortcut);
+ }
+
+ QDBusPendingReply reply = interface_->getComponent(QCoreApplication::applicationName());
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ NewClosure(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher);
+
+ return true;
+
+}
+
+void GlobalShortcutBackendKDE::RegisterFinished(QDBusPendingCallWatcher *watcher) {
+
+ QDBusReply reply = watcher->reply();
+ watcher->deleteLater();
+
+ if (!reply.isValid()) {
+ qLog(Error) << "Failed to register:" << reply.error().name() << reply.error().message();
+ return;
+ }
+
+ if (!component_) {
+ component_ = new org::kde::kglobalaccel::Component(kKdeService, reply.value().path(), QDBusConnection::sessionBus(), interface_);
+ }
+
+ if (!component_->isValid()) {
+ qLog(Error) << "Component is invalid:" << QDBusConnection::sessionBus().lastError();
+ return;
+ }
+
+ connect(component_, SIGNAL(globalShortcutPressed(QString, QString, qlonglong)), this, SLOT(GlobalShortcutPressed(QString, QString, qlonglong)), Qt::UniqueConnection);
+
+ qLog(Debug) << "Registered";
+
+}
+
+void GlobalShortcutBackendKDE::DoUnregister() {
+
+ if (!interface_ || !interface_->isValid()) return;
+
+ qLog(Debug) << "Unregistering";
+
+ for (const GlobalShortcuts::Shortcut &shortcut : manager_->shortcuts()) {
+ if (actions_.contains(shortcut.id)) {
+ interface_->unRegister(GetActionId(shortcut.id, shortcut.action));
+ actions_.remove(shortcut.id, shortcut.action);
+ qLog(Info) << "Unregistered shortcut" << shortcut.id << shortcut.action->shortcut();
+ }
+ }
+
+ disconnect(component_, nullptr, this, nullptr);
+
+ qLog(Debug) << "Unregistered";
+
+}
+
+bool GlobalShortcutBackendKDE::RegisterShortcut(const GlobalShortcuts::Shortcut &shortcut) {
+
+ if (!interface_ || !interface_->isValid() || shortcut.id.isEmpty() || !shortcut.action || shortcut.action->shortcut().isEmpty()) return false;
+
+ if (shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaPlay) ||
+ shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaStop) ||
+ shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaNext) ||
+ shortcut.action->shortcut() == QKeySequence(Qt::Key_MediaPrevious)) {
+ qLog(Info) << "Media shortcut" << shortcut.id << shortcut.action->shortcut();
+ return true;
+ }
+
+ QStringList action_id = GetActionId(shortcut.id, shortcut.action);
+ actions_.insert(shortcut.id, shortcut.action);
+ interface_->doRegister(action_id);
+
+ QList active_shortcut = QList() << shortcut.action->shortcut();
+
+ const QList result = interface_->setShortcut(action_id, ToIntList(active_shortcut), 0x2);
+ const QList result_sequence = ToKeySequenceList(result);
+ if (result_sequence != active_shortcut) {
+ if (result_sequence.isEmpty()) {
+ shortcut.action->setShortcut(QKeySequence());
+ }
+ else {
+ shortcut.action->setShortcut(result_sequence[0]);
+ }
+ }
+
+ qLog(Info) << "Registered shortcut" << shortcut.id << shortcut.action->shortcut();
+
+ return true;
+
+}
+
+QStringList GlobalShortcutBackendKDE::GetActionId(const QString &id, const QAction *action) {
+
+ QStringList ret;
+ ret << QCoreApplication::applicationName();
+ ret << id;
+ ret << QCoreApplication::applicationName();
+ ret << action->text().remove('&');
+ if (ret.back().isEmpty()) ret.back() = id;
+
+ return ret;
+
+}
+
+QList GlobalShortcutBackendKDE::ToIntList(const QList &sequence_list) {
+
+ QList ret;
+ for (const QKeySequence &sequence : sequence_list) {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ ret.append(sequence[0].toCombined());
+#else
+ ret.append(sequence[0]);
+#endif
+ }
+
+ return ret;
+
+}
+
+QList GlobalShortcutBackendKDE::ToKeySequenceList(const QList &sequence_list) {
+
+ QList ret;
+ for (int sequence : sequence_list) {
+ ret.append(sequence);
+ }
+
+ return ret;
+
+}
+
+void GlobalShortcutBackendKDE::GlobalShortcutPressed(const QString &component_unique, const QString &shortcut_unique, qlonglong) {
+
+ if (QCoreApplication::applicationName() == component_unique && actions_.contains(shortcut_unique)) {
+ for (QAction *action : actions_.values(shortcut_unique)) {
+ qLog(Debug) << "Key" << action->shortcut() << "pressed.";
+ if (action->isEnabled()) action->trigger();
+ }
+ }
+
+}
diff --git a/src/globalshortcuts/globalshortcutbackend-kde.h b/src/globalshortcuts/globalshortcutbackend-kde.h
new file mode 100644
index 00000000..3d009124
--- /dev/null
+++ b/src/globalshortcuts/globalshortcutbackend-kde.h
@@ -0,0 +1,70 @@
+/*
+ * Strawberry Music Player
+ * Copyright 2020, Jonas Kvinge
+ *
+ * Strawberry is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Strawberry is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Strawberry. If not, see .
+ *
+ */
+
+#ifndef GLOBALSHORTCUTBACKEND_KDE_H
+#define GLOBALSHORTCUTBACKEND_KDE_H
+
+#include "config.h"
+
+#include
+#include
+#include
+#include
+#include
+
+#include "globalshortcutbackend.h"
+#include "globalshortcuts.h"
+
+class QDBusPendingCallWatcher;
+class QAction;
+
+class OrgKdeKGlobalAccelInterface;
+class OrgKdeKglobalaccelComponentInterface;
+
+class GlobalShortcutBackendKDE : public GlobalShortcutBackend {
+ Q_OBJECT
+
+ public:
+ explicit GlobalShortcutBackendKDE(GlobalShortcuts *parent);
+
+ static const char *kKdeService;
+
+ protected:
+ bool DoRegister() override;
+ void DoUnregister() override;
+
+ private:
+ bool RegisterShortcut(const GlobalShortcuts::Shortcut &shortcut);
+ static QStringList GetActionId(const QString &id, const QAction *action);
+ static QList ToIntList(const QList &sequence_list);
+ static QList ToKeySequenceList(const QList &sequence_list);
+
+ private slots:
+ void RegisterFinished(QDBusPendingCallWatcher *watcher);
+ void GlobalShortcutPressed(const QString &component_unique, const QString &shortcut_unique, qlonglong);
+
+ private:
+ static const char *kKdePath;
+
+ OrgKdeKGlobalAccelInterface *interface_;
+ OrgKdeKglobalaccelComponentInterface *component_;
+ QMultiHash actions_;
+};
+
+#endif // GLOBALSHORTCUTBACKEND_KDE_H
diff --git a/src/globalshortcuts/globalshortcuts.cpp b/src/globalshortcuts/globalshortcuts.cpp
index 7e576012..f35e3cbf 100644
--- a/src/globalshortcuts/globalshortcuts.cpp
+++ b/src/globalshortcuts/globalshortcuts.cpp
@@ -39,6 +39,7 @@
#ifdef HAVE_DBUS
# include "globalshortcutbackend-gsd.h"
+# include "globalshortcutbackend-kde.h"
#endif
#if defined(HAVE_X11) || defined(Q_OS_WIN)
# include "globalshortcutbackend-system.h"
@@ -51,9 +52,11 @@
GlobalShortcuts::GlobalShortcuts(QWidget *parent)
: QWidget(parent),
- dbus_backend_(nullptr),
+ gsd_backend_(nullptr),
+ kde_backend_(nullptr),
system_backend_(nullptr),
use_gsd_(true),
+ use_kde_(true),
use_x11_(false)
{
@@ -82,7 +85,8 @@ GlobalShortcuts::GlobalShortcuts(QWidget *parent)
// Create backends - these do the actual shortcut registration
#ifdef HAVE_DBUS
- dbus_backend_ = new GlobalShortcutBackendGSD(this);
+ gsd_backend_ = new GlobalShortcutBackendGSD(this);
+ kde_backend_ = new GlobalShortcutBackendKDE(this);
#endif
#ifdef Q_OS_MACOS
@@ -106,6 +110,7 @@ void GlobalShortcuts::ReloadSettings() {
// The actual shortcuts have been set in our actions for us by the config dialog already - we just need to reread the gnome settings.
use_gsd_ = settings_.value("use_gsd", true).toBool();
+ use_kde_ = settings_.value("use_kde", true).toBool();
use_x11_ = settings_.value("use_x11", false).toBool();
Unregister();
@@ -149,6 +154,16 @@ bool GlobalShortcuts::IsGsdAvailable() const {
}
+bool GlobalShortcuts::IsKdeAvailable() const {
+
+#ifdef HAVE_DBUS
+ return QDBusConnection::sessionBus().interface()->isServiceRegistered(GlobalShortcutBackendKDE::kKdeService);
+#else
+ return false;
+#endif
+
+}
+
bool GlobalShortcuts::IsX11Available() const {
#ifdef HAVE_X11
@@ -160,7 +175,9 @@ bool GlobalShortcuts::IsX11Available() const {
}
void GlobalShortcuts::Register() {
- if (use_gsd_ && dbus_backend_ && dbus_backend_->Register()) return;
+
+ if (use_gsd_ && gsd_backend_ && gsd_backend_->Register()) return;
+ if (use_kde_ && kde_backend_ && kde_backend_->Register()) return;
#ifdef HAVE_X11 // If this system has X11, only use the system backend if X11 is enabled in the global shortcut settings
if (use_x11_) {
#endif
@@ -169,11 +186,15 @@ void GlobalShortcuts::Register() {
#ifdef HAVE_X11
}
#endif
+
}
void GlobalShortcuts::Unregister() {
- if (dbus_backend_ && dbus_backend_->is_active()) dbus_backend_->Unregister();
+
+ if (gsd_backend_ && gsd_backend_->is_active()) gsd_backend_->Unregister();
+ if (kde_backend_ && kde_backend_->is_active()) kde_backend_->Unregister();
if (system_backend_ && system_backend_->is_active()) system_backend_->Unregister();
+
}
bool GlobalShortcuts::IsMacAccessibilityEnabled() const {
diff --git a/src/globalshortcuts/globalshortcuts.h b/src/globalshortcuts/globalshortcuts.h
index 7e9ee879..b2988f33 100644
--- a/src/globalshortcuts/globalshortcuts.h
+++ b/src/globalshortcuts/globalshortcuts.h
@@ -50,6 +50,7 @@ class GlobalShortcuts : public QWidget {
QMap shortcuts() const { return shortcuts_; }
bool IsGsdAvailable() const;
+ bool IsKdeAvailable() const;
bool IsX11Available() const;
bool IsMacAccessibilityEnabled() const;
@@ -87,13 +88,15 @@ class GlobalShortcuts : public QWidget {
Shortcut AddShortcut(const QString &id, const QString &name, const QKeySequence &default_key);
private:
- GlobalShortcutBackend *dbus_backend_;
+ GlobalShortcutBackend *gsd_backend_;
+ GlobalShortcutBackend *kde_backend_;
GlobalShortcutBackend *system_backend_;
QMap shortcuts_;
QSettings settings_;
bool use_gsd_;
+ bool use_kde_;
bool use_x11_;
};
diff --git a/src/settings/shortcutssettingspage.cpp b/src/settings/shortcutssettingspage.cpp
index ba7af0ce..c7d5a47b 100644
--- a/src/settings/shortcutssettingspage.cpp
+++ b/src/settings/shortcutssettingspage.cpp
@@ -73,11 +73,12 @@ GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
#ifdef HAVE_DBUS
- connect(ui_->checkbox_gsd, SIGNAL(clicked(bool)), SLOT(GSDChanged(bool)));
+ connect(ui_->checkbox_gsd, SIGNAL(clicked(bool)), SLOT(ShortcutOptionsChanged()));
+ connect(ui_->checkbox_kde, SIGNAL(clicked(bool)), SLOT(ShortcutOptionsChanged()));
connect(ui_->button_gsd_open, SIGNAL(clicked()), SLOT(OpenGnomeKeybindingProperties()));
#endif
#ifdef HAVE_X11
- connect(ui_->checkbox_x11, SIGNAL(clicked(bool)), SLOT(X11Changed(bool)));
+ connect(ui_->checkbox_x11, SIGNAL(clicked(bool)), SLOT(ShortcutOptionsChanged()));
#endif
#endif // !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
@@ -114,14 +115,23 @@ void GlobalShortcutsSettingsPage::Load() {
connect(ui_->button_macos_open, SIGNAL(clicked()), manager, SLOT(ShowMacAccessibilityDialog()));
if (manager->IsGsdAvailable()) {
- qLog(Debug) << "Gnome (GSD) D-Bus backend is available.";
+ qLog(Debug) << "Gnome (GSD) backend is available.";
ui_->widget_gsd->show();
}
else {
- qLog(Debug) << "Gnome (GSD) D-Bus backend is unavailable.";
+ qLog(Debug) << "Gnome (GSD) backend is unavailable.";
ui_->widget_gsd->hide();
}
+ if (manager->IsKdeAvailable()) {
+ qLog(Debug) << "KDE (KGlobalAccel) backend is available.";
+ ui_->widget_kde->show();
+ }
+ else {
+ qLog(Debug) << "KDE (KGlobalAccel) backend is unavailable.";
+ ui_->widget_kde->hide();
+ }
+
if (manager->IsX11Available()) {
qLog(Debug) << "X11 backend is available.";
ui_->widget_x11->show();
@@ -129,7 +139,6 @@ void GlobalShortcutsSettingsPage::Load() {
else {
qLog(Debug) << "X11 backend is unavailable.";
ui_->widget_x11->hide();
- s.setValue("use_x11", false);
}
for (const GlobalShortcuts::Shortcut &i : manager->shortcuts().values()) {
@@ -149,24 +158,19 @@ void GlobalShortcutsSettingsPage::Load() {
SetShortcut(shortcut.s.id, shortcut.s.action->shortcut());
}
- bool use_gsd = s.value("use_gsd", true).toBool();
if (ui_->widget_gsd->isVisibleTo(this)) {
- ui_->checkbox_gsd->setChecked(use_gsd);
+ ui_->checkbox_gsd->setChecked(s.value("use_gsd", true).toBool());
+ }
+
+ if (ui_->widget_kde->isVisibleTo(this)) {
+ ui_->checkbox_kde->setChecked(s.value("use_kde", true).toBool());
}
- bool use_x11 = s.value("use_x11", false).toBool();
if (ui_->widget_x11->isVisibleTo(this)) {
- ui_->checkbox_x11->setChecked(use_x11);
+ ui_->checkbox_x11->setChecked(s.value("use_x11", false).toBool());
}
-#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
-#ifdef HAVE_DBUS
- GSDChanged(true);
-#endif
-#ifdef HAVE_X11
- X11Changed(true);
-#endif
-#endif
+ ShortcutOptionsChanged();
ui_->widget_macos->setVisible(!manager->IsMacAccessibilityEnabled());
#ifdef Q_OS_MACOS
@@ -195,6 +199,7 @@ void GlobalShortcutsSettingsPage::Save() {
}
s.setValue("use_gsd", ui_->checkbox_gsd->isChecked());
+ s.setValue("use_kde", ui_->checkbox_kde->isChecked());
s.setValue("use_x11", ui_->checkbox_x11->isChecked());
s.endGroup();
@@ -203,50 +208,24 @@ void GlobalShortcutsSettingsPage::Save() {
}
-void GlobalShortcutsSettingsPage::X11Changed(bool) {
+void GlobalShortcutsSettingsPage::ShortcutOptionsChanged() {
- if (!ui_->widget_x11->isVisibleTo(this)) return;
+ bool configure_shortcuts = (ui_->widget_kde->isVisibleTo(this) && ui_->checkbox_kde->isChecked()) ||
+ (ui_->widget_x11->isVisibleTo(this) && ui_->checkbox_x11->isChecked());
- if (ui_->checkbox_x11->isChecked()) {
- ui_->list->setEnabled(true);
- ui_->shortcut_options->setEnabled(true);
+ ui_->list->setEnabled(configure_shortcuts);
+ ui_->shortcut_options->setEnabled(configure_shortcuts);
+
+ if (ui_->widget_x11->isVisibleTo(this) && ui_->checkbox_x11->isChecked()) {
+ ui_->widget_warning->show();
X11Warning();
}
else {
- ui_->list->setEnabled(false);
- ui_->shortcut_options->setEnabled(false);
ui_->widget_warning->hide();
}
}
-void GlobalShortcutsSettingsPage::GSDChanged(bool) {
-
- if (!ui_->widget_gsd->isVisibleTo(this)) return;
-
- if (ui_->checkbox_gsd->isChecked()) {
- if (ui_->checkbox_x11->isEnabled()) {
- ui_->checkbox_x11->setEnabled(false);
- }
- if (ui_->checkbox_x11->isChecked()) {
- ui_->checkbox_x11->setChecked(false);
- }
- ui_->list->setEnabled(false);
- ui_->shortcut_options->setEnabled(false);
- ui_->widget_warning->hide();
- }
- else {
- if (!ui_->checkbox_x11->isEnabled()) {
- ui_->checkbox_x11->setEnabled(true);
- if (ui_->checkbox_x11->isChecked()) {
- ui_->list->setEnabled(true);
- ui_->shortcut_options->setEnabled(true);
- X11Warning();
- }
- }
- }
-
-}
void GlobalShortcutsSettingsPage::OpenGnomeKeybindingProperties() {
if (!QProcess::startDetached("gnome-keybinding-properties", QStringList())) {
@@ -324,13 +303,11 @@ void GlobalShortcutsSettingsPage::X11Warning() {
if (de_.toLower() == "kde" || de_.toLower() == "gnome" || de_.toLower() == "x-cinnamon") {
QString text(tr("Using X11 shortcuts on %1 is not recommended and can cause keyboard to become unresponsive!").arg(de_));
if (de_.toLower() == "kde")
- text += tr(" Shortcuts on %1 are usually used through MPRIS D-Bus and should be configured in %1 settings instead.").arg(de_);
+ text += tr(" Shortcuts on %1 are usually used through MPRIS and KGlobalAccel.").arg(de_);
else if (de_.toLower() == "gnome")
- text += tr(" Shortcuts on %1 are usually used through GSD D-Bus and should be configured in gnome-settings-daemon instead.").arg(de_);
+ text += tr(" Shortcuts on %1 are usually used through GSD and should be configured in gnome-settings-daemon instead.").arg(de_);
else if (de_.toLower() == "x-cinnamon")
- text += tr(" Shortcuts on %1 are usually used through GSD D-Bus and should be configured in cinnamon-settings-daemon instead.").arg(de_);
- else
- text += tr(" Shortcuts should be configured in %1 settings instead.").arg(de_);
+ text += tr(" Shortcuts on %1 are usually used through GSD and should be configured in cinnamon-settings-daemon instead.").arg(de_);
ui_->label_warn_text->setText(text);
ui_->widget_warning->show();
}
diff --git a/src/settings/shortcutssettingspage.h b/src/settings/shortcutssettingspage.h
index c4a71b61..f0a91383 100644
--- a/src/settings/shortcutssettingspage.h
+++ b/src/settings/shortcutssettingspage.h
@@ -55,8 +55,7 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
void Save() override;
private slots:
- void X11Changed(bool);
- void GSDChanged(bool);
+ void ShortcutOptionsChanged();
void OpenGnomeKeybindingProperties();
void ItemClicked(QTreeWidgetItem*);
diff --git a/src/settings/shortcutssettingspage.ui b/src/settings/shortcutssettingspage.ui
index 229916b8..edbccc02 100644
--- a/src/settings/shortcutssettingspage.ui
+++ b/src/settings/shortcutssettingspage.ui
@@ -42,7 +42,7 @@
- Use Gnome (GSD) D-Bus shortcut keys
+ Use Gnome (GSD) shortcuts when available
@@ -56,6 +56,31 @@
+ -
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ Use KDE (KGlobalAccel) shortcuts when available
+
+
+
+
+
+
-
@@ -83,7 +108,7 @@
- Use X11's shortcut keys
+ Use X11 shortcuts when available