MCPcopy Create free account
hub / github.com/FedeDP/Clight / fetch_display

Function fetch_display

src/utils/utils.c:10–20  ·  view source on GitHub ↗

* On X, use X display variable; * On Wl, use Wl display variable; * Otherwise, use NULL device * (ie: we are neither on x or wayland; try drm plugin) */

Source from the content-addressed store, hash-verified

8 * (ie: we are neither on x or wayland; try drm plugin)
9 */
10const char *fetch_display() {
11 /*
12 * Use wayland as first case,
13 * as sometimes on wayland you have $DISPLAY env var too!
14 */
15 const char *wl_display = getenv("WAYLAND_DISPLAY");
16 if (!is_string_empty(wl_display)) {
17 return wl_display;
18 }
19 return getenv("DISPLAY");
20}
21
22/*
23 * On X, use xauthority

Callers 5

initFunction · 0.85
set_tempFunction · 0.85
get_screen_brightnessFunction · 0.85
set_dpmsFunction · 0.85
own_displayFunction · 0.85

Calls 1

is_string_emptyFunction · 0.85

Tested by

no test coverage detected