Files

30 lines
1.1 KiB
QML

// SPDX-License-Identifier: MIT
import QtQuick
import org.kde.kwin as KWin
import org.kde.plasma.workspace.dbus as DBus
// KWin knows the actual task-button geometry published by Plasma, including
// panel placement and scaling. No windows or Plasma settings are changed here.
DBus.SignalWatcher {
service: "se.ajpanton.plasma-task-group-shortcuts"
path: "/TaskbarGeometry"
iface: "se.ajpanton.PlasmaTaskGroupShortcuts.TaskbarGeometry"
function dbuslookup(serial, uuid) {
// D-Bus supplies a boxed string; normalize before strict comparison.
const windowId = String(uuid);
const window = KWin.Workspace.windows.find(w => String(w.internalId) === windowId);
const rect = window ? window.iconGeometry : Qt.rect(0, 0, 0, 0);
send("complete", [serial, rect.x, rect.y, rect.width, rect.height], "(idddd)");
}
function send(member, args, signature) {
DBus.SessionBus.asyncCall({
service, path, iface, member, signature, arguments: args
}, () => {}, result => console.warn("Taskbar geometry:", result.error.message));
}
Component.onCompleted: send("bridgeReady", [], "()")
}