Files
fastfetch/src/detection/displayserver/linux/displayserver_linux.c
T

44 lines
1.4 KiB
C
Raw Normal View History

2022-09-06 15:42:37 +02:00
#include "displayserver_linux.h"
#include "common/io/io.h"
2022-01-02 16:55:26 +01:00
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
2022-01-02 16:55:26 +01:00
{
2022-09-06 15:42:37 +02:00
ffStrbufInit(&ds->wmProcessName);
ffStrbufInit(&ds->wmPrettyName);
ffStrbufInit(&ds->wmProtocolName);
ffStrbufInit(&ds->deProcessName);
ffStrbufInit(&ds->dePrettyName);
2023-01-18 01:37:47 +08:00
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4);
2022-01-02 16:55:26 +01:00
if (instance.config.general.dsForceDrm == FF_DS_FORCE_DRM_TYPE_FALSE)
2023-07-31 23:11:39 +08:00
{
//We try wayland as our preferred display server, as it supports the most features.
2023-07-31 23:11:39 +08:00
//This method can't detect the name of our WM / DE
ffdsConnectWayland(ds);
2022-01-02 16:55:26 +01:00
//Try the x11 libs, from most feature rich to least.
//We use the display list to detect if a connection is needed.
//They respect wmProtocolName, and only detect display if it is set.
2023-08-01 15:15:03 +08:00
if(ds->displays.length == 0)
2023-07-31 23:11:39 +08:00
ffdsConnectXcbRandr(ds);
2022-01-05 14:40:57 +01:00
if(ds->displays.length == 0)
ffdsConnectXrandr(ds);
2022-01-02 16:55:26 +01:00
if(ds->displays.length == 0)
ffdsConnectXcb(ds);
2022-01-05 14:40:57 +01:00
if(ds->displays.length == 0)
ffdsConnectXlib(ds);
2023-07-31 23:11:39 +08:00
}
2022-01-02 16:55:26 +01:00
2023-01-18 01:37:47 +08:00
//This display detection method is display server independent.
2022-01-02 16:55:26 +01:00
//Use it if all connections failed
2023-01-18 01:37:47 +08:00
if(ds->displays.length == 0)
2023-11-29 14:55:40 +08:00
ffdsConnectDrm(ds);
2022-01-02 16:55:26 +01:00
//This fills in missing information about WM / DE by using env vars and iterating processes
ffdsDetectWMDE(ds);
2022-01-02 16:55:26 +01:00
}