forked from Qortal/Brooklyn
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.
35 lines
964 B
35 lines
964 B
/* |
|
This file is part of the KDE project. |
|
|
|
SPDX-FileCopyrightText: 2021 David Edmundson <[email protected]> |
|
|
|
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"); |
|
|
|
const int dpi = fontsCfg.readEntry(fontDpiKey, 0); |
|
if (dpi <= 0) { |
|
return; |
|
} |
|
|
|
const QByteArray input = "Xft.dpi: " + QByteArray::number(dpi); |
|
QProcess p; |
|
p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")}); |
|
p.setProcessChannelMode(QProcess::ForwardedChannels); |
|
p.write(input); |
|
p.closeWriteChannel(); |
|
p.waitForFinished(-1); |
|
} |
|
}
|
|
|