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, "persistent": true,
"popouts": {
"activeWindow": true,
"statusIcons": true,
"tray": true
},
"scrollActions": { "scrollActions": {
"brightness": true, "brightness": true,
"workspaces": true, "workspaces": true,

View file

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

View file

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

View file

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