Commit 56449c24 authored by Filip Fila's avatar Filip Fila 🌆 Committed by Nate Graham

Allow for easier syncing of Plasma font

Summary:
Currently the user needs to have a fonts replacment file in `/.config/fontconfig/conf.d/` if they want to sync their Plasma font with SDDM.

That's not a good solution because users simply don't have this file or wouldn't know how to create it themselves.

In conjuction with https://github.com/sddm/sddm/pull/1191 this patch removes the need for additional user effort and allows for easy font syncing by writing the Plasma font value to the SDDM config file.

Test Plan: Dependency:  https://github.com/sddm/sddm/pull/1191

Reviewers: ngraham, #plasma, davidedmundson

Reviewed By: ngraham

Subscribers: davidre, plasma-devel

Tags: #plasma

Maniphest Tasks: T12710

Differential Revision: https://phabricator.kde.org/D23257

(cherry picked from commit 8171db27)

BUG: 432930
FIXED-IN: 5.21.1
parent dddd3538
......@@ -186,6 +186,11 @@ void SddmKcm::synchronizeSettings()
KConfigGroup numLockConfigGroup(&numLockConfig, "Keyboard");
QString numLock = numLockConfigGroup.readEntry("NumLock");
// Syncing the font only works with SDDM >= 0.19, but will not have a negative effect with older versions
KConfig plasmaFontConfig(QStringLiteral("kdeglobals"));
KConfigGroup plasmaFontGroup(&plasmaFontConfig, "General");
QString plasmaFont = plasmaFontGroup.readEntry("font");
// define paths
const QString fontconfigPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("fontconfig"), QStandardPaths::LocateDirectory);
const QString kdeglobalsPath = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QStringLiteral("kdeglobals"));
......@@ -222,6 +227,13 @@ void SddmKcm::synchronizeSettings()
qDebug() << "Cannot find NumLock value.";
}
if (!plasmaFont.isEmpty()) {
args[QStringLiteral("kde_settings.conf/Theme/Font")] = plasmaFont;
}
else {
qDebug() << "Cannot find Plasma font value.";
}
if (!fontconfigPath.isEmpty()) {
args[QStringLiteral("fontconfig")] = fontconfigPath;
} else {
......@@ -284,6 +296,8 @@ void SddmKcm::resetSyncronizedSettings()
args[QStringLiteral("kde_settings.conf/General/Numlock")] = QVariant();
args[QStringLiteral("kde_settings.conf/Theme/Font")] = QVariant();
KAuth::Action resetAction(QStringLiteral("org.kde.kcontrol.kcmsddm.reset"));
resetAction.setHelperId(QStringLiteral("org.kde.kcontrol.kcmsddm"));
resetAction.setArguments(args);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment