286 lines
6.6 KiB
QML
286 lines
6.6 KiB
QML
import Quickshell
|
|
import QtQuick
|
|
import qs.Components
|
|
import qs.Modules as Modules
|
|
import qs.Modules.Notifications as Notifications
|
|
import qs.Modules.Notifications.Sidebar as Sidebar
|
|
import qs.Modules.Notifications.Sidebar.Utils as Utils
|
|
import qs.Modules.Dashboard as Dashboard
|
|
import qs.Modules.Osd as Osd
|
|
import qs.Components.Toast as Toasts
|
|
import qs.Modules.Launcher as Launcher
|
|
import qs.Modules.Resources as Resources
|
|
import qs.Modules.Settings as Settings
|
|
import qs.Modules.Drawing as Drawing
|
|
import qs.Modules.Dock as Dock
|
|
import qs.Modules.SysTray.Popouts as SysPopouts
|
|
import qs.Config
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property Item bar
|
|
readonly property alias dashboard: dashboard
|
|
readonly property alias dashboardWrapper: dashboardWrapper
|
|
readonly property alias dock: dock
|
|
readonly property alias drawing: drawing
|
|
required property Canvas drawingItem
|
|
readonly property alias launcher: launcher
|
|
readonly property alias notifications: notifications
|
|
readonly property alias osd: osd
|
|
readonly property alias osdWrapper: osdWrapper
|
|
readonly property alias popouts: popouts.content
|
|
readonly property alias popoutsWrapper: popouts
|
|
readonly property alias resources: resources
|
|
readonly property alias resourcesWrapper: resourcesWrapper
|
|
required property ShellScreen screen
|
|
readonly property alias settings: settings
|
|
readonly property alias settingsWrapper: settingsWrapper
|
|
readonly property alias sidebar: sidebar
|
|
readonly property alias toasts: toasts
|
|
readonly property alias traySubmenus: traySubmenus
|
|
readonly property alias utilities: utilities
|
|
required property PersistentProperties visibilities
|
|
|
|
anchors.fill: parent
|
|
anchors.margins: Config.barConfig.border
|
|
anchors.topMargin: bar.implicitHeight
|
|
|
|
Item {
|
|
id: resourcesWrapper
|
|
|
|
anchors.left: parent.left
|
|
anchors.top: parent.top
|
|
clip: true
|
|
implicitHeight: resources.implicitHeight * (1 - resources.offsetScale)
|
|
implicitWidth: resources.implicitWidth
|
|
|
|
Resources.Wrapper {
|
|
id: resources
|
|
|
|
anchors.left: parent.left
|
|
anchors.top: parent.top
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Item {
|
|
id: osdWrapper
|
|
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: sidebar.width * (1 - sidebar.offsetScale)
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
clip: sidebar.visible
|
|
implicitHeight: osd.implicitHeight
|
|
implicitWidth: osd.implicitWidth * (1 - osd.offsetScale)
|
|
|
|
Osd.Wrapper {
|
|
id: osd
|
|
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
screen: root.screen
|
|
sidebarOrSessionVisible: sidebar.visible
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Drawing.Wrapper {
|
|
id: drawing
|
|
|
|
anchors.left: parent.left
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
drawing: root.drawingItem
|
|
screen: root.screen
|
|
visibilities: root.visibilities
|
|
}
|
|
|
|
Item {
|
|
id: traySubmenus
|
|
|
|
Repeater {
|
|
model: popouts.content.state.submenus
|
|
|
|
CustomClippingRect {
|
|
id: subMenuWrapper
|
|
|
|
required property int index
|
|
required property var modelData
|
|
property real targetX: 0
|
|
property real targetY: 0
|
|
|
|
function updatePosition() {
|
|
let sourceItem = modelData.sourceItem;
|
|
if (!sourceItem || !sourceItem.parent)
|
|
return;
|
|
|
|
let mapped = sourceItem.mapToItem(root, 0, -Appearance.padding.small);
|
|
|
|
let rightX = mapped.x + modelData.sourceWidth + Config.barConfig.border;
|
|
let leftX = mapped.x - implicitWidth - Config.barConfig.border;
|
|
|
|
if (rightX + implicitWidth > root.width) {
|
|
targetX = leftX;
|
|
} else {
|
|
targetX = rightX;
|
|
}
|
|
|
|
targetY = mapped.y;
|
|
|
|
if (targetY + implicitHeight > root.height) {
|
|
targetY = root.height - implicitHeight;
|
|
}
|
|
if (targetY < 0)
|
|
targetY = 0;
|
|
}
|
|
|
|
implicitHeight: subMenuContent.implicitHeight + Appearance.padding.small * 2
|
|
implicitWidth: subMenuContent.implicitWidth + Appearance.padding.small * 2
|
|
radius: Appearance.rounding.normal
|
|
x: targetX
|
|
y: targetY
|
|
|
|
Behavior on implicitHeight {
|
|
Anim {
|
|
}
|
|
}
|
|
Behavior on implicitWidth {
|
|
Anim {
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
updatePosition();
|
|
}
|
|
onImplicitHeightChanged: updatePosition()
|
|
onImplicitWidthChanged: updatePosition()
|
|
|
|
SysPopouts.SubMenu {
|
|
id: subMenuContent
|
|
|
|
anchors.centerIn: parent
|
|
handle: subMenuWrapper.modelData.handle
|
|
level: subMenuWrapper.index + 1
|
|
popouts: root.popouts.state
|
|
screen: root.screen
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Modules.ClipWrapper {
|
|
id: popouts
|
|
|
|
anchors.top: parent.top
|
|
screen: root.screen
|
|
}
|
|
|
|
Toasts.Toasts {
|
|
id: toasts
|
|
|
|
anchors.bottom: sidebar.visible ? parent.bottom : utilities.top
|
|
anchors.margins: Appearance.padding.normal
|
|
anchors.right: sidebar.left
|
|
}
|
|
|
|
Notifications.Wrapper {
|
|
id: notifications
|
|
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
panels: root
|
|
sidebarPanel: sidebar
|
|
visibilities: root.visibilities
|
|
}
|
|
|
|
Launcher.Wrapper {
|
|
id: launcher
|
|
|
|
anchors.bottom: parent.bottom
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
panels: root
|
|
screen: root.screen
|
|
visibilities: root.visibilities
|
|
}
|
|
|
|
Utils.Wrapper {
|
|
id: utilities
|
|
|
|
anchors.bottom: parent.bottom
|
|
anchors.right: parent.right
|
|
popouts: popouts
|
|
sidebar: sidebar
|
|
visibilities: root.visibilities
|
|
}
|
|
|
|
Item {
|
|
id: dashboardWrapper
|
|
|
|
property real offsetScale: dashboard.shouldBeActive ? 0 : 1
|
|
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
clip: true
|
|
implicitHeight: dashboard.implicitHeight * (1 - offsetScale)
|
|
implicitWidth: dashboard.implicitWidth
|
|
|
|
Behavior on offsetScale {
|
|
Anim {
|
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
|
}
|
|
}
|
|
|
|
Dashboard.Wrapper {
|
|
id: dashboard
|
|
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
anchors.topMargin: (-implicitHeight - 5) * offsetScale
|
|
offsetScale: dashboardWrapper.offsetScale
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Sidebar.Wrapper {
|
|
id: sidebar
|
|
|
|
anchors.bottom: utilities.top
|
|
anchors.right: parent.right
|
|
anchors.top: notifications.bottom
|
|
panels: root
|
|
visibilities: root.visibilities
|
|
}
|
|
|
|
Item {
|
|
id: settingsWrapper
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.top: parent.top
|
|
clip: true
|
|
implicitHeight: settings.implicitHeight * (1 - settings.offsetScale)
|
|
implicitWidth: settings.implicitWidth
|
|
|
|
Settings.Wrapper {
|
|
id: settings
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
anchors.top: parent.top
|
|
// anchors.centerIn: parent
|
|
panels: root
|
|
screen: root.screen
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|
|
|
|
Dock.Wrapper {
|
|
id: dock
|
|
|
|
anchors.bottom: parent.bottom
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
panels: root
|
|
screen: root.screen
|
|
visibilities: root.visibilities
|
|
}
|
|
}
|