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

Add function to set schema with gsettings

parent c8d6e8bd
No related branches found
No related tags found
No related merge requests found
...@@ -262,38 +262,34 @@ bool SystemHandler::applyKdeAuroraeTheme(const QString &path) const ...@@ -262,38 +262,34 @@ bool SystemHandler::applyKdeAuroraeTheme(const QString &path) const
return false; return false;
} }
bool SystemHandler::setSchemaWithGsettings(const QString &schema, const QString &key, const QString &value) const
{
return QProcess::startDetached("gsettings", QStringList() << "set" << schema << key << value);
}
bool SystemHandler::applyGnomeWallpaper(const QString &path) const bool SystemHandler::applyGnomeWallpaper(const QString &path) const
{ {
QStringList arguments{"set", "org.gnome.desktop.background", "picture-uri", "file://" + path}; return setSchemaWithGsettings("org.gnome.desktop.background", "picture-uri", "file://" + path);
return QProcess::startDetached("gsettings", arguments);
} }
bool SystemHandler::applyGnomeIcon(const QString &path) const bool SystemHandler::applyGnomeIcon(const QString &path) const
{ {
auto themeName = QFileInfo(path).fileName(); return setSchemaWithGsettings("org.gnome.desktop.interface", "icon-theme", QFileInfo(path).fileName());
QStringList arguments{"set", "org.gnome.desktop.interface", "icon-theme", themeName};
return QProcess::startDetached("gsettings", arguments);
} }
bool SystemHandler::applyGnomeCursor(const QString &path) const bool SystemHandler::applyGnomeCursor(const QString &path) const
{ {
auto themeName = QFileInfo(path).fileName(); return setSchemaWithGsettings("org.gnome.desktop.interface", "cursor-theme", QFileInfo(path).fileName());
QStringList arguments{"set", "org.gnome.desktop.interface", "cursor-theme", themeName};
return QProcess::startDetached("gsettings", arguments);
} }
bool SystemHandler::applyGnomeGtk3Theme(const QString &path) const bool SystemHandler::applyGnomeGtk3Theme(const QString &path) const
{ {
auto themeName = QFileInfo(path).fileName(); return setSchemaWithGsettings("org.gnome.desktop.interface", "gtk-theme", QFileInfo(path).fileName());
QStringList arguments{"set", "org.gnome.desktop.interface", "gtk-theme", themeName};
return QProcess::startDetached("gsettings", arguments);
} }
bool SystemHandler::applyGnomeGnomeShellTheme(const QString &path) const bool SystemHandler::applyGnomeGnomeShellTheme(const QString &path) const
{ {
auto themeName = QFileInfo(path).fileName(); return setSchemaWithGsettings("org.gnome.shell.extensions.user-theme", "name", QFileInfo(path).fileName());
QStringList arguments{"set", "org.gnome.shell.extensions.user-theme", "name", themeName};
return QProcess::startDetached("gsettings", arguments);
} }
bool SystemHandler::setPropertyWithXfconf(const QString &channel, const QString &property, const QDBusVariant &value) const bool SystemHandler::setPropertyWithXfconf(const QString &channel, const QString &property, const QDBusVariant &value) const
......
...@@ -34,6 +34,7 @@ private: ...@@ -34,6 +34,7 @@ private:
bool applyKdePlasmaDesktoptheme(const QString &path) const; bool applyKdePlasmaDesktoptheme(const QString &path) const;
bool applyKdeAuroraeTheme(const QString &path) const; bool applyKdeAuroraeTheme(const QString &path) const;
bool setSchemaWithGsettings(const QString &schema, const QString &key, const QString &value) const;
bool applyGnomeWallpaper(const QString &path) const; bool applyGnomeWallpaper(const QString &path) const;
bool applyGnomeIcon(const QString &path) const; bool applyGnomeIcon(const QString &path) const;
bool applyGnomeCursor(const QString &path) const; bool applyGnomeCursor(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