diff --git a/app/src/handlers/systemhandler.cpp b/app/src/handlers/systemhandler.cpp index a5c3d10658d2dc7a79c9a6ded69179bd13d5977b..82e57564f49c03057e3a5eb4e7087d38b4505a99 100644 --- a/app/src/handlers/systemhandler.cpp +++ b/app/src/handlers/systemhandler.cpp @@ -262,38 +262,34 @@ bool SystemHandler::applyKdeAuroraeTheme(const QString &path) const 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 { - QStringList arguments{"set", "org.gnome.desktop.background", "picture-uri", "file://" + path}; - return QProcess::startDetached("gsettings", arguments); + return setSchemaWithGsettings("org.gnome.desktop.background", "picture-uri", "file://" + path); } bool SystemHandler::applyGnomeIcon(const QString &path) const { - auto themeName = QFileInfo(path).fileName(); - QStringList arguments{"set", "org.gnome.desktop.interface", "icon-theme", themeName}; - return QProcess::startDetached("gsettings", arguments); + return setSchemaWithGsettings("org.gnome.desktop.interface", "icon-theme", QFileInfo(path).fileName()); } bool SystemHandler::applyGnomeCursor(const QString &path) const { - auto themeName = QFileInfo(path).fileName(); - QStringList arguments{"set", "org.gnome.desktop.interface", "cursor-theme", themeName}; - return QProcess::startDetached("gsettings", arguments); + return setSchemaWithGsettings("org.gnome.desktop.interface", "cursor-theme", QFileInfo(path).fileName()); } bool SystemHandler::applyGnomeGtk3Theme(const QString &path) const { - auto themeName = QFileInfo(path).fileName(); - QStringList arguments{"set", "org.gnome.desktop.interface", "gtk-theme", themeName}; - return QProcess::startDetached("gsettings", arguments); + return setSchemaWithGsettings("org.gnome.desktop.interface", "gtk-theme", QFileInfo(path).fileName()); } bool SystemHandler::applyGnomeGnomeShellTheme(const QString &path) const { - auto themeName = QFileInfo(path).fileName(); - QStringList arguments{"set", "org.gnome.shell.extensions.user-theme", "name", themeName}; - return QProcess::startDetached("gsettings", arguments); + return setSchemaWithGsettings("org.gnome.shell.extensions.user-theme", "name", QFileInfo(path).fileName()); } bool SystemHandler::setPropertyWithXfconf(const QString &channel, const QString &property, const QDBusVariant &value) const diff --git a/app/src/handlers/systemhandler.h b/app/src/handlers/systemhandler.h index 1d61714dff33ea080770cf1ba9fb631cbf32107b..0ed6fb0ac059e04c94b3e8e8d80d6412a71231d5 100644 --- a/app/src/handlers/systemhandler.h +++ b/app/src/handlers/systemhandler.h @@ -34,6 +34,7 @@ private: bool applyKdePlasmaDesktoptheme(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 applyGnomeIcon(const QString &path) const; bool applyGnomeCursor(const QString &path) const;