You are not logged in.
Hey, recently I have been experimenting with StumpWM and lisp, (my skills are not the greatest at lisp), so I am not too sure on how to create a menu to popup where I can choose a window to kill. I want something like the command "pull-from-windowlist" except instead of pulling the window, it should kill the window. Does anyone know how I would achieve such functionality?
Thanks
Last edited by codexplode (2021-07-07 04:33:52)
Offline
I know next to nothing about lisp, and less about stumpWM, but I gather you'd only need to change the "when" clause in the pull-from-windowlist function to get what you want. It's not clear whether withdraw-window or destroy-window would be the right function to call on the selected (i.e., "pulled") window, but here's an example of the former:
(defcommand (withdraw-from-windowlist tile-group)
(&optional (fmt *window-format*)) (:rest)
(let ((pulled-window (select-window-from-menu
(group-windows (current-group))
fmt)))
(when pulled-window
(withdraw-window pulled-window))))The only changes here from the original pull-from-windowlist function is a removal of some comments, a change in the function name on the first line, and a change of the function that is called on the target window in the last line (from "pull-window" to "withdraw-window").
Last edited by Trilby (2021-07-06 17:58:27)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
That is exactly what I needed, thanks a lot!
Offline
(As a note for anyone else who views this post later). The function withdraw from window list written above causes the window to temporarily go away, but the process is still running. In order to actually kill that window you need to replace withdraw-window with kill-window. The code is the following:
(defcommand (kill-from-windowlist tile-group)
(&optional (fmt *window-format*)) (:rest)
(let ((window-to-kill (select-window-from-menu
(group-windows (current-group))
fmt)))
(when window-to-kill
(kill-window window-to-kill))))
Offline
Nicely done, thanks for sharing the final working solution.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline