diff --git a/src/session.c b/src/session.c index 5fd79bc..e945a5f 100644 --- a/src/session.c +++ b/src/session.c @@ -203,8 +203,10 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp) if (wapp->app_icon && wapp->app_icon->command) { command = wmalloc(strlen(wapp->app_icon->command) + 1); strcpy(command, wapp->app_icon->command); - } else - return NULL; + } + /* If still no command (e.g. Wayland native client launched + * externally), continue with app_id as Name so the window + * state is saved and can be restored by app_id matching. */ } if (PropGetWMClass(win, &class, &instance)) { @@ -568,6 +570,10 @@ void wSessionRestoreState(WScreen *scr) wDockLaunchWithState(btn, state); } else if ((pid = execCommand(scr, command)) > 0) { wWindowAddSavedState(instance, class, command, pid, state); + } else if (instance || class) { + /* No command (Wayland native client) but we have a name. + * Store state for matching when the window appears. */ + wWindowAddSavedState(instance, class, NULL, 0, state); } else { wfree(state); } diff --git a/src/window.c b/src/window.c index 3bf9e77..149a1a2 100644 --- a/src/window.c +++ b/src/window.c @@ -2446,14 +2446,12 @@ WMagicNumber wWindowGetSavedState(WNativeWindow win) return NULL; command = GetCommandForWindow(win); - if (!command) - return NULL; if (PropGetWMClass(win, &class, &instance)) { while (wstate) { if (is_same(instance, wstate->instance) && is_same(class, wstate->class) && - is_same(command, wstate->command)) { + (command == NULL || is_same(command, wstate->command))) { break; } wstate = wstate->next;