main: directly set Xwayland scale, instead of starting a KCM to do the same
This commit is contained in:
parent
3654b76ec2
commit
2eb72d0820
1 changed files with 9 additions and 2 deletions
11
src/main.cpp
11
src/main.cpp
|
@ -383,8 +383,15 @@ void Application::setXwaylandScale(qreal scale)
|
|||
{
|
||||
if (scale != m_xwaylandScale) {
|
||||
m_xwaylandScale = scale;
|
||||
// rerun the fonts kcm init that does the appropriate xrdb call with the new settings
|
||||
QProcess::startDetached("kcminit", {"kcm_fonts", "kcm_style"});
|
||||
// change the font dpi to match
|
||||
const int dpi = std::round(scale * 96);
|
||||
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);
|
||||
Q_EMIT xwaylandScaleChanged();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue