Support Xft settings

pull/9/head
reionwong 4 years ago
parent a5c0514b77
commit e3d8c2cd54

@ -196,13 +196,20 @@ void Application::initXResource()
int fontDpi = 96 * scaleFactor;
QString cursorTheme = settings.value("CursorTheme", "default").toString();
int cursorSize = settings.value("CursorSize", 24).toInt() * scaleFactor;
int xftAntialias = settings.value("XftAntialias", 1).toBool();
QString xftHintStyle = settings.value("XftHintStyle", "hintslight").toString();
const QString datas = QString("Xft.dpi: %1\n"
"Xcursor.theme: %2\n"
"Xcursor.size: %3")
"Xcursor.size: %3\n"
"Xft.antialias: %4\n"
"Xft.hintstyle: %5\n"
"Xft.rgba: rgb")
.arg(fontDpi)
.arg(cursorTheme)
.arg(cursorSize);
.arg(cursorSize)
.arg(xftAntialias)
.arg(xftHintStyle);
QProcess p;
p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});

@ -38,6 +38,8 @@
<arg name="type" type="i" direction="in"/>
</method>
<method name="applyXResources"></method>
<property name="isDarkMode" type="b" access="read"/>
<property name="darkModeDimsWallpaer" type="b" access="read"/>
<property name="systemFont" type="s" access="read"/>

@ -131,7 +131,7 @@ void ThemeManager::setCursorTheme(const QString &theme)
if (m_cursorTheme != theme) {
m_cursorTheme = theme;
m_settings->setValue("CursorTheme", m_cursorTheme);
applyXResource();
applyXResources();
applyCursor();
emit cursorThemeChanged();
}
@ -147,7 +147,7 @@ void ThemeManager::setCursorSize(int size)
if (m_cursorSize != size) {
m_cursorSize = size;
m_settings->setValue("CursorSize", m_cursorSize);
applyXResource();
applyXResources();
applyCursor();
emit cursorSizeChanged();
}
@ -196,7 +196,7 @@ void ThemeManager::setDevicePixelRatio(qreal ratio)
m_settings->setValue(s_devicePixelRatio, ratio);
m_settings->setValue("forceFontDPI", fontDpi);
m_settings->sync();
applyXResource();
applyXResources();
}
QString ThemeManager::wallpaper()
@ -258,17 +258,26 @@ void ThemeManager::initGtkConfig()
settings.sync();
}
void ThemeManager::applyXResource()
void ThemeManager::applyXResources()
{
m_settings->sync();
qreal scaleFactor = this->devicePixelRatio();
int fontDpi = 96 * scaleFactor;
int xftAntialias = m_settings->value("XftAntialias", 1).toBool();
QString xftHintStyle = m_settings->value("XftHintStyle").toString();
const QString datas = QString("Xft.dpi: %1\n"
"Xcursor.theme: %2\n"
"Xcursor.size: %3")
"Xcursor.size: %3\n"
"Xft.antialias: %4\n"
"Xft.hintstyle: %5")
.arg(fontDpi)
.arg(m_cursorTheme)
.arg(m_cursorSize * scaleFactor);
.arg(m_cursorSize * scaleFactor)
.arg(xftAntialias)
.arg(xftHintStyle);
QProcess p;
p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});

@ -79,7 +79,7 @@ public:
void setCursorSize(int size);
void initGtkConfig();
void applyXResource();
void applyXResources();
void applyCursor();
signals:

Loading…
Cancel
Save