diff --git a/debian/changelog b/debian/changelog index 76d1a19..1f06772 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +lxqt-globalkeys (0.14.1-0ubuntu2) eoan; urgency=medium + + * Add XDG support. + * Bump Standards-Version to 4.4.0, no changes needed. + + -- Walter Lapchynski Tue, 20 Aug 2019 22:46:08 -0700 + lxqt-globalkeys (0.14.1-0ubuntu1) disco; urgency=medium * New upstream release. diff --git a/debian/control b/debian/control index 67888d1..9ed7ee0 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,7 @@ Build-Depends: debhelper (>= 12), libqt5svg5-dev, libqt5x11extras5-dev, libx11-dev -Standards-Version: 4.3.0 +Standards-Version: 4.4.0 Vcs-Browser: https://phab.lubuntu.me/source/lxqt-globalkeys/ Vcs-Git: https://phab.lubuntu.me/source/lxqt-globalkeys.git XS-Debian-Vcs-Browser: https://salsa.debian.org/lxqt-team/lxqt-globalkeys diff --git a/debian/lxqt-globalkeys.install b/debian/lxqt-globalkeys.install index 6984d6d..2bdce90 100644 --- a/debian/lxqt-globalkeys.install +++ b/debian/lxqt-globalkeys.install @@ -6,5 +6,5 @@ usr/bin/lxqt-config-globalkeyshortcuts usr/share/applications/lxqt-config-globalkeyshortcuts.desktop # configuration and autostart from lxqt-common -etc/xdg/lxqt/globalkeyshortcuts.conf +usr/share/lxqt/globalkeyshortcuts.conf etc/xdg/autostart/lxqt-globalkeyshortcuts.desktop diff --git a/debian/patches/move-config.patch b/debian/patches/move-config.patch new file mode 100644 index 0000000..1b5b9a4 --- /dev/null +++ b/debian/patches/move-config.patch @@ -0,0 +1,15 @@ +Description: move shortcuts config fom /etc/xdg/lxqt to /usr/share/lxqt +Author: Alf Gaida +Applied-Upstream: +https://github.com/lxqt/lxqt-globalkeys/commit/cbce84c6703caa0835765fca22542826d575ca1f.patch +Last-Update: 2019-08-20 +--- a/xdg/CMakeLists.txt ++++ b/xdg/CMakeLists.txt +@@ -1,6 +1,6 @@ + # install default config files to /etc/xdg + install(FILES + globalkeyshortcuts.conf +- DESTINATION "${LXQT_ETC_XDG_DIR}/lxqt" ++ DESTINATION "${CMAKE_INSTALL_DATADIR}/lxqt" + COMPONENT Runtime + ) diff --git a/debian/patches/series b/debian/patches/series index 696c5fa..18a9428 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,3 @@ complete-config-file.patch +move-config.patch +use-xdg-hierarchy.patch diff --git a/debian/patches/use-xdg-hierarchy.patch b/debian/patches/use-xdg-hierarchy.patch new file mode 100644 index 0000000..f20d21f --- /dev/null +++ b/debian/patches/use-xdg-hierarchy.patch @@ -0,0 +1,290 @@ +Description: Use XDG hierarchy if no config file given +Author: Palo Kisa +Applied-Upstream: +https://github.com/lxqt/lxqt-globalkeys/pull/60/commits/efc2933ec9e8b2f85e2e6eea1d27f5bb3d08f1ba +Last-Update: 2019-08-17 +--- a/daemon/core.cpp ++++ b/daemon/core.cpp +@@ -400,6 +400,7 @@ Core::Core(bool useSyslog, bool minLogLe + , mAllowGrabMiscKeypad(true) + , mAllowGrabPrintable(false) + ++ , mSettings{new QSettings{QStringLiteral("lxqt"), QStringLiteral("globalkeyshortcuts")}} + , mSaveAllowed(false) + + , mShortcutGrabTimeout(new QTimer(this)) +@@ -411,8 +412,6 @@ Core::Core(bool useSyslog, bool minLogLe + initBothPipeEnds(mX11RequestPipe); + initBothPipeEnds(mX11ResponsePipe); + +- mConfigFile = QFile::decodeName(qgetenv("HOME")) + QStringLiteral("/.config/global_key_shortcutss.ini"); +- + try + { + error_t c_error; +@@ -465,18 +464,17 @@ Core::Core(bool useSyslog, bool minLogLe + + + { +- size_t fm = configFiles.size(); +- for (size_t fi = 0; fi < fm; ++fi) ++ // use regular XDG hierarchy (implemented by QSettings) if no config file given on command line ++ auto config_file_i = configFiles.cbegin(); ++ if (config_file_i != configFiles.cend()) ++ mSettings.reset(new QSettings{*config_file_i, QSettings::IniFormat}); ++ for (bool finished = false; !finished; ) + { +- mConfigFile = configFiles[fi]; +- +- QSettings settings(mConfigFile, QSettings::IniFormat, this); +- + QString iniValue; + + if (!minLogLevelSet) + { +- iniValue = settings.value(/* General/ */QStringLiteral("LogLevel")).toString(); ++ iniValue = mSettings->value(/* General/ */QStringLiteral("LogLevel")).toString(); + if (!iniValue.isEmpty()) + { + if (iniValue == QLatin1String("error")) +@@ -504,7 +502,7 @@ Core::Core(bool useSyslog, bool minLogLe + + if (!multipleActionsBehaviourSet) + { +- iniValue = settings.value(/* General/ */QStringLiteral("MultipleActionsBehaviour")).toString(); ++ iniValue = mSettings->value(/* General/ */QStringLiteral("MultipleActionsBehaviour")).toString(); + if (!iniValue.isEmpty()) + { + if (iniValue == firstStr) +@@ -526,18 +524,18 @@ Core::Core(bool useSyslog, bool minLogLe + } + } + +- mAllowGrabLocks = settings.value(/* General/ */QStringLiteral("AllowGrabLocks"), mAllowGrabLocks).toBool(); +- mAllowGrabBaseSpecial = settings.value(/* General/ */QStringLiteral("AllowGrabBaseSpecial"), mAllowGrabBaseSpecial).toBool(); +- mAllowGrabMiscSpecial = settings.value(/* General/ */QStringLiteral("AllowGrabMiscSpecial"), mAllowGrabMiscSpecial).toBool(); +- mAllowGrabBaseKeypad = settings.value(/* General/ */QStringLiteral("AllowGrabBaseKeypad"), mAllowGrabBaseKeypad).toBool(); +- mAllowGrabMiscKeypad = settings.value(/* General/ */QStringLiteral("AllowGrabMiscKeypad"), mAllowGrabMiscKeypad).toBool(); ++ mAllowGrabLocks = mSettings->value(/* General/ */QStringLiteral("AllowGrabLocks"), mAllowGrabLocks).toBool(); ++ mAllowGrabBaseSpecial = mSettings->value(/* General/ */QStringLiteral("AllowGrabBaseSpecial"), mAllowGrabBaseSpecial).toBool(); ++ mAllowGrabMiscSpecial = mSettings->value(/* General/ */QStringLiteral("AllowGrabMiscSpecial"), mAllowGrabMiscSpecial).toBool(); ++ mAllowGrabBaseKeypad = mSettings->value(/* General/ */QStringLiteral("AllowGrabBaseKeypad"), mAllowGrabBaseKeypad).toBool(); ++ mAllowGrabMiscKeypad = mSettings->value(/* General/ */QStringLiteral("AllowGrabMiscKeypad"), mAllowGrabMiscKeypad).toBool(); + +- const auto sections = settings.childGroups(); ++ const auto sections = mSettings->childGroups(); + for(const QString §ion : sections) + { + if (section != QLatin1String("General")) + { +- settings.beginGroup(section); ++ mSettings->beginGroup(section); + + QString shortcut = section; + int pos = shortcut.indexOf(QLatin1Char('.')); +@@ -548,32 +546,32 @@ Core::Core(bool useSyslog, bool minLogLe + + qulonglong id = 0ull; + +- bool enabled = settings.value(EnabledKey, true).toBool(); ++ bool enabled = mSettings->value(EnabledKey, true).toBool(); + +- QString description = settings.value(CommentKey).toString(); ++ QString description = mSettings->value(CommentKey).toString(); + +- if (settings.contains(ExecKey)) ++ if (mSettings->contains(ExecKey)) + { +- QStringList values = settings.value(ExecKey).toStringList(); ++ QStringList values = mSettings->value(ExecKey).toStringList(); + id = registerCommandAction(shortcut, values[0], values.mid(1), description); + } + else + { +- iniValue = settings.value(pathKey).toString(); ++ iniValue = mSettings->value(pathKey).toString(); + if (!iniValue.isEmpty()) + { + QString path = iniValue; + +- if (settings.contains(interfaceKey)) ++ if (mSettings->contains(interfaceKey)) + { +- QString interface = settings.value(interfaceKey).toString(); ++ QString interface = mSettings->value(interfaceKey).toString(); + +- iniValue = settings.value(serviceKey).toString(); ++ iniValue = mSettings->value(serviceKey).toString(); + if (!iniValue.isEmpty()) + { + QString service = iniValue; + +- iniValue = settings.value(methodKey).toString(); ++ iniValue = mSettings->value(methodKey).toString(); + if (!iniValue.isEmpty()) + { + QString method = iniValue; +@@ -593,12 +591,16 @@ Core::Core(bool useSyslog, bool minLogLe + enableActionNonGuarded(id, enabled); + } + +- settings.endGroup(); ++ mSettings->endGroup(); + } + } ++ finished = config_file_i == configFiles.cend(); ++ if (!finished) ++ mSettings.reset(new QSettings{*config_file_i++, QSettings::IniFormat}); ++ + } + } +- log(LOG_DEBUG, "Config file: %s", qPrintable(mConfigFile)); ++ log(LOG_DEBUG, "Config file: %s", qPrintable(mSettings->fileName())); + + + log(LOG_DEBUG, "MinLogLevel: %s", strLevel(mMinLogLevel)); +@@ -730,37 +732,37 @@ void Core::saveConfig() + return; + } + +- QSettings settings(mConfigFile, QSettings::IniFormat); +- +- settings.clear(); ++ QVariant windowSize = mSettings->value(QStringLiteral("WindowSize")); ++ mSettings->clear(); ++ mSettings->setValue(QStringLiteral("WindowSize"), windowSize); + + switch (mMultipleActionsBehaviour) + { + case MULTIPLE_ACTIONS_BEHAVIOUR_FIRST: +- settings.setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), firstStr); ++ mSettings->setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), firstStr); + break; + + case MULTIPLE_ACTIONS_BEHAVIOUR_LAST: +- settings.setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), lastStr); ++ mSettings->setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), lastStr); + break; + + case MULTIPLE_ACTIONS_BEHAVIOUR_ALL: +- settings.setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), allStr); ++ mSettings->setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), allStr); + break; + + case MULTIPLE_ACTIONS_BEHAVIOUR_NONE: +- settings.setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), noneStr); ++ mSettings->setValue(/* General/ */QLatin1String("MultipleActionsBehaviour"), noneStr); + break; + + default: + ; + } + +- settings.setValue(/* General/ */QLatin1String("AllowGrabLocks"), mAllowGrabLocks); +- settings.setValue(/* General/ */QLatin1String("AllowGrabBaseSpecial"), mAllowGrabBaseSpecial); +- settings.setValue(/* General/ */QLatin1String("AllowGrabMiscSpecial"), mAllowGrabMiscSpecial); +- settings.setValue(/* General/ */QLatin1String("AllowGrabBaseKeypad"), mAllowGrabBaseKeypad); +- settings.setValue(/* General/ */QLatin1String("AllowGrabMiscKeypad"), mAllowGrabMiscKeypad); ++ mSettings->setValue(/* General/ */QLatin1String("AllowGrabLocks"), mAllowGrabLocks); ++ mSettings->setValue(/* General/ */QLatin1String("AllowGrabBaseSpecial"), mAllowGrabBaseSpecial); ++ mSettings->setValue(/* General/ */QLatin1String("AllowGrabMiscSpecial"), mAllowGrabMiscSpecial); ++ mSettings->setValue(/* General/ */QLatin1String("AllowGrabBaseKeypad"), mAllowGrabBaseKeypad); ++ mSettings->setValue(/* General/ */QLatin1String("AllowGrabMiscKeypad"), mAllowGrabMiscKeypad); + + ShortcutAndActionById::const_iterator lastShortcutAndActionById = mShortcutAndActionById.constEnd(); + for (ShortcutAndActionById::const_iterator shortcutAndActionById = mShortcutAndActionById.constBegin(); shortcutAndActionById != lastShortcutAndActionById; ++shortcutAndActionById) +@@ -768,31 +770,31 @@ void Core::saveConfig() + const BaseAction *action = shortcutAndActionById.value().second; + QString section = shortcutAndActionById.value().first + QLatin1Char('.') + QString::number(shortcutAndActionById.key()); + +- settings.beginGroup(section); ++ mSettings->beginGroup(section); + +- settings.setValue(EnabledKey, action->isEnabled()); +- settings.setValue(CommentKey, action->description()); ++ mSettings->setValue(EnabledKey, action->isEnabled()); ++ mSettings->setValue(CommentKey, action->description()); + + if (!strcmp(action->type(), CommandAction::id())) + { + const CommandAction *commandAction = dynamic_cast(action); +- settings.setValue(ExecKey, QVariant(QStringList() << commandAction->command() += commandAction->args())); ++ mSettings->setValue(ExecKey, QVariant(QStringList() << commandAction->command() += commandAction->args())); + } + else if (!strcmp(action->type(), MethodAction::id())) + { + const MethodAction *methodAction = dynamic_cast(action); +- settings.setValue(serviceKey, methodAction->service()); +- settings.setValue(pathKey, methodAction->path().path()); +- settings.setValue(interfaceKey, methodAction->interface()); +- settings.setValue(methodKey, methodAction->method()); ++ mSettings->setValue(serviceKey, methodAction->service()); ++ mSettings->setValue(pathKey, methodAction->path().path()); ++ mSettings->setValue(interfaceKey, methodAction->interface()); ++ mSettings->setValue(methodKey, methodAction->method()); + } + else if (!strcmp(action->type(), ClientAction::id())) + { + const ClientAction *clientAction = dynamic_cast(action); +- settings.setValue(pathKey, clientAction->path().path()); ++ mSettings->setValue(pathKey, clientAction->path().path()); + } + +- settings.endGroup(); ++ mSettings->endGroup(); + } + } + +--- a/daemon/core.h ++++ b/daemon/core.h +@@ -58,6 +58,7 @@ class NativeAdaptor; + class DBusProxy; + class BaseAction; + class QDBusServiceWatcher; ++class QSettings; + + template + class QOrderedSet : public QMap +@@ -242,7 +243,7 @@ private: + bool mAllowGrabMiscKeypad; + bool mAllowGrabPrintable; + +- QString mConfigFile; ++ QScopedPointer mSettings; + bool mSaveAllowed; + + QTimer *mShortcutGrabTimeout; +--- a/daemon/main.cpp ++++ b/daemon/main.cpp +@@ -43,8 +43,6 @@ + #include + #include // for basename() + +-#define DEFAULT_CONFIG ".config/lxqt/globalkeyshortcuts.conf" +- + + int main(int argc, char *argv[]) + { +@@ -212,7 +210,7 @@ int main(int argc, char *argv[]) + " --config-file=FILENAME\n" + " Use config file FILENAME. Can be used several times.\n" + " The last loaded file is used to save settings.\n" +- " Default is: ${HOME}/" DEFAULT_CONFIG "\n" ++ " Default is: ${XDG_CONFIG_HOME}/lxqt/globalkeyshortcuts.conf\n" + "\n" + " --help\n" + " -h\n" +@@ -235,13 +233,6 @@ int main(int argc, char *argv[]) + int ignoreIt = chdir((home && *home) ? home : "/"); + (void)ignoreIt; + +- if (configFiles.empty() && home && *home) +- { +- if( ! QFile::exists(QString::fromLocal8Bit(home) + QLatin1Char('/') + QLatin1String(DEFAULT_CONFIG)) ) //Load default settings +- configFiles.push_back(QStringLiteral("/etc/xdg/lxqt/globalkeyshortcuts.conf")); +- configFiles.push_back(QString::fromLocal8Bit(home) + QLatin1Char('/') + QLatin1String(DEFAULT_CONFIG)); +- } +- + LXQt::Application app(argc, argv); + + Core core(runAsDaemon || useSyslog, minLogLevelSet, minLogLevel, configFiles, multipleActionsBehaviourSet, multipleActionsBehaviour);