Cinnamon support

This commit is contained in:
Linus Dierheimer
2021-05-08 11:20:17 +02:00
parent eea74b085b
commit 7609a24778
5 changed files with 72 additions and 11 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ KWin, Mutter, Muffin, Openbox, XFWM, Sway, Wayfire, Weston
### Window manager themes:
```
KWin, Mutter, Openbox (LXDE, LXQT & without DE)
KWin, Mutter, Muffin, Openbox (LXDE, LXQT & without DE)
```
### Terminal fonts:
+19 -6
View File
@@ -27,9 +27,9 @@ static void detectGTKFromDConf(FFinstance* instance, FFGTKResult* result)
{
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static const char* themeName;
static const char* iconsName;
static const char* fontName;
static const char* themeName = NULL;
static const char* iconsName = NULL;
static const char* fontName = NULL;
static bool init = false;
@@ -44,9 +44,22 @@ static void detectGTKFromDConf(FFinstance* instance, FFGTKResult* result)
init = true;
themeName = ffSettingsGet(instance, "/org/gnome/desktop/interface/gtk-theme", "org.gnome.desktop.interface", NULL, "gtk-theme");
iconsName = ffSettingsGet(instance, "/org/gnome/desktop/interface/icon-theme", "org.gnome.desktop.interface", NULL, "icon-theme");
fontName = ffSettingsGet(instance, "/org/gnome/desktop/interface/font-name", "org.gnome.desktop.interface", NULL, "font-name");
const FFWMDEResult* wmde = ffDetectWMDE(instance);
if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Cinnamon") == 0)
{
themeName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/gtk-theme", "org.cinnamon.desktop.interface", NULL, "gtk-theme");
iconsName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/icon-theme", "org.cinnamon.desktop.interface", NULL, "icon-theme");
fontName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/font-name", "org.cinnamon.desktop.interface", NULL, "font-name");
}
//Fallback + Gnome impl
if(themeName == NULL)
themeName = ffSettingsGet(instance, "/org/gnome/desktop/interface/gtk-theme", "org.gnome.desktop.interface", NULL, "gtk-theme");
if(iconsName == NULL)
iconsName = ffSettingsGet(instance, "/org/gnome/desktop/interface/icon-theme", "org.gnome.desktop.interface", NULL, "icon-theme");
if(fontName == NULL)
fontName = ffSettingsGet(instance, "/org/gnome/desktop/interface/font-name", "org.gnome.desktop.interface", NULL, "font-name");
pthread_mutex_unlock(&mutex);
applyGTKDConfSettings(result, themeName, iconsName, fontName);
+19 -3
View File
@@ -16,7 +16,8 @@ typedef enum DEHint
{
FF_DE_HINT_UNKNOWN = 0,
FF_DE_HINT_PLASMA,
FF_DE_HINT_GNOME
FF_DE_HINT_GNOME,
FF_DE_HINT_CINNAMON
} DEHint;
typedef struct ProcData
@@ -118,7 +119,7 @@ static bool applyPrettyNameIfWM(FFWMDEResult* result, const FFstrbuf* processNam
}
else if(ffStrbufIgnCaseCompS(processName, "gnome-session-binary") == 0)
ffStrbufSetS(&result->wmPrettyName, "Mutter");
else if(ffStrbufIgnCaseCompS(processName, "cinnamon") == 0)
else if(ffStrbufIgnCaseCompS(processName, "cinnamon-session") == 0)
ffStrbufSetS(&result->wmPrettyName, "Muffin");
if(result->wmPrettyName.length > 0)
@@ -136,6 +137,8 @@ static bool applyDEHintIfDE(const FFstrbuf* processName, DEHint* deHint)
*deHint = FF_DE_HINT_PLASMA;
else if(ffStrbufIgnCaseCompS(processName, "gnome-shell") == 0)
*deHint = FF_DE_HINT_GNOME;
else if(ffStrbufIgnCaseCompS(processName, "cinnamon") == 0)
*deHint = FF_DE_HINT_CINNAMON;
return *deHint != FF_DE_HINT_UNKNOWN;
}
@@ -205,13 +208,22 @@ static void getKDE(FFWMDEResult* result)
static void getGnome(FFWMDEResult* result)
{
ffStrbufSetS(&result->deProcessName, "gnome-session-binary");
ffStrbufSetS(&result->deProcessName, "gnome-shell");
ffStrbufSetS(&result->dePrettyName, "GNOME");
ffParsePropFile("/usr/share/gnome-shell/org.gnome.Extensions", " version: '%[^']", result->deVersion.chars);
ffStrbufRecalculateLength(&result->deVersion);
}
static void getCinnamon(FFWMDEResult* result)
{
ffStrbufSetS(&result->deProcessName, "cinnamon");
ffStrbufSetS(&result->dePrettyName, "Cinnamon");
ffParsePropFile("/usr/share/applications/cinnamon.desktop", " X-GNOME-Bugzilla-Version=%[^\n]", result->deVersion.chars);
ffStrbufRecalculateLength(&result->deVersion);
}
static inline void getDEFromHint(FFWMDEResult* result, ProcData* procData)
{
getFromProcDir(result, procData, false);
@@ -223,6 +235,8 @@ static inline void getDEFromHint(FFWMDEResult* result, ProcData* procData)
getKDE(result);
else if(procData->deHint == FF_DE_HINT_GNOME)
getGnome(result);
else if(procData->deHint == FF_DE_HINT_CINNAMON)
getCinnamon(result);
}
static inline void getDE(FFWMDEResult* result, ProcData* procData)
@@ -242,6 +256,8 @@ static inline void getDE(FFWMDEResult* result, ProcData* procData)
getKDE(result);
else if(strcasecmp(result->sessionDesktop, "Gnome") == 0 || strcasecmp(result->sessionDesktop, "ubuntu:GNOME") == 0 || strcasecmp(result->sessionDesktop, "ubuntu") == 0)
getGnome(result);
else if(strcasecmp(result->sessionDesktop, "X-Cinnamon") == 0 || strcasecmp(result->sessionDesktop, "Cinnamon") == 0)
getCinnamon(result);
else
{
ffStrbufSetS(&result->deProcessName, result->sessionDesktop);
+1 -1
View File
@@ -48,7 +48,7 @@ void ffPrintError(FFinstance* instance, const char* moduleName, uint8_t moduleIn
ffPrintLogoAndKey(instance, moduleName, moduleIndex, customKeyFormat);
fputs(FASTFETCH_TEXT_MODIFIER_ERROR, stdout);
vprintf(message, arguments);
puts(FASTFETCH_TEXT_MODIFIER_ERROR);
puts(FASTFETCH_TEXT_MODIFIER_RESET);
}
else
{
+32
View File
@@ -54,6 +54,36 @@ static void printMutter(FFinstance* instance)
printWMTheme(instance, theme);
}
static void printMuffin(FFinstance* instance)
{
const char* name = ffSettingsGet(instance, "/org/cinnamon/theme/name", "org.cinnamon.theme", NULL, "name");
const char* theme = ffSettingsGet(instance, "/org/cinnamon/desktop/wm/preferences/theme", "org.cinnamon.desktop.wm.preferences", NULL, "theme");
if(name == NULL && theme == NULL)
{
ffPrintError(instance, FF_WMTHEME_MODULE_NAME, 0, &instance->config.wmThemeKey, &instance->config.wmThemeFormat, FF_WMTHEME_NUM_FORMAT_ARGS, "Couldn't find muffin theme in GSettings / DConf");
return;
}
if(name == NULL)
printWMTheme(instance, theme);
else if(theme == NULL)
printWMTheme(instance, name);
else
{
FFstrbuf buffer;
ffStrbufInit(&buffer);
ffStrbufAppendS(&buffer, name);
ffStrbufAppendS(&buffer, " (");
ffStrbufAppendS(&buffer, theme);
ffStrbufAppendC(&buffer, ')');
printWMTheme(instance, buffer.chars);
ffStrbufDestroy(&buffer);
}
}
static void printOpenbox(FFinstance* instance, const FFstrbuf* dePrettyName)
{
FFstrbuf absolutePath;
@@ -132,6 +162,8 @@ void ffPrintWMTheme(FFinstance* instance)
printKWin(instance);
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Mutter") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Gnome") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Ubuntu") == 0)
printMutter(instance);
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Muffin") == 0)
printMuffin(instance);
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Openbox") == 0)
printOpenbox(instance, &result->dePrettyName);
else