You are not logged in.

#1 2021-07-06 17:29:23

codexplode
Member
Registered: 2021-07-06
Posts: 5

StumpWM kill from windowlist [SOLVED]

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

#2 2021-07-06 17:49:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,504
Website

Re: StumpWM kill from windowlist [SOLVED]

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

#3 2021-07-06 18:07:53

codexplode
Member
Registered: 2021-07-06
Posts: 5

Re: StumpWM kill from windowlist [SOLVED]

That is exactly what I needed, thanks a lot!

Offline

#4 2021-07-07 04:33:29

codexplode
Member
Registered: 2021-07-06
Posts: 5

Re: StumpWM kill from windowlist [SOLVED]

(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

#5 2021-07-07 12:05:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,504
Website

Re: StumpWM kill from windowlist [SOLVED]

Nicely done, thanks for sharing the final working solution.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB