chore: fix dash, drawers, notifs and osd linter warnings

This commit is contained in:
2 * r + 2 * t 2026-03-21 16:31:43 +11:00
parent 83cd02b90d
commit 53109b28e6
9 changed files with 114 additions and 105 deletions

View file

@ -12,7 +12,7 @@ Item {
id: root
required property DrawerVisibilities visibilities
readonly property bool needsKeyboard: content.item?.needsKeyboard ?? false
readonly property bool needsKeyboard: (content.item as Content)?.needsKeyboard ?? false
readonly property DashboardState dashState: DashboardState {
reloadableId: "dashboardState"
}
@ -28,7 +28,7 @@ Item {
}
}
readonly property real nonAnimHeight: state === "visible" ? (content.item?.nonAnimHeight ?? 0) : 0
readonly property real nonAnimHeight: state === "visible" ? ((content.item as Content)?.nonAnimHeight ?? 0) : 0
visible: height > 0
implicitHeight: 0

View file

@ -10,6 +10,7 @@ import Quickshell
import Quickshell.Wayland
import Quickshell.Hyprland
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
Variants {
@ -35,7 +36,7 @@ Variants {
return 0;
const mon = Hypr.monitorFor(screen);
if (mon?.lastIpcObject?.specialWorkspace?.name || mon?.activeWorkspace?.lastIpcObject?.windows > 0)
if (mon?.lastIpcObject.specialWorkspace?.name || mon?.activeWorkspace?.lastIpcObject.windows > 0)
return 0;
const thresholds = [];
@ -90,7 +91,7 @@ Variants {
HyprlandFocusGrab {
id: focusGrab
active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) || (visibilities.sidebar && Config.sidebar.enabled) || (!Config.dashboard.showOnHover && visibilities.dashboard && Config.dashboard.enabled) || (panels.popouts.currentName.startsWith("traymenu") && panels.popouts.current?.depth > 1)
active: (visibilities.launcher && Config.launcher.enabled) || (visibilities.session && Config.session.enabled) || (visibilities.sidebar && Config.sidebar.enabled) || (!Config.dashboard.showOnHover && visibilities.dashboard && Config.dashboard.enabled) || (panels.popouts.currentName.startsWith("traymenu") && (panels.popouts.current as StackView)?.depth > 1)
windows: [win]
onCleared: {
visibilities.launcher = false;

View file

@ -2,6 +2,7 @@ pragma ComponentBehavior: Bound
import qs.components.containers
import qs.config
import qs.modules.bar as Bar
import Quickshell
import QtQuick
@ -9,7 +10,7 @@ Scope {
id: root
required property ShellScreen screen
required property Item bar
required property Bar.BarWrapper bar
ExclusionZone {
anchors.left: true

View file

@ -1,9 +1,11 @@
import qs.components
import qs.components.controls
import qs.config
import qs.modules.bar as Bar
import qs.modules.bar.popouts as BarPopouts
import Quickshell
import QtQuick
import QtQuick.Controls
CustomMouseArea {
id: root
@ -12,7 +14,7 @@ CustomMouseArea {
required property BarPopouts.Wrapper popouts
required property DrawerVisibilities visibilities
required property Panels panels
required property Item bar
required property Bar.BarWrapper bar
property point dragStart
property bool dashboardShortcutActive
@ -69,7 +71,7 @@ CustomMouseArea {
if (!utilitiesShortcutActive)
visibilities.utilities = false;
if (!popouts.currentName.startsWith("traymenu") || (popouts.current?.depth ?? 0) <= 1) {
if (!popouts.currentName.startsWith("traymenu") || ((popouts.current as StackView)?.depth ?? 0) <= 1) {
popouts.hasCurrent = false;
bar.closeTray();
}
@ -202,7 +204,7 @@ CustomMouseArea {
// Show popouts on hover
if (x < bar.implicitWidth) {
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 as StackView)?.depth ?? 0) <= 1) && !inLeftPanel(panels.popouts, x, y)) {
popouts.hasCurrent = false;
bar.closeTray();
}

View file

@ -5,6 +5,7 @@ import qs.modules.notifications as Notifications
import qs.modules.session as Session
import qs.modules.launcher as Launcher
import qs.modules.dashboard as Dashboard
import qs.modules.bar as Bar
import qs.modules.bar.popouts as BarPopouts
import qs.modules.utilities as Utilities
import qs.modules.utilities.toasts as Toasts
@ -17,7 +18,7 @@ Item {
required property ShellScreen screen
required property DrawerVisibilities visibilities
required property Item bar
required property Bar.BarWrapper bar
readonly property alias osd: osd
readonly property alias notifications: notifications
@ -49,7 +50,9 @@ Item {
id: notifications
visibilities: root.visibilities
panels: root
sidebarPanel: sidebar
osdPanel: osd
sessionPanel: session
anchors.top: parent.top
anchors.right: parent.right

View file

@ -11,7 +11,8 @@ Item {
id: root
required property DrawerVisibilities visibilities
required property Item panels
required property Item osdPanel
required property Item sessionPanel
readonly property int padding: Appearance.padding.large
anchors.top: parent.top
@ -26,23 +27,21 @@ Item {
let height = (count - 1) * Appearance.spacing.smaller;
for (let i = 0; i < count; i++)
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
height += (list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0;
if (visibilities && panels) {
if (visibilities.osd) {
const h = panels.osd.y - Config.border.rounding * 2 - padding * 2;
if (height > h)
height = h;
}
if (visibilities.session) {
const h = panels.session.y - Config.border.rounding * 2 - padding * 2;
if (height > h)
height = h;
}
if (visibilities.osd) {
const h = osdPanel.y - Config.border.rounding * 2 - padding * 2;
if (height > h)
height = h;
}
return Math.min((QsWindow.window?.screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
if (visibilities.session) {
const h = sessionPanel.y - Config.border.rounding * 2 - padding * 2;
if (height > h)
height = h;
}
return Math.min(((QsWindow.window as QsWindow)?.screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
}
ClippingWrapperRectangle {
@ -63,79 +62,9 @@ Item {
orientation: Qt.Vertical
spacing: 0
cacheBuffer: QsWindow.window?.screen.height ?? 0
cacheBuffer: (QsWindow.window as QsWindow)?.screen.height ?? 0
delegate: Item {
id: wrapper
required property NotifData modelData
required property int index
readonly property alias nonAnimHeight: notif.nonAnimHeight
property int idx
onIndexChanged: {
if (index !== -1)
idx = index;
}
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight + (idx === 0 ? 0 : Appearance.spacing.smaller)
ListView.onRemove: removeAnim.start()
SequentialAnimation {
id: removeAnim
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: true
}
PropertyAction {
target: wrapper
property: "enabled"
value: false
}
PropertyAction {
target: wrapper
property: "implicitHeight"
value: 0
}
PropertyAction {
target: wrapper
property: "z"
value: 1
}
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2
duration: Appearance.anim.durations.normal
easing.bezierCurve: Appearance.anim.curves.emphasized
}
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: false
}
}
ClippingRectangle {
anchors.top: parent.top
anchors.topMargin: wrapper.idx === 0 ? 0 : Appearance.spacing.smaller
color: "transparent"
radius: notif.radius
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight
Notification {
id: notif
modelData: wrapper.modelData
}
}
}
delegate: NotifWrapper {}
move: Transition {
Anim {
@ -160,7 +89,7 @@ Item {
let height = 0;
for (let i = 0; i < count; i++) {
height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller;
height += ((list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller;
if (height - Appearance.spacing.smaller >= scrollY)
return i;
@ -181,7 +110,7 @@ Item {
let height = 0;
for (let i = count - 1; i >= 0; i--) {
height += (list.itemAtIndex(i)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller;
height += ((list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0) + Appearance.spacing.smaller;
if (height - Appearance.spacing.smaller >= scrollY)
return count - i - 1;
@ -197,6 +126,78 @@ Item {
Anim {}
}
component NotifWrapper: Item {
id: wrapper
required property NotifData modelData
required property int index
readonly property alias nonAnimHeight: notif.nonAnimHeight
property int idx
onIndexChanged: {
if (index !== -1)
idx = index;
}
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight + (idx === 0 ? 0 : Appearance.spacing.smaller)
ListView.onRemove: removeAnim.start()
SequentialAnimation {
id: removeAnim
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: true
}
PropertyAction {
target: wrapper
property: "enabled"
value: false
}
PropertyAction {
target: wrapper
property: "implicitHeight"
value: 0
}
PropertyAction {
target: wrapper
property: "z"
value: 1
}
Anim {
target: notif
property: "x"
to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2
duration: Appearance.anim.durations.normal
easing.bezierCurve: Appearance.anim.curves.emphasized
}
PropertyAction {
target: wrapper
property: "ListView.delayRemove"
value: false
}
}
ClippingRectangle {
anchors.top: parent.top
anchors.topMargin: wrapper.idx === 0 ? 0 : Appearance.spacing.smaller
color: "transparent"
radius: notif.radius
implicitWidth: notif.implicitWidth
implicitHeight: notif.implicitHeight
Notification {
id: notif
modelData: wrapper.modelData
}
}
}
component Anim: NumberAnimation {
duration: Appearance.anim.durations.expressiveDefaultSpatial
easing.type: Easing.BezierSpline

View file

@ -5,11 +5,13 @@ import QtQuick
Item {
id: root
required property var visibilities
required property Item panels
required property DrawerVisibilities visibilities
required property Item sidebarPanel
property alias osdPanel: content.osdPanel
property alias sessionPanel: content.sessionPanel
visible: height > 0
implicitWidth: Math.max(panels.sidebar.width, content.implicitWidth)
implicitWidth: Math.max(sidebarPanel.width, content.implicitWidth)
implicitHeight: content.implicitHeight
states: State {
@ -34,6 +36,5 @@ Item {
id: content
visibilities: root.visibilities
panels: root.panels
}
}

View file

@ -12,7 +12,7 @@ Item {
id: root
required property Brightness.Monitor monitor
required property var visibilities
required property DrawerVisibilities visibilities
required property real volume
required property bool muted

View file

@ -10,7 +10,7 @@ Item {
id: root
required property ShellScreen screen
required property var visibilities
required property DrawerVisibilities visibilities
property bool hovered
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(root.screen)
readonly property bool shouldBeActive: visibilities.osd && Config.osd.enabled && !(visibilities.utilities && Config.utilities.enabled)