Add configurable Plasma panel scroll and click actions
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
.pragma library
|
||||
|
||||
// Task Manager fills unused panel space. Only delegates are task buttons.
|
||||
function hasTaskAt(item, x, y) {
|
||||
if (!item.visible || !item.contains(item.mapFromItem(null, x, y))) return false;
|
||||
if (item.tasksRoot !== undefined && item.isWindow !== undefined && item.index !== undefined) return true;
|
||||
for (const child of item.children) {
|
||||
if (hasTaskAt(child, x, y)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function areaAt(panelLayout, x, y) {
|
||||
if (!panelLayout) return "";
|
||||
for (const child of panelLayout.children) {
|
||||
if (!child.visible || !child.contains(child.mapFromItem(null, x, y))) continue;
|
||||
const applet = child.applet;
|
||||
const name = applet?.plasmoid?.pluginName;
|
||||
if (!name) return "other";
|
||||
if (name === "org.kde.plasma.taskmanager" || name === "org.kde.plasma.icontasks") {
|
||||
return hasTaskAt(applet, x, y) ? "tasks" : "empty";
|
||||
}
|
||||
if (name === "se.ajpanton.panelactions" || name === "org.kde.plasma.panelspacer"
|
||||
|| name === "org.kde.plasma.marginsseparator") return "empty";
|
||||
if (name === "org.kde.plasma.systemtray") return "tray";
|
||||
if (name === "org.kde.plasma.digitalclock" || name === "org.kde.plasma.analogclock") return "clock";
|
||||
if (name === "org.kde.plasma.kickoff" || name === "org.kde.plasma.kicker"
|
||||
|| name === "org.kde.plasma.kickerdash") return "launcher";
|
||||
return "other";
|
||||
}
|
||||
return "empty";
|
||||
}
|
||||
Reference in New Issue
Block a user