From abf9fe8f785a4eae2a534057ba37978c5cc95148 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 28 Oct 2015 20:54:42 +0100 Subject: [PATCH] permit setting a default xsession from .xinitrc Without this patch the order of xsessions is dependent on the order in which `readdir(pDir)` returns them. Thus the default xsession may be quite random. With this patch one may match for "default" in .xinitrc thus setting the default xsession: ``` case $SESSION in gnome-session) exec gnome-session ;; icewm-session) exec icewm-session ;; xmonad) trayer & exec xmonad ;; wmii | default | *) trayer & exec wmii ;; esac ```` --- cfg.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cfg.cpp b/cfg.cpp index 02379f2..2857875 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -292,6 +292,9 @@ void Cfg::fillSessionList(){ string strSessionDir = getOption("sessiondir"); sessions.clear(); + + pair session("","default"); + sessions.push_back(session); if( !strSessionDir.empty() ) { DIR *pDir = opendir(strSessionDir.c_str()); @@ -336,11 +339,6 @@ void Cfg::fillSessionList(){ closedir(pDir); } } - - if (sessions.empty()){ - pair session("",""); - sessions.push_back(session); - } } pair Cfg::nextSession() {