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
|
id: root
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property PersistentProperties visibilities
|
||||||
required property BarPopouts.Wrapper popouts
|
required property BarPopouts.Wrapper popouts
|
||||||
|
|
||||||
function checkPopout(y: real): void {
|
function checkPopout(y: real): void {
|
||||||
|
|
@ -169,6 +170,8 @@ Item {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: Appearance.padding.large
|
anchors.bottomMargin: Appearance.padding.large
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@ import "root:/config"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
text: "power_settings_new"
|
text: "power_settings_new"
|
||||||
color: Colours.palette.m3error
|
color: Colours.palette.m3error
|
||||||
font.bold: true
|
font.bold: true
|
||||||
|
|
@ -20,8 +24,7 @@ MaterialIcon {
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
|
|
||||||
function onClicked(): void {
|
function onClicked(): void {
|
||||||
const v = Visibilities.screens[QsWindow.window.screen];
|
root.visibilities.session = !root.visibilities.session;
|
||||||
v.session = !v.session;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ Variants {
|
||||||
id: bar
|
id: bar
|
||||||
|
|
||||||
screen: scope.modelData
|
screen: scope.modelData
|
||||||
|
visibilities: visibilities
|
||||||
popouts: panels.popouts
|
popouts: panels.popouts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,6 @@ Item {
|
||||||
anchors.margins: Config.border.thickness
|
anchors.margins: Config.border.thickness
|
||||||
anchors.leftMargin: bar.implicitWidth
|
anchors.leftMargin: bar.implicitWidth
|
||||||
|
|
||||||
Component.onCompleted: Visibilities.panels[screen] = this
|
|
||||||
|
|
||||||
Osd.Wrapper {
|
Osd.Wrapper {
|
||||||
id: osd
|
id: osd
|
||||||
|
|
||||||
|
|
@ -44,6 +42,9 @@ Item {
|
||||||
Notifications.Wrapper {
|
Notifications.Wrapper {
|
||||||
id: notifications
|
id: notifications
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
panel: root
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import QtQuick
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property Item panel
|
||||||
readonly property int padding: Appearance.padding.large
|
readonly property int padding: Appearance.padding.large
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
@ -24,9 +26,6 @@ Item {
|
||||||
for (let i = 0; i < count; i++)
|
for (let i = 0; i < count; i++)
|
||||||
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
|
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 && panel) {
|
||||||
if (visibilities.osd) {
|
if (visibilities.osd) {
|
||||||
const h = panel.osd.y - Config.border.rounding * 2;
|
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 {
|
ClippingWrapperRectangle {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,21 @@
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
required property Item panel
|
||||||
|
|
||||||
visible: height > 0
|
visible: height > 0
|
||||||
implicitHeight: content.implicitHeight
|
implicitHeight: content.implicitHeight
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
|
|
||||||
Content {
|
Content {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
|
panel: root.panel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import Quickshell
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
property var screens: ({})
|
property var screens: ({})
|
||||||
property var panels: ({})
|
|
||||||
|
|
||||||
function getForActive(): PersistentProperties {
|
function getForActive(): PersistentProperties {
|
||||||
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
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