diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-01 02:00:38 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-01 02:00:38 -0600 |
| commit | 106054e1b39f851865328b67cdaaee82494883a6 (patch) | |
| tree | c4f614bc8ee75197e74ac0f9bbc46b1c247f8237 /modules/host-environment.el | |
| parent | c86fbbf49f88d3f437b2e8a3d23a03cfb1579671 (diff) | |
| download | dotemacs-106054e1b39f851865328b67cdaaee82494883a6.tar.gz dotemacs-106054e1b39f851865328b67cdaaee82494883a6.zip | |
feat(env): add X11 and Wayland detection functions
env-x11-p returns t when on X11 (not Wayland).
env-wayland-p checks WAYLAND_DISPLAY env var, works with XWayland.
Diffstat (limited to 'modules/host-environment.el')
| -rw-r--r-- | modules/host-environment.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/host-environment.el b/modules/host-environment.el index 3cec5df1..af9248c2 100644 --- a/modules/host-environment.el +++ b/modules/host-environment.el @@ -44,6 +44,17 @@ "Return t if host system is running the X Window System." (string= (window-system) "x")) +(defun env-x11-p () + "Return t if running under X11 (not Wayland)." + (and (eq (window-system) 'x) + (not (getenv "WAYLAND_DISPLAY")))) + +(defun env-wayland-p () + "Return t if running under Wayland. +Checks WAYLAND_DISPLAY env var, which is set by Wayland compositors. +This returns t even if Emacs is running through XWayland." + (and (getenv "WAYLAND_DISPLAY") t)) + (defun env-terminal-p () "Return t if running in a terminal." (not (display-graphic-p))) |
