mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
small syntactic changes
This commit is contained in:
@@ -24,6 +24,7 @@ The following libraries are used if present:
|
||||
* [`libwayland-client`](https://wayland.freedesktop.org/): Better resolution performance + support for monitors with different refresh rates in wayland sessions.
|
||||
* [`libGIO`](https://developer.gnome.org/gio/unstable/): Needed for values that are only stored GSettings.
|
||||
* [`libDConf`](https://developer.gnome.org/dconf/unstable/): Needed for values that are only stored in DConf + Fallback for GSettings.
|
||||
* [`libXFConf`](https://gitlab.xfce.org/xfce/xfconf): Needed for XFWM theme and XFCE Terminal font.
|
||||
|
||||
## Support status
|
||||
All categories not listed here should work without needing a specific implementation.
|
||||
|
||||
@@ -14,19 +14,16 @@ typedef void* DynamicLibrary;
|
||||
return FF_VARIANT_NULL; \
|
||||
}
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, mutex) dlsym(library, symbolName); \
|
||||
if(dlerror() != NULL) { \
|
||||
pthread_mutex_unlock(&mutex); \
|
||||
dlclose(library); \
|
||||
return FF_VARIANT_NULL; \
|
||||
}
|
||||
|
||||
#define FF_LIBRARY_ERROR_RETURN(library, mutex) { \
|
||||
pthread_mutex_unlock(&mutex); \
|
||||
dlclose(library); \
|
||||
return FF_VARIANT_NULL; \
|
||||
}
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, mutex) dlsym(library, symbolName); \
|
||||
if(dlerror() != NULL) \
|
||||
FF_LIBRARY_ERROR_RETURN(library, mutex)
|
||||
|
||||
typedef struct GVariantGetters
|
||||
{
|
||||
const gchar*(*ffg_variant_get_string)(GVariant*, gsize*);
|
||||
|
||||
+1
-6
@@ -54,12 +54,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
if(ffPrintFromCache(instance, FF_GPU_MODULE_NAME, &instance->config.gpuKey, &instance->config.gpuFormat, FF_GPU_NUM_FORMAT_ARGS))
|
||||
return;
|
||||
|
||||
void* pci;
|
||||
if(instance->config.libPCI.length == 0)
|
||||
pci = dlopen("libpci.so", RTLD_LAZY);
|
||||
else
|
||||
pci = dlopen(instance->config.libPCI.chars, RTLD_LAZY);
|
||||
|
||||
void* pci = dlopen(instance->config.libPCI.length == 0 ? "libpci.so" : instance->config.libPCI.chars, RTLD_LAZY);
|
||||
if(pci == NULL)
|
||||
{
|
||||
ffPrintError(instance, FF_GPU_MODULE_NAME, 0, &instance->config.gpuKey, &instance->config.gpuFormat, FF_GPU_NUM_FORMAT_ARGS, "dlopen(\"libpci.so\", RTLD_LAZY) == NULL");
|
||||
|
||||
@@ -114,12 +114,7 @@ bool ffPrintResolutionWaylandBackend(FFinstance* instance)
|
||||
if(sessionType != NULL && strcasecmp(sessionType, "wayland") != 0)
|
||||
return false;
|
||||
|
||||
void* wayland;
|
||||
if(instance->config.libWayland.length == 0)
|
||||
wayland = dlopen("libwayland-client.so", RTLD_LAZY);
|
||||
else
|
||||
wayland = dlopen(instance->config.libWayland.chars, RTLD_LAZY);
|
||||
|
||||
void* wayland = dlopen(instance->config.libWayland.length == 0 ? "libwayland-client.so" : instance->config.libWayland.chars, RTLD_LAZY);
|
||||
if(wayland == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -35,12 +35,7 @@ static void xCloseDisplay(void* library, Display* display)
|
||||
|
||||
void ffPrintResolutionX11Backend(FFinstance* instance)
|
||||
{
|
||||
void* x11;
|
||||
if(instance->config.libX11.length == 0)
|
||||
x11 = dlopen("libX11.so", RTLD_LAZY);
|
||||
else
|
||||
x11 = dlopen(instance->config.libX11.chars, RTLD_LAZY);
|
||||
|
||||
void* x11 = dlopen(instance->config.libX11.length == 0 ? "libX11.so" : instance->config.libX11.chars, RTLD_LAZY);
|
||||
if(x11 == NULL)
|
||||
{
|
||||
ffPrintError(instance, FF_RESOLUTION_MODULE_NAME, 0, &instance->config.resolutionKey, &instance->config.resolutionFormat, FF_RESOLUTION_NUM_FORMAT_ARGS, "dlopen(\"libX11.so\", RTLD_LAZY) == NULL");
|
||||
@@ -102,12 +97,7 @@ static int xrandrGetCurrentRate(void* xrandr, Display* display)
|
||||
|
||||
bool ffPrintResolutionXrandrBackend(FFinstance* instance)
|
||||
{
|
||||
void* xrandr;
|
||||
if(instance->config.libXrandr.length == 0)
|
||||
xrandr = dlopen("libXrandr.so", RTLD_LAZY);
|
||||
else
|
||||
xrandr = dlopen(instance->config.libXrandr.chars, RTLD_LAZY);
|
||||
|
||||
void* xrandr = dlopen(instance->config.libXrandr.length == 0 ? "libXrandr.so" : instance->config.libXrandr.chars, RTLD_LAZY);
|
||||
if(xrandr == NULL)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ static void printTilixTerminal(FFinstance* instance)
|
||||
static void printXCFETerminal(FFinstance* instance)
|
||||
{
|
||||
char useSysFont[6];
|
||||
const char* fontName;
|
||||
|
||||
if(!ffParsePropFileConfig(instance, "xfce4/terminal/terminalrc", "FontUseSystem=%[^\n]", useSysFont))
|
||||
{
|
||||
@@ -124,13 +123,16 @@ static void printXCFETerminal(FFinstance* instance)
|
||||
printTerminalFontFromConfigFile(instance, "xfce4/terminal/terminalrc", "FontName=%[^\n]");
|
||||
return;
|
||||
}
|
||||
else
|
||||
fontName = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/MonospaceFontName", FF_VARIANT_TYPE_STRING).strValue;
|
||||
|
||||
const char* fontName = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/MonospaceFontName", FF_VARIANT_TYPE_STRING).strValue;
|
||||
|
||||
if(fontName == NULL)
|
||||
{
|
||||
ffPrintError(instance, FF_TERMFONT_MODULE_NAME, 0, &instance->config.termFontKey, &instance->config.termFontFormat, FF_TERMFONT_NUM_FORMAT_ARGS, "Couldn't find \"xsettings::/Gtk/MonospaceFontName\" in XFConf");
|
||||
else
|
||||
printTerminalFont(instance, fontName);
|
||||
return;
|
||||
}
|
||||
|
||||
printTerminalFont(instance, fontName);
|
||||
}
|
||||
|
||||
static void printTTY(FFinstance* instance)
|
||||
|
||||
Reference in New Issue
Block a user