Skip to content

Commit 1f0b622

Browse files
authored
Add check for XDG_SESSION_TYPE not being set (#2197)
Signed-off-by: Tin Švagelj <[email protected]>
1 parent 0c40ad9 commit 1f0b622

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/conky.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,9 @@ volatile sig_atomic_t g_sigterm_pending, g_sighup_pending, g_sigusr2_pending;
17091709

17101710
void get_system_details() {
17111711
char *session_ty = getenv("XDG_SESSION_TYPE");
1712-
if (std::strcmp(session_ty, "x11") == 0) {
1712+
if (session_ty == nullptr) {
1713+
info.system.session = conky::info::display_session::unknown;
1714+
} else if (std::strcmp(session_ty, "x11") == 0) {
17131715
info.system.session = conky::info::display_session::x11;
17141716
} else if (std::strcmp(session_ty, "wayland") == 0) {
17151717
info.system.session = conky::info::display_session::wayland;
@@ -1804,6 +1806,7 @@ void get_system_details() {
18041806
info.system.wm = conky::info::window_manager::enlightenment;
18051807
} else {
18061808
unknown_session:
1809+
info.system.wm_name = "unknown";
18071810
info.system.wm = conky::info::window_manager::unknown;
18081811

18091812
// probably a misconfigured system... let's attempt a few more things

0 commit comments

Comments
 (0)