QML: Changing the taskbar context menu close button, to kill the app?

When I right click on an app in the taskbar and select close all, I want the app to be killed rather than close windows individually, since that allows Zen Browser to restore all the windows properly. I made another post asking how to do this but didn’t get answers, so it looks like I’m gonna have to make edit the taskmanager plasmoid!

This is the context menu option code, found in /usr/share/plasma/plasmoids/org.kde.plasma.taskmanager/contents/ui/:

    PlasmaExtras.MenuItem {
        id: closeWindowItem
        visible: (visualParent && !get(atm.IsLauncher) && !get(atm.IsStartup))

        enabled: visualParent && get(atm.IsClosable)

        text: get(atm.IsGroupParent) ? i18nc("@item:inmenu", "&Close All") : i18n("&Close")
        icon: "window-close"

        onClicked: {
            if (tasks.groupDialog !== null && tasks.groupDialog.visualParent === visualParent) {
                tasks.groupDialog.visible = false;
            }

            tasksModel.requestClose(modelIndex);
        }
    }

I just tried asking LLMs how to do it and they gave wrong answers (obviously), and searched through the API documentation: https://api.kde.org/legacy/plasma/plasma-workspace/html/, but there doesn’t seem to be a way to do so.

did you know if you use grouping in the task manager, the close button applies to all open windows of the app?

i’ve never had any issues with that feature closing out the app entirely, and i just tried it with Zen and it works the same as will all my other apps.

If you have multiple windows with tabs open, and close zen via context menu then reopen it, does it restore all the windows?

it does, but for some reason i get two windows with the exact same set of tabs open that were open in zen before it was closed…not sure why i’m getting two windows tho

since it’s not my regular browser, i’m not super motivated to dig into it.

How familiar are you with plasmoids? Any APIs for killing the apps or should I call my own shell script?

sorry, can’t help you with that, just wanted to point out the grouping behavior in case you missed it.

but i can report that clearing all the open tab, history, cookies, site data… etc has fixed the double window issue for me, at least for now.

in zen there is a setting for open site in new tab or new window that may help you manage things.