You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
959 B
34 lines
959 B
/* |
|
This file is part of the KDE project. |
|
|
|
SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org> |
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later |
|
*/ |
|
|
|
#include <KConfig> |
|
#include <KConfigGroup> |
|
#include <KWindowSystem> |
|
#include <QProcess> |
|
|
|
extern "C" { |
|
Q_DECL_EXPORT void kcminit() |
|
{ |
|
KConfig cfg(QStringLiteral("kcmfonts")); |
|
KConfigGroup fontsCfg(&cfg, "General"); |
|
|
|
QString fontDpiKey = KWindowSystem::isPlatformWayland() ? QStringLiteral("forceFontDPIWayland") : QStringLiteral("forceFontDPI"); |
|
|
|
if (!fontsCfg.hasKey(fontDpiKey)) { |
|
return; |
|
} |
|
|
|
const QByteArray input = "Xft.dpi: " + QByteArray::number(fontsCfg.readEntry(fontDpiKey, 0)); |
|
QProcess p; |
|
p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")}); |
|
p.setProcessChannelMode(QProcess::ForwardedChannels); |
|
p.write(input); |
|
p.closeWriteChannel(); |
|
p.waitForFinished(-1); |
|
} |
|
}
|
|
|