mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
optional gtk detection via dconf
This commit is contained in:
@@ -74,6 +74,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
pci = dlopen("libpci.so", RTLD_LAZY);
|
||||
else
|
||||
pci = dlopen(instance->config.libPCI.chars, RTLD_LAZY);
|
||||
|
||||
if(pci == NULL)
|
||||
{
|
||||
ffPrintError(instance, &key, NULL, "dlopen(\"libpci.so\", RTLD_LAZY) == NULL");
|
||||
@@ -83,6 +84,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
struct pci_access*(*ffpci_alloc)() = dlsym(pci, "pci_alloc");
|
||||
if(ffpci_alloc == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_alloc\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -90,6 +92,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
void(*ffpci_init)(struct pci_access*) = dlsym(pci, "pci_init");
|
||||
if(ffpci_init == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_init\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -97,6 +100,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
void(*ffpci_scan_bus)(struct pci_access*) = dlsym(pci, "pci_scan_bus");
|
||||
if(ffpci_scan_bus == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_init\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -104,6 +108,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
int(*ffpci_fill_info)(struct pci_dev*, int) = dlsym(pci, "pci_fill_info");
|
||||
if(ffpci_fill_info == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_fill_info\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -111,6 +116,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
char*(*ffpci_lookup_name)(struct pci_access*, char*, int, int, ...) = dlsym(pci, "pci_lookup_name");
|
||||
if(ffpci_lookup_name == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_lookup_name\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -118,6 +124,7 @@ void ffPrintGPU(FFinstance* instance)
|
||||
void(*ffpci_cleanup)(struct pci_access*) = dlsym(pci, "pci_cleanup");
|
||||
if(ffpci_cleanup == NULL)
|
||||
{
|
||||
dlclose(pci);
|
||||
ffPrintError(instance, &key, NULL, "dlsym(pci, \"pci_cleanup\") == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,22 +10,32 @@ static int getCurrentRate(FFinstance* instance, Display* display)
|
||||
xrandr = dlopen("libXrandr.so", RTLD_LAZY);
|
||||
else
|
||||
xrandr = dlopen(instance->config.libXrandr.chars, RTLD_LAZY);
|
||||
|
||||
if(xrandr == NULL)
|
||||
return 0;
|
||||
|
||||
Window root = RootWindow(display, 0);
|
||||
|
||||
XRRScreenConfiguration*(*ffXRRGetScreenInfo)(Display*, Window) = dlsym(xrandr, "XRRGetScreenInfo");
|
||||
if(ffXRRGetScreenInfo == NULL)
|
||||
{
|
||||
dlclose(xrandr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
short(*ffXRRConfigCurrentRate)(XRRScreenConfiguration*) = dlsym(xrandr, "XRRConfigCurrentRate");
|
||||
if(ffXRRConfigCurrentRate == NULL)
|
||||
{
|
||||
dlclose(xrandr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Window root = RootWindow(display, 0);
|
||||
|
||||
XRRScreenConfiguration* xrrscreenconf = ffXRRGetScreenInfo(display, root);
|
||||
if(xrrscreenconf == NULL)
|
||||
{
|
||||
dlclose(xrandr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
short currentRate = ffXRRConfigCurrentRate(xrrscreenconf);
|
||||
|
||||
@@ -48,6 +58,7 @@ void ffPrintResolution(FFinstance* instance)
|
||||
x11 = dlopen("libX11.so", RTLD_LAZY);
|
||||
else
|
||||
x11 = dlopen(instance->config.libX11.chars, RTLD_LAZY);
|
||||
|
||||
if(x11 == NULL)
|
||||
{
|
||||
ffPrintError(instance, &instance->config.resolutionFormat, "Resolution", "dlopen(\"libX11.so\", RTLD_LAZY) == NULL");
|
||||
@@ -57,6 +68,7 @@ void ffPrintResolution(FFinstance* instance)
|
||||
Display*(*ffXOpenDisplay)(const char*) = dlsym(x11, "XOpenDisplay");
|
||||
if(ffXOpenDisplay == NULL)
|
||||
{
|
||||
dlclose(x11);
|
||||
ffPrintError(instance, &instance->config.resolutionFormat, "Resolution", "dlsym(x11, \"XOpenDisplay\") == NULL");
|
||||
return;
|
||||
}
|
||||
@@ -64,6 +76,7 @@ void ffPrintResolution(FFinstance* instance)
|
||||
Display* display = ffXOpenDisplay(NULL);
|
||||
if(display == NULL)
|
||||
{
|
||||
dlclose(x11);
|
||||
ffPrintError(instance, &instance->config.resolutionFormat, "Resolution", "ffXOpenDisplay(NULL) == NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ void ffPrintWMTheme(FFinstance* instance)
|
||||
|
||||
if(wmName->length == 0)
|
||||
{
|
||||
ffPrintError(instance, &instance->config.wmThemeKey, "WM Theme", "WM Theme needs sucessfull wm detection");
|
||||
ffPrintError(instance, &instance->config.wmThemeKey, "WM Theme", "WM Theme needs sucessfull WM detection");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user