Was trying to add an “End task” button (which is helpful to have since the regular close button sends a close request instead of actually killing the app) to this custom plasmoid I found for a version of the “Icons-Only Task Manager” and found this post, I ended up with this solution:
onClicked: {
const pid = get(atm.AppPid);
if (pid > 0) {
const exec = Qt.createQmlObject(`
import QtQuick
import org.kde.plasma.plasma5support as Plasma5Support
Plasma5Support.DataSource {
engine: "executable"
connectedSources: []
onNewData: function(sourceName, data) {
disconnectSource(sourceName);
destroy();
}
function exec(cmd) {
connectSource(cmd);
}
}
`, menu);
if (exec) {
exec.exec("kill -9 " + pid);
}
}
// Always clean up the taskbar entry regardless
tasksModel.requestClose(modelIndex);
}
A bit ugly but it works. You essentially use an old Plasma 5 compatibility layer (plasma5support) to run a command, you could use this approach in a loop to close all instances of zen