internal: pass around visibilities
Instead of singleton Also for panels
This commit is contained in:
parent
fbb9394038
commit
c3e8127422
7 changed files with 22 additions and 9 deletions
|
|
@ -11,6 +11,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property PersistentProperties visibilities
|
||||
required property BarPopouts.Wrapper popouts
|
||||
|
||||
function checkPopout(y: real): void {
|
||||
|
|
@ -169,6 +170,8 @@ Item {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: Appearance.padding.large
|
||||
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ import "root:/config"
|
|||
import Quickshell
|
||||
|
||||
MaterialIcon {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
text: "power_settings_new"
|
||||
color: Colours.palette.m3error
|
||||
font.bold: true
|
||||
|
|
@ -20,8 +24,7 @@ MaterialIcon {
|
|||
radius: Appearance.rounding.full
|
||||
|
||||
function onClicked(): void {
|
||||
const v = Visibilities.screens[QsWindow.window.screen];
|
||||
v.session = !v.session;
|
||||
root.visibilities.session = !root.visibilities.session;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ Variants {
|
|||
id: bar
|
||||
|
||||
screen: scope.modelData
|
||||
visibilities: visibilities
|
||||
popouts: panels.popouts
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ Item {
|
|||
anchors.margins: Config.border.thickness
|
||||
anchors.leftMargin: bar.implicitWidth
|
||||
|
||||
Component.onCompleted: Visibilities.panels[screen] = this
|
||||
|
||||
Osd.Wrapper {
|
||||
id: osd
|
||||
|
||||
|
|
@ -44,6 +42,9 @@ Item {
|
|||
Notifications.Wrapper {
|
||||
id: notifications
|
||||
|
||||
visibilities: root.visibilities
|
||||
panel: root
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import QtQuick
|
|||
Item {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
required property Item panel
|
||||
readonly property int padding: Appearance.padding.large
|
||||
|
||||
anchors.top: parent.top
|
||||
|
|
@ -24,9 +26,6 @@ Item {
|
|||
for (let i = 0; i < count; i++)
|
||||
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
|
||||
|
||||
const screen = QsWindow.window?.screen;
|
||||
const visibilities = Visibilities.screens[screen];
|
||||
const panel = Visibilities.panels[screen];
|
||||
if (visibilities && panel) {
|
||||
if (visibilities.osd) {
|
||||
const h = panel.osd.y - Config.border.rounding * 2;
|
||||
|
|
@ -41,7 +40,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
return Math.min((screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
|
||||
return Math.min((QsWindow.window?.screen?.height ?? 0) - Config.border.thickness * 2, height + padding * 2);
|
||||
}
|
||||
|
||||
ClippingWrapperRectangle {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,21 @@
|
|||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property PersistentProperties visibilities
|
||||
required property Item panel
|
||||
|
||||
visible: height > 0
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: content.implicitWidth
|
||||
|
||||
Content {
|
||||
id: content
|
||||
|
||||
visibilities: root.visibilities
|
||||
panel: root.panel
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import Quickshell
|
|||
|
||||
Singleton {
|
||||
property var screens: ({})
|
||||
property var panels: ({})
|
||||
|
||||
function getForActive(): PersistentProperties {
|
||||
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue