File indexing completed on 2024-05-19 05:38:05
0001 /* 0002 This file is part of the KDE project. 0003 0004 SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #include "krdb.h" 0010 #include <KConfig> 0011 #include <KConfigGroup> 0012 #include <KWindowSystem> 0013 #include <QProcess> 0014 0015 using namespace Qt::StringLiterals; 0016 0017 extern "C" { 0018 Q_DECL_EXPORT void kcminit() 0019 { 0020 KConfig cfg(QStringLiteral("kcmfonts")); 0021 KConfigGroup fontsCfg(&cfg, u"General"_s); 0022 0023 const int dpi = xftDpi(); 0024 if (dpi <= 0) { 0025 return; 0026 } 0027 0028 const QByteArray input = "Xft.dpi: " + QByteArray::number(dpi); 0029 QProcess p; 0030 p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")}); 0031 p.setProcessChannelMode(QProcess::ForwardedChannels); 0032 p.write(input); 0033 p.closeWriteChannel(); 0034 p.waitForFinished(-1); 0035 } 0036 }