From 86fb1caef30e990be83f7c27b5f278de12704b31 Mon Sep 17 00:00:00 2001 From: Akira Ohgaki <akiraohgaki@gmail.com> Date: Fri, 16 Jun 2017 16:35:47 +0900 Subject: [PATCH] Apply shell theme with gnome --- app/src/handlers/systemhandler.cpp | 16 +++++++++++++++- app/src/handlers/systemhandler.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/handlers/systemhandler.cpp b/app/src/handlers/systemhandler.cpp index 5c4cb04..461cbce 100644 --- a/app/src/handlers/systemhandler.cpp +++ b/app/src/handlers/systemhandler.cpp @@ -99,7 +99,11 @@ bool SystemHandler::isApplicableType(const QString &installType) const applicableTypes << "wallpapers"; } else if (desktop == "gnome") { - applicableTypes << "wallpapers" << "icons" << "cursors" << "gtk3_themes"; + applicableTypes << "wallpapers" + << "icons" + << "cursors" + << "gtk3_themes" + << "gnome_shell_themes"; } else if (desktop == "xfce") { applicableTypes << "wallpapers"; @@ -132,6 +136,9 @@ bool SystemHandler::applyFile(const QString &path, const QString &installType) c else if (installType == "gtk3_themes") { return applyGnomeGtk3Theme(path); } + else if (installType == "gnome_shell_themes") { + return applyGnomeGnomeShellTheme(path); + } } else if (desktop == "xfce") { if (installType == "wallpapers") { @@ -199,6 +206,13 @@ bool SystemHandler::applyGnomeGtk3Theme(const QString &path) const return QProcess::startDetached("gsettings", arguments); } +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); +} + bool SystemHandler::applyXfceWallpaper(const QString &path) const { auto message = QDBusMessage::createMethodCall("org.xfce.Xfconf", "/org/xfce/Xfconf", "org.xfce.Xfconf", "SetProperty"); diff --git a/app/src/handlers/systemhandler.h b/app/src/handlers/systemhandler.h index d99d484..3ea555e 100644 --- a/app/src/handlers/systemhandler.h +++ b/app/src/handlers/systemhandler.h @@ -29,6 +29,7 @@ private: bool applyGnomeIcon(const QString &path) const; bool applyGnomeCursor(const QString &path) const; bool applyGnomeGtk3Theme(const QString &path) const; + bool applyGnomeGnomeShellTheme(const QString &path) const; bool applyXfceWallpaper(const QString &path) const; #endif -- GitLab