diff --git a/mdm/login.c b/mdm/login.c index 5819499..878b027 100644 --- a/mdm/login.c +++ b/mdm/login.c @@ -17,6 +17,8 @@ char* name_line = NULL; char* try_exec_line = NULL; char* exec_line = NULL; char* desktop_names_line = NULL; +int session_count = 0; +int mde_count = -1; static void add_user(const char* name, void* user) { MwComboBoxAdd(user, -1, name); @@ -60,6 +62,11 @@ static void add_session(session_type_t session_type, const char* path, int dir, if(i == shlen(sessions)) { MwComboBoxAdd(user, -1, name_line); + if(strcmp(name_line, "MDE") == 0) { + mde_count = session_count; + } + session_count++; + value->run = exec_line; value->try_run = try_exec_line; value->session_type = session_type; @@ -199,11 +206,11 @@ void login_window(void) { pic = MwVaCreateWidget(MwImageClass, "image", window, 10, 10, 80, 137, MwNhasBorder, 1, NULL); - userlabel = MwVaCreateWidget(MwLabelClass, "userlabel", window, 95, 10, MwTextWidth(window, "User:"), 16, + userlabel = MwVaCreateWidget(MwLabelClass, "userlabel", window, 95, 10, MwTextWidth(window, NULL, "User:"), 16, MwNtext, "User:", NULL); usercombo = MwCreateWidget(MwComboBoxClass, "usercombo", window, 95, 10 + 16 + 5, 265, 18); - passlabel = MwVaCreateWidget(MwLabelClass, "passlabel", window, 95, 10 + 16 + 5 + 18 + 5, MwTextWidth(window, "Password:"), 16, + passlabel = MwVaCreateWidget(MwLabelClass, "passlabel", window, 95, 10 + 16 + 5 + 18 + 5, MwTextWidth(window, NULL, "Password:"), 16, MwNtext, "Password:", NULL); passentry = MwVaCreateWidget(MwEntryClass, "passentry", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5, 265, 18, @@ -212,7 +219,7 @@ void login_window(void) { mainsep = MwVaCreateWidget(MwSeparatorClass, "mainsep", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18, 265, 10, MwNorientation, MwHORIZONTAL, NULL); - sesslabel = MwVaCreateWidget(MwLabelClass, "sesslabel", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10, MwTextWidth(window, "Session Type:"), 16, + sesslabel = MwVaCreateWidget(MwLabelClass, "sesslabel", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10, MwTextWidth(window, NULL, "Session Type:"), 16, MwNtext, "Session Type:", NULL); sesscombo = MwCreateWidget(MwComboBoxClass, "sesscombo", window, 95, 10 + 16 + 5 + 18 + 5 + 16 + 5 + 18 + 10 + 16 + 5, 265, 18); @@ -243,11 +250,21 @@ void login_window(void) { shfree(sessions); sh_new_strdup(sessions); shdefault(sessions, NULL); + + mde_count = -1; + session_count = 0; + MDEDirectoryScan(DATAROOTDIR "/xsessions", add_session_x, sesscombo); MDEDirectoryScan("/usr/share/xsessions", add_session_x, sesscombo); MDEDirectoryScan(DATAROOTDIR "/wayland-sessions", add_session_wayland, sesscombo); MDEDirectoryScan("/usr/share/wayland-sessions", add_session_wayland, sesscombo); + if(mde_count != -1) { + MwVaApply(sesscombo, + MwNvalue, mde_count, + NULL); + } + pthread_mutex_unlock(&xmutex); while(1) { diff --git a/milkwm/main.c b/milkwm/main.c index 7b02762..316f111 100644 --- a/milkwm/main.c +++ b/milkwm/main.c @@ -9,6 +9,8 @@ void rehash(int sig) { int main() { int st; + MwLibraryInit(); + wm_config_init(); wm_config_read(); diff --git a/milkwm/wm.c b/milkwm/wm.c index c193099..9eb8673 100644 --- a/milkwm/wm.c +++ b/milkwm/wm.c @@ -41,8 +41,6 @@ void loop_wm(void) { pthread_mutex_lock(&xmutex); - MwLibraryInit(); - root = MwVaCreateWidget(NULL, "root", NULL, 0, 0, 0, 0, COMMON_LOOK, NULL); diff --git a/milkwm/xserver.c b/milkwm/xserver.c index bcbed24..0bd790a 100644 --- a/milkwm/xserver.c +++ b/milkwm/xserver.c @@ -661,8 +661,8 @@ void loop_x(void) { if(ret) continue; if(i != arrlen(windows)) { XWindowAttributes xwa; - int rev; - Window cfocus; + int rev; + Window cfocus; if(!XGetWindowAttributes(xdisplay, windows[i].client, &xwa)) { wm_destroy(windows[i].frame); diff --git a/startmde/CMakeLists.txt b/startmde/CMakeLists.txt index 2fc9e5a..19140ab 100644 --- a/startmde/CMakeLists.txt +++ b/startmde/CMakeLists.txt @@ -7,3 +7,8 @@ install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startmde DESTINATION ${CMAKE_INSTALL_BINDIR} ) + +install( + PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mde.desktop + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xsessions +) diff --git a/startmde/mde.desktop b/startmde/mde.desktop new file mode 100644 index 0000000..98966a9 --- /dev/null +++ b/startmde/mde.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=MDE +Comment=Milk Desktop Experience +Exec=startmde +Type=Application +Keywords=desktop