parent
9cc751df32
commit
d191ac44b5
7 changed files with 97 additions and 16 deletions
|
|
@ -371,6 +371,7 @@ default, you must create it manually.
|
||||||
},
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
"background": false,
|
"background": false,
|
||||||
|
"compact": false,
|
||||||
"iconSubs": [],
|
"iconSubs": [],
|
||||||
"recolour": false
|
"recolour": false
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ JsonObject {
|
||||||
component Tray: JsonObject {
|
component Tray: JsonObject {
|
||||||
property bool background: false
|
property bool background: false
|
||||||
property bool recolour: false
|
property bool recolour: false
|
||||||
|
property bool compact: false
|
||||||
property list<var> iconSubs: []
|
property list<var> iconSubs: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,24 @@ ColumnLayout {
|
||||||
required property BarPopouts.Wrapper popouts
|
required property BarPopouts.Wrapper popouts
|
||||||
readonly property int vPadding: Appearance.padding.large
|
readonly property int vPadding: Appearance.padding.large
|
||||||
|
|
||||||
|
function closeTray(): void {
|
||||||
|
if (!Config.bar.tray.compact)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (let i = 0; i < repeater.count; i++) {
|
||||||
|
const item = repeater.itemAt(i);
|
||||||
|
if (item?.enabled && item.id === "tray") {
|
||||||
|
item.item.expanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function checkPopout(y: real): void {
|
function checkPopout(y: real): void {
|
||||||
const ch = childAt(width / 2, y) as WrappedLoader;
|
const ch = childAt(width / 2, y) as WrappedLoader;
|
||||||
|
|
||||||
|
if (ch?.id !== "tray")
|
||||||
|
closeTray();
|
||||||
|
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
return;
|
return;
|
||||||
|
|
@ -38,12 +54,19 @@ ColumnLayout {
|
||||||
popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
}
|
}
|
||||||
} else if (id === "tray") {
|
} else if (id === "tray") {
|
||||||
const index = Math.floor(((y - top) / itemHeight) * item.items.count);
|
if (!Config.bar.tray.compact || (item.expanded && !item.expandIcon.contains(mapToItem(item.expandIcon, item.implicitWidth / 2, y)))) {
|
||||||
const trayItem = item.items.itemAt(index);
|
const index = Math.floor(((y - top - item.padding * 2 + item.spacing) / item.layout.implicitHeight) * item.items.count);
|
||||||
if (trayItem) {
|
const trayItem = item.items.itemAt(index);
|
||||||
popouts.currentName = `traymenu${index}`;
|
if (trayItem) {
|
||||||
popouts.currentCenter = Qt.binding(() => trayItem.mapToItem(root, 0, trayItem.implicitHeight / 2).y);
|
popouts.currentName = `traymenu${index}`;
|
||||||
popouts.hasCurrent = true;
|
popouts.currentCenter = Qt.binding(() => trayItem.mapToItem(root, 0, trayItem.implicitHeight / 2).y);
|
||||||
|
popouts.hasCurrent = true;
|
||||||
|
} else {
|
||||||
|
popouts.hasCurrent = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
popouts.hasCurrent = false;
|
||||||
|
item.expanded = true;
|
||||||
}
|
}
|
||||||
} else if (id === "activeWindow") {
|
} else if (id === "activeWindow") {
|
||||||
popouts.currentName = id.toLowerCase();
|
popouts.currentName = id.toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ Item {
|
||||||
readonly property bool shouldBeVisible: Config.bar.persistent || visibilities.bar || isHovered
|
readonly property bool shouldBeVisible: Config.bar.persistent || visibilities.bar || isHovered
|
||||||
property bool isHovered
|
property bool isHovered
|
||||||
|
|
||||||
|
function closeTray(): void {
|
||||||
|
content.item?.closeTray();
|
||||||
|
}
|
||||||
|
|
||||||
function checkPopout(y: real): void {
|
function checkPopout(y: real): void {
|
||||||
content.item?.checkPopout(y);
|
content.item?.checkPopout(y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.services
|
import qs.services
|
||||||
import qs.config
|
import qs.config
|
||||||
|
|
@ -7,13 +9,22 @@ import QtQuick
|
||||||
StyledRect {
|
StyledRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
readonly property alias layout: layout
|
||||||
readonly property alias items: items
|
readonly property alias items: items
|
||||||
|
readonly property alias expandIcon: expandIcon
|
||||||
|
readonly property int padding: Config.bar.tray.background ? Appearance.padding.normal : Appearance.padding.small
|
||||||
|
readonly property int spacing: Config.bar.tray.background ? Appearance.spacing.small : 0
|
||||||
|
property bool expanded
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
visible: width > 0 && height > 0 // To avoid warnings about being visible with no size
|
visible: height > 0
|
||||||
|
|
||||||
implicitWidth: Config.bar.sizes.innerWidth
|
implicitWidth: Config.bar.sizes.innerWidth
|
||||||
implicitHeight: layout.implicitHeight + (Config.bar.tray.background ? Appearance.padding.normal : Appearance.padding.small) * 2
|
implicitHeight: {
|
||||||
|
if (!Config.bar.tray.compact)
|
||||||
|
return layout.implicitHeight + padding * 2;
|
||||||
|
return (expanded ? expandIcon.implicitHeight + layout.implicitHeight + spacing : expandIcon.implicitHeight) + padding * 2;
|
||||||
|
}
|
||||||
|
|
||||||
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Config.bar.tray.background ? Colours.tPalette.m3surfaceContainer.a : 0)
|
color: Qt.alpha(Colours.tPalette.m3surfaceContainer, Config.bar.tray.background ? Colours.tPalette.m3surfaceContainer.a : 0)
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
|
|
@ -21,9 +32,13 @@ StyledRect {
|
||||||
Column {
|
Column {
|
||||||
id: layout
|
id: layout
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: root.padding
|
||||||
spacing: Appearance.spacing.small
|
spacing: Appearance.spacing.small
|
||||||
|
|
||||||
|
opacity: root.expanded || !Config.bar.tray.compact ? 1 : 0
|
||||||
|
|
||||||
add: Transition {
|
add: Transition {
|
||||||
Anim {
|
Anim {
|
||||||
properties: "scale"
|
properties: "scale"
|
||||||
|
|
@ -51,17 +66,49 @@ StyledRect {
|
||||||
|
|
||||||
TrayItem {}
|
TrayItem {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
Loader {
|
||||||
Anim {
|
id: expandIcon
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
active: Config.bar.tray.compact
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
|
implicitWidth: expandIconInner.implicitWidth
|
||||||
|
implicitHeight: expandIconInner.implicitHeight - Appearance.padding.small * 2
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
id: expandIconInner
|
||||||
|
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.bottomMargin: Config.bar.tray.background ? Appearance.padding.small : -Appearance.padding.small
|
||||||
|
text: "expand_less"
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
rotation: root.expanded ? 180 : 0
|
||||||
|
|
||||||
|
Behavior on rotation {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on anchors.bottomMargin {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
Anim {
|
Anim {
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ Variants {
|
||||||
visibilities.sidebar = false;
|
visibilities.sidebar = false;
|
||||||
visibilities.dashboard = false;
|
visibilities.dashboard = false;
|
||||||
panels.popouts.hasCurrent = false;
|
panels.popouts.hasCurrent = false;
|
||||||
|
bar.closeTray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,10 @@ CustomMouseArea {
|
||||||
if (!utilitiesShortcutActive)
|
if (!utilitiesShortcutActive)
|
||||||
visibilities.utilities = false;
|
visibilities.utilities = false;
|
||||||
|
|
||||||
if (!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1)
|
if (!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1) {
|
||||||
popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
|
bar.closeTray();
|
||||||
|
}
|
||||||
|
|
||||||
if (Config.bar.showOnHover)
|
if (Config.bar.showOnHover)
|
||||||
bar.isHovered = false;
|
bar.isHovered = false;
|
||||||
|
|
@ -197,10 +199,12 @@ CustomMouseArea {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show popouts on hover
|
// Show popouts on hover
|
||||||
if (x < bar.implicitWidth)
|
if (x < bar.implicitWidth) {
|
||||||
bar.checkPopout(y);
|
bar.checkPopout(y);
|
||||||
else if ((!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1) && !inLeftPanel(panels.popouts, x, y))
|
} else if ((!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1) && !inLeftPanel(panels.popouts, x, y)) {
|
||||||
popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
|
bar.closeTray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Monitor individual visibility changes
|
// Monitor individual visibility changes
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue