From 5ee19c2308b85ab23a8d3644e3cb1d547009a6a3 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Mon, 20 Feb 2023 06:24:44 +0800 Subject: [PATCH] Allow WM_COMMAND-less app to autostart For apps which are not setting the window WM_COMMAND property like those old apps using Motif toolkit (I am thinking of NEdit for example) it's bringing some issues in windowmaker which is relying on it for a few interactions. Especially, *an app without WM_COMMAND will not be saved during the workspace state (so session restore is not working for them) *when added to the dock, the settings parameters are empty and need to be filled *cannot autostart from the dock (even if the settings are manually filled and saved) *right click on the app titlebar, and choosing Launch has no effect The patch below allows the workspace state to be saved for those apps without WM_COMMAND that have been launched from the dock. We are just reusing what have been set in the Application Path Settings of the dock app (and it does not require extra libs like libXRes). --- src/session.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/session.c b/src/session.c index 888d4a54..0bcec147 100644 --- a/src/session.c +++ b/src/session.c @@ -183,8 +183,13 @@ static WMPropList *makeWindowState(WWindow * wwin, WApplication * wapp) win = wwin->client_win; command = GetCommandForWindow(win); - if (!command) - return NULL; + if (!command) { + if (wapp->app_icon && wapp->app_icon->command) { + command = wmalloc(strlen(wapp->app_icon->command)); + strcpy(command, wapp->app_icon->command); + } else + return NULL; + } if (PropGetWMClass(win, &class, &instance)) { if (class && instance)