Everything in Bar

This commit is contained in:
quadbyte 2025-08-10 13:49:27 -04:00
parent 8b31da594c
commit aaf2aba0f8
5 changed files with 108 additions and 103 deletions

View file

@ -6,7 +6,7 @@ import qs.Services
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
PanelWindow { delegate: PanelWindow {
required property ShellScreen modelData required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl( property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png") "../../Assets/Tests/wallpaper.png")

View file

@ -7,7 +7,7 @@ import qs.Services
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
PanelWindow { delegate: PanelWindow {
required property ShellScreen modelData required property ShellScreen modelData
property string wallpaperSource: Qt.resolvedUrl( property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png") "../../Assets/Tests/wallpaper.png")

View file

@ -1,21 +1,23 @@
import QtQuick import QtQuick
import Quickshell
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import qs.Widgets import Quickshell
import qs.Services import qs.Services
import qs.Widgets
PanelWindow { Variants {
model: Quickshell.screens
delegate: PanelWindow {
id: root id: root
required property ShellScreen modelData
readonly property real scaling: Scaling.scale(screen) readonly property real scaling: Scaling.scale(screen)
property var modelData
screen: modelData screen: modelData
implicitHeight: Style.barHeight * scaling implicitHeight: Style.barHeight * scaling
color: "transparent" color: "transparent"
visible: Settings.data.bar.monitors.includes(modelData.name) visible: Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)
|| (Settings.data.bar.monitors.length === 0)
anchors { anchors {
top: true top: true
@ -30,6 +32,7 @@ PanelWindow {
// Background fill // Background fill
Rectangle { Rectangle {
id: bar id: bar
anchors.fill: parent anchors.fill: parent
color: Colors.backgroundPrimary color: Colors.backgroundPrimary
layer.enabled: true layer.enabled: true
@ -37,6 +40,7 @@ PanelWindow {
Row { Row {
id: leftSection id: leftSection
height: parent.height height: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.marginSmall * scaling anchors.leftMargin: Style.marginSmall * scaling
@ -47,20 +51,25 @@ PanelWindow {
text: screen.name text: screen.name
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
id: centerSection id: centerSection
height: parent.height height: parent.height
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginSmall * scaling spacing: Style.marginSmall * scaling
Workspace {} Workspace {
}
} }
Row { Row {
id: rightSection id: rightSection
height: parent.height height: parent.height
anchors.right: bar.right anchors.right: bar.right
anchors.rightMargin: Style.marginSmall * scaling anchors.rightMargin: Style.marginSmall * scaling
@ -73,32 +82,38 @@ PanelWindow {
NIconButton { NIconButton {
id: demoPanelToggle id: demoPanelToggle
icon: "experiment" icon: "experiment"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: function () { onClicked: function() {
demoPanel.isLoaded = !demoPanel.isLoaded demoPanel.isLoaded = !demoPanel.isLoaded;
} }
} }
NIconButton { NIconButton {
id: sidePanelToggle id: sidePanelToggle
icon: "widgets" icon: "widgets"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
onClicked: function () { onClicked: function() {
// Map this button's center to the screen and open the side panel below it // Map this button's center to the screen and open the side panel below it
const localCenterX = width / 2 const localCenterX = width / 2;
const localCenterY = height / 2 const localCenterY = height / 2;
const globalPoint = mapToItem(null, localCenterX, localCenterY) const globalPoint = mapToItem(null, localCenterX, localCenterY);
if (sidePanel.isLoaded) { if (sidePanel.isLoaded)
sidePanel.isLoaded = false sidePanel.isLoaded = false;
} else if (sidePanel.openAt) { else if (sidePanel.openAt)
sidePanel.openAt(globalPoint.x, screen) sidePanel.openAt(globalPoint.x, screen);
} else { else
// Fallback: toggle if API unavailable // Fallback: toggle if API unavailable
sidePanel.isLoaded = true sidePanel.isLoaded = true;
} }
} }
} }
} }
} }
} }

View file

@ -1,10 +0,0 @@
import Quickshell
import qs.Modules.Bar
Variants {
model: Quickshell.screens
delegate: Bar {
modelData: item
}
}

View file

@ -17,7 +17,7 @@ ShellRoot {
Background {} Background {}
Overview {} Overview {}
ScreenCorners {} ScreenCorners {}
Bars {} Bar {}
DemoPanel { DemoPanel {
id: demoPanel id: demoPanel