Skip to content

Commit 26d1725

Browse files
Detect WSLg
1 parent 9176797 commit 26d1725

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/detection/displayserver/wmde.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <string.h>
66
#include <unistd.h>
77
#include <dirent.h>
8+
#include <sys/stat.h>
89

910
static const char* parseEnv()
1011
{
@@ -42,6 +43,11 @@ static const char* parseEnv()
4243
if(getenv("TDE_FULL_SESSION") != NULL)
4344
return "Trinity";
4445

46+
if(
47+
getenv("WAYLAND_DISPLAY") != NULL &&
48+
ffFileExists("/mnt/wslg/", S_IFDIR)
49+
) return "WSLg";
50+
4551
return NULL;
4652
}
4753

src/detection/displayserver/xcb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void* xcbGetProperty(XcbPropertyData* data, xcb_connection_t* connection,
6262

6363
static void xcbDetectWMfromEWMH(XcbPropertyData* data, xcb_connection_t* connection, xcb_window_t rootWindow, FFDisplayServerResult* result)
6464
{
65-
if(result->wmProcessName.length > 0)
65+
if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND) == 0)
6666
return;
6767

6868
xcb_window_t* wmWindow = (xcb_window_t*) xcbGetProperty(data, connection, rootWindow, "_NET_SUPPORTING_WM_CHECK");

src/detection/displayserver/xlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static unsigned char* x11GetProperty(X11PropertyData* data, Display* display, Wi
3535

3636
static void x11DetectWMFromEWMH(X11PropertyData* data, Display* display, FFDisplayServerResult* result)
3737
{
38-
if(result->wmProcessName.length > 0)
38+
if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND) == 0)
3939
return;
4040

4141
Window* wmWindow = (Window*) x11GetProperty(data, display, DefaultRootWindow(display), "_NET_SUPPORTING_WM_CHECK");

src/modules/cursor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ void ffPrintCursor(FFinstance* instance)
193193

194194
const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance);
195195

196+
if(ffStrbufCompS(&wmde->wmPrettyName, "WSLg") == 0)
197+
{
198+
ffPrintError(instance, FF_CURSOR_MODULE_NAME, 0, &instance->config.cursor, "WSLg uses native windows cursor");
199+
return;
200+
}
201+
196202
if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, "TTY") == 0)
197203
{
198204
ffPrintError(instance, FF_CURSOR_MODULE_NAME, 0, &instance->config.cursor, "Cursor isn't supported in TTY");

0 commit comments

Comments
 (0)