Bash script using wmctrl to close all apps on all workspaces? help

Can someone provide a bash script to close all running applications, hopefully a little warning if a program has not yet been saved, e.g. geany in midst of editing?

What is wmctl? I cannot install /usr/bin/wmctl from the Fedora repos.

Any well written GUI program will block a logout or shutdown if it has unsaved work.

If you wish to do this in preperation to logging out or shutting down the system, it is not required as this is the automatic behaviour of desktops.

sorry, wmctrl is correct, not wmctl.

I finally had time to look at wmctrl. There is no Wayland replacement for wmctrl. And I think that the security design of Wayland would prevent such an tool being written.

But as I said and well designed editor will block shutdown until you have time to save your work.

thank you Barry, appreciate your input.