From 606d247899c9d3b4c9e32fc692512d603495fac4 Mon Sep 17 00:00:00 2001
From: Akira Ohgaki <akiraohgaki@gmail.com>
Date: Wed, 26 Jul 2017 11:54:01 +0900
Subject: [PATCH] Apply metacity theme with cinnamon

---
 app/src/desktopthemes/cinnamontheme.cpp  | 5 +++++
 app/src/desktopthemes/cinnamontheme.h    | 1 +
 app/src/handlers/desktopthemehandler.cpp | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/app/src/desktopthemes/cinnamontheme.cpp b/app/src/desktopthemes/cinnamontheme.cpp
index 1558a21..9b4629e 100644
--- a/app/src/desktopthemes/cinnamontheme.cpp
+++ b/app/src/desktopthemes/cinnamontheme.cpp
@@ -30,6 +30,11 @@ bool CinnamonTheme::applyAsGtk3Theme() const
     return setConfig("org.cinnamon.desktop.interface", "gtk-theme", themeName_);
 }
 
+bool CinnamonTheme::applyAsMetacityTheme() const
+{
+    return setConfig("org.cinnamon.desktop.wm.preferences", "name", themeName_);
+}
+
 bool CinnamonTheme::applyAsCinnamonTheme() const
 {
     return setConfig("org.cinnamon.theme", "name", themeName_);
diff --git a/app/src/desktopthemes/cinnamontheme.h b/app/src/desktopthemes/cinnamontheme.h
index 9aaaec5..07ff77a 100644
--- a/app/src/desktopthemes/cinnamontheme.h
+++ b/app/src/desktopthemes/cinnamontheme.h
@@ -13,6 +13,7 @@ public:
     bool applyAsIcon() const;
     bool applyAsCursor() const;
     bool applyAsGtk3Theme() const;
+    bool applyAsMetacityTheme() const;
     bool applyAsCinnamonTheme() const;
 
 private:
diff --git a/app/src/handlers/desktopthemehandler.cpp b/app/src/handlers/desktopthemehandler.cpp
index 89f047b..20869ec 100644
--- a/app/src/handlers/desktopthemehandler.cpp
+++ b/app/src/handlers/desktopthemehandler.cpp
@@ -82,6 +82,7 @@ bool DesktopThemeHandler::isApplicableType(const QString &installType) const
                         << "icons"
                         << "cursors"
                         << "gtk3_themes"
+                        << "metacity_themes"
                         << "cinnamon_themes";
     }
     else if (desktop == "mate") {
@@ -169,6 +170,9 @@ bool DesktopThemeHandler::applyTheme(const QString &path, const QString &install
             else if (installType == "gtk3_themes") {
                 return cinnamonTheme.applyAsGtk3Theme();
             }
+            else if (installType == "metacity_themes") {
+                return cinnamonTheme.applyAsMetacityTheme();
+            }
             else if (installType == "cinnamon_themes") {
                 return cinnamonTheme.applyAsCinnamonTheme();
             }
-- 
GitLab