58 lines
1.3 KiB
QML
58 lines
1.3 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
|
|
// A small box in the bottom-right corner of each monitor with the active
|
|
// workspace's name and color. Click it to rename the workspace or pick
|
|
// another color.
|
|
ShellRoot {
|
|
id: shell
|
|
|
|
Theme {
|
|
id: badgeTheme
|
|
}
|
|
|
|
Compositor {
|
|
id: badgeCompositor
|
|
}
|
|
|
|
ColorStore {
|
|
id: colorStore
|
|
fallback: badgeTheme.defaultColor
|
|
fallbackOpacity: badgeTheme.badgeOpacity
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
if (badgeCompositor.kind === "")
|
|
console.warn("workspace-badge: neither niri nor Hyprland was detected");
|
|
}
|
|
|
|
Variants {
|
|
id: badges
|
|
model: Quickshell.screens
|
|
|
|
delegate: Component {
|
|
Badge {
|
|
compositor: badgeCompositor
|
|
store: colorStore
|
|
theme: badgeTheme
|
|
}
|
|
}
|
|
}
|
|
|
|
IpcHandler {
|
|
target: "badge"
|
|
|
|
// Open the editor on the focused monitor.
|
|
function edit(): void {
|
|
const list = badges.instances;
|
|
for (let i = 0; i < list.length; i++) {
|
|
if (list[i].modelData.name === badgeCompositor.focusedOutput) {
|
|
list[i].openEditor();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|