bar/popouts: allow disabling individual popouts

Closes #826
This commit is contained in:
2 * r + 2 * t 2025-10-21 19:40:34 +11:00
parent 0104fe25b2
commit 58ac60c47c
4 changed files with 19 additions and 7 deletions

View file

@ -357,6 +357,11 @@ default, you must create it manually.
}
],
"persistent": true,
"popouts": {
"activeWindow": true,
"statusIcons": true,
"tray": true
},
"scrollActions": {
"brightness": true,
"workspaces": true,

View file

@ -5,6 +5,7 @@ JsonObject {
property bool showOnHover: true
property int dragThreshold: 20
property ScrollActions scrollActions: ScrollActions {}
property Popouts popouts: Popouts {}
property Workspaces workspaces: Workspaces {}
property Tray tray: Tray {}
property Status status: Status {}
@ -56,6 +57,12 @@ JsonObject {
property bool brightness: true
}
component Popouts: JsonObject {
property bool activeWindow: true
property bool tray: true
property bool statusIcons: true
}
component Workspaces: JsonObject {
property int shown: 5
property bool activeIndicator: true

View file

@ -45,7 +45,7 @@ ColumnLayout {
const item = ch.item;
const itemHeight = item.implicitHeight;
if (id === "statusIcons") {
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
const items = item.items;
const icon = items.childAt(items.width / 2, mapToItem(items, 0, y).y);
if (icon) {
@ -53,7 +53,7 @@ ColumnLayout {
popouts.currentCenter = Qt.binding(() => icon.mapToItem(root, 0, icon.implicitHeight / 2).y);
popouts.hasCurrent = true;
}
} else if (id === "tray") {
} else if (id === "tray" && Config.bar.popouts.tray) {
if (!Config.bar.tray.compact || (item.expanded && !item.expandIcon.contains(mapToItem(item.expandIcon, item.implicitWidth / 2, y)))) {
const index = Math.floor(((y - top - item.padding * 2 + item.spacing) / item.layout.implicitHeight) * item.items.count);
const trayItem = item.items.itemAt(index);
@ -68,7 +68,7 @@ ColumnLayout {
popouts.hasCurrent = false;
item.expanded = true;
}
} else if (id === "activeWindow") {
} else if (id === "activeWindow" && Config.bar.popouts.activeWindow) {
popouts.currentName = id.toLowerCase();
popouts.currentCenter = item.mapToItem(root, 0, itemHeight / 2).y;
popouts.hasCurrent = true;

View file

@ -45,7 +45,7 @@ Item {
Popout {
name: "battery"
source: "Battery.qml"
sourceComponent: Battery {}
}
Popout {
@ -57,12 +57,12 @@ Item {
Popout {
name: "kblayout"
source: "KbLayout.qml"
sourceComponent: KbLayout {}
}
Popout {
name: "lockstatus"
source: "LockStatus.qml"
sourceComponent: LockStatus {}
}
Repeater {
@ -106,7 +106,7 @@ Item {
id: popout
required property string name
property bool shouldBeActive: root.wrapper.currentName === name
readonly property bool shouldBeActive: root.wrapper.currentName === name
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right