Skip to content
Snippets Groups Projects
Commit ec53bf51 authored by akiraohgaki's avatar akiraohgaki
Browse files

Apply plasma desktoptheme with kde

parent bfc86dda
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,8 @@ bool SystemHandler::isApplicableType(const QString &installType) const
if (desktop == "kde") {
applicableTypes << "wallpapers"
<< "icons"
<< "cursors";
<< "cursors"
<< "plasma_desktopthemes";
}
else if (desktop == "gnome") {
applicableTypes << "wallpapers"
......@@ -130,6 +131,9 @@ bool SystemHandler::applyFile(const QString &path, const QString &installType) c
else if (installType == "cursors") {
return applyKdeCursor(path);
}
else if (installType == "plasma_desktopthemes") {
return applyKdePlasmaDesktoptheme(path);
}
}
else if (desktop == "gnome") {
if (installType == "wallpapers") {
......@@ -237,6 +241,31 @@ bool SystemHandler::applyKdeCursor(const QString &path) const
return true;
}
bool SystemHandler::applyKdePlasmaDesktoptheme(const QString &path) const
{
auto themeName = QFileInfo(path).fileName();
auto message = QDBusMessage::createMethodCall("org.kde.plasmashell", "/PlasmaShell", "org.kde.PlasmaShell", "evaluateScript");
QString script;
QTextStream out(&script);
out << "var c = ConfigFile('plasmarc');"
<< "c.group = 'Theme';"
<< "c.writeEntry('name', '" + themeName + "');";
QVariantList arguments;
arguments << QVariant(script);
message.setArguments(arguments);
auto reply = QDBusConnection::sessionBus().call(message);
if (reply.type() == QDBusMessage::ErrorMessage) {
qWarning() << reply.errorMessage();
return false;
}
return true;
}
bool SystemHandler::applyGnomeWallpaper(const QString &path) const
{
QStringList arguments{"set", "org.gnome.desktop.background", "picture-uri", "file://" + path};
......
......@@ -26,6 +26,7 @@ private:
bool applyKdeWallpaper(const QString &path) const;
bool applyKdeIcon(const QString &path) const;
bool applyKdeCursor(const QString &path) const;
bool applyKdePlasmaDesktoptheme(const QString &path) const;
bool applyGnomeWallpaper(const QString &path) const;
bool applyGnomeIcon(const QString &path) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment