The current $WAYLAND_DISPLAY check should work in most cases, there is at least one where it will fail.
If you attempt to start Nextshot from within a tmux session that was started in X, the WAYLAND_DISPLAY environment variable will not be set regardless of whether you're currently using X or Wayland.
It may be possible to check the output of tty (which will either be /dev/ttyX or /dev/pts/X), but there's a good chance that could have the same issues as the env var.
The current
$WAYLAND_DISPLAY
check should work in most cases, there is at least one where it will fail.If you attempt to start Nextshot from within a tmux session that was started in X, the
WAYLAND_DISPLAY
environment variable will not be set regardless of whether you're currently using X or Wayland.It may be possible to check the output of
tty
(which will either be/dev/ttyX
or/dev/pts/X
), but there's a good chance that could have the same issues as the env var.