new style

This commit is contained in:
lucy 2026-01-18 18:26:49 +01:00
parent 849e4d0aa2
commit 7b85ec95a4
9 changed files with 225 additions and 179 deletions

View File

@ -8,43 +8,57 @@ Variants {
delegate: PanelWindow { delegate: PanelWindow {
id: root id: root
required property var modelData
implicitHeight: Settings.config.barHeight implicitHeight: Settings.config.barHeight
aboveWindows: true aboveWindows: true
required property var modelData
color: Qt.rgba(Colors.background.r, Colors.background.g, Colors.background.b, 0.6)
screen: modelData screen: modelData
margins {
top: Settings.config.margins
left: Settings.config.margins
right: Settings.config.margins
}
anchors { anchors {
top: true top: true
left: true left: true
right: true right: true
} }
Row { color: "transparent"
id: leftStuff Rectangle {
leftPadding: 10 id: container
spacing: 20 implicitHeight: Settings.config.barHeight
anchors.left: parent.left anchors.fill: parent
anchors.verticalCenter: parent.verticalCenter color: Colors.background
Workspaces { radius: implicitHeight / 2
property var screen: root.modelData
Row {
id: leftStuff
leftPadding: 10
spacing: 20
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
Workspaces {
property var screen: root.modelData
}
Title {}
} }
Title {}
}
Row { Row {
id: centerStuff id: centerStuff
anchors.centerIn: parent anchors.centerIn: parent
Clock {} Clock {}
} }
Row { Row {
id: rightStuff id: rightStuff
rightPadding: 10 rightPadding: 10
spacing: 10 spacing: 10
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
Volume {} Volume {}
Battery {} Battery {}
SystemTray {} SystemTray {}
}
} }
} }
} }

View File

@ -2,18 +2,28 @@ import Quickshell
import QtQuick import QtQuick
import "../../reusables/" import "../../reusables/"
import "../../settings/" import "../../settings/"
import "../../"
Item { Rectangle {
id: root id: container
implicitWidth: clockText.implicitWidth radius: implicitHeight / 2
implicitHeight: Settings.config.barHeight color: Colors.color0
SystemClock { anchors.verticalCenter: parent.verticalCenter
id: clock implicitHeight: Settings.config.barHeight - 10
precision: SystemClock.Minutes implicitWidth: root.implicitWidth + 20
} Item {
CustomText { id: root
id: clockText
anchors.centerIn: parent anchors.centerIn: parent
text: Qt.formatDateTime(clock.date, "hh:mm") implicitWidth: clockText.implicitWidth
implicitHeight: Settings.config.barHeight
SystemClock {
id: clock
precision: SystemClock.Minutes
}
CustomText {
id: clockText
anchors.centerIn: parent
text: Qt.formatDateTime(clock.date, "hh:mm")
}
} }
} }

View File

@ -1,19 +1,26 @@
import QtQuick import QtQuick
import "../../reusables/" import "../../reusables/"
import "../../settings/" import "../../settings/"
import Quickshell.Hyprland import "../../"
import Quickshell.Wayland
Item { Rectangle {
id: root id: container
readonly property var activeWindow: Hyprland.activeToplevel radius: implicitHeight / 2
implicitWidth: Math.min(text.implicitWidth, 500) color: Colors.color0
implicitHeight: Settings.config.barHeight anchors.verticalCenter: parent.verticalCenter
CustomText { implicitWidth: root.implicitWidth
anchors.left: parent.left implicitHeight: Settings.config.barHeight - 10
anchors.right: parent.right Item {
id: text id: root
anchors.verticalCenter: parent.verticalCenter readonly property var activeWindow: ToplevelManager.activeToplevel
text: root.activeWindow ? Hyprland.activeToplevel.title : "Desktop" implicitWidth:titleText.implicitWidth + 20
elide: Text.ElideRight implicitHeight: Settings.config.barHeight
CustomText {
anchors.horizontalCenter: parent.horizontalCenter
id: titleText
text: root.activeWindow.activated ? root.activeWindow.appId : "Desktop"
elide: Text.ElideRight
}
} }
} }

View File

@ -6,60 +6,69 @@ import "../../reusables/"
import "../../settings/" import "../../settings/"
import "../../" import "../../"
Item { Rectangle {
id: root id: container
implicitWidth: textRow.width radius: implicitHeight / 2
implicitHeight: Settings.config.barHeight color: Colors.color0
property var sink: Pipewire.defaultAudioSink anchors.verticalCenter: parent.verticalCenter
function getVolumeIcon() { implicitWidth: root.implicitWidth + 20
// Safety check: if Pipewire is dead or sink is missing implicitHeight: Settings.config.barHeight - 10
if (!sink) Item {
return "volume_off"; id: root
anchors.centerIn: parent
implicitWidth: textRow.width
implicitHeight: Settings.config.barHeight
property var sink: Pipewire.defaultAudioSink
function getVolumeIcon() {
// Safety check: if Pipewire is dead or sink is missing
if (!sink)
return "volume_off";
// If muted, show the hush icon // If muted, show the hush icon
if (sink.audio.muted) if (sink.audio.muted)
return "volume_off"; return "volume_off";
// Volume is usually 0.0 to 1.0 (0% to 100%) // Volume is usually 0.0 to 1.0 (0% to 100%)
const vol = sink.audio.volume; const vol = sink.audio.volume;
if (vol <= 0.25) if (vol <= 0.25)
return "volume_mute"; return "volume_mute";
if (vol < 0.75) if (vol < 0.75)
return "volume_down"; return "volume_down";
if (vol <= 1.00) if (vol <= 1.00)
return "volume_up";
// If it's loud, prepare the ears!
return "volume_up"; return "volume_up";
}
// If it's loud, prepare the ears! Row {
return "volume_up"; id: textRow
} anchors.verticalCenter: parent.verticalCenter
Row { spacing: 0
id: textRow CustomText {
anchors.verticalCenter: parent.verticalCenter id: volumeText
spacing: 0 PwObjectTracker {
CustomText { objects: Pipewire.ready ? Pipewire.defaultAudioSink : []
id: volumeText }
PwObjectTracker { text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure"
objects: Pipewire.ready ? Pipewire.defaultAudioSink : [] opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
}
CustomIcon {
id: volumeIcon
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
text: Pipewire.ready ? root.getVolumeIcon() : null
} }
text: Pipewire.ready ? Math.round(root.sink.audio.volume * 100) + "%" : "failure"
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0
} }
CustomIcon { MouseArea {
id: volumeIcon id: pavuArea
opacity: Pipewire.ready ? root.sink.audio.muted ? 0.5 : 1 : 0 Process {
text: Pipewire.ready ? root.getVolumeIcon() : null id: pavuLauncher
command: ["sh", "-c", "pavucontrol"]
}
anchors.fill: root
onClicked: pavuLauncher.exec(pavuLauncher.command)
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
} }
} }
MouseArea {
id: pavuArea
Process {
id: pavuLauncher
command: ["sh", "-c", "pavucontrol"]
}
anchors.fill: root
onClicked: pavuLauncher.exec(pavuLauncher.command)
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
}
} }

View File

@ -2,13 +2,7 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland
import "."
import "../../"
import QtQuick.Layouts
import Quickshell.Widgets
import "../../settings/" import "../../settings/"
import "../../reusables/"
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
@ -23,7 +17,7 @@ Variants {
bottom: true bottom: true
} }
margins { margins {
top: Settings.config.barHeight + 10 top: Settings.config.barHeight + Settings.config.margins + 10
right: 10 right: 10
left: 10 left: 10
} }
@ -48,80 +42,7 @@ Variants {
height: contentHeight height: contentHeight
model: NotiServer.trackedNotifications model: NotiServer.trackedNotifications
delegate: Item { delegate: NotificationCard {}
id: notifyItem
required property var index
required property var modelData
anchors.right: parent ? parent.right : root.anchors.right
implicitWidth: root.modelData.width / 8
implicitHeight: notiIcon.implicitHeight + 20
Timer {
id: dismissTimer
interval: 5000
running: true
onTriggered: parent.modelData.dismiss()
}
Rectangle {
anchors.fill: parent
color: Colors.background
border.color: Colors.color5
border.width: 2
RowLayout {
id: fullLayout
anchors.margins: 10
anchors.fill: parent
spacing: 10
ClippingWrapperRectangle {
id: notiIcon
radius: 0
implicitWidth: 64
implicitHeight: 64
visible: notifyItem.modelData.image !== ""
IconImage {
source: notifyItem.modelData.image
visible: notifyItem.modelData.image !== ""
implicitSize: 30
asynchronous: true
}
}
ColumnLayout {
id: textLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
spacing: 2
CustomText {
text: notifyItem.modelData.summary
font.bold: true
elide: Text.ElideRight
Layout.fillWidth: true
onTextChanged: dismissTimer.restart()
}
CustomText {
text: notifyItem.modelData.body
maximumLineCount: 3
wrapMode: Text.WordWrap
elide: Text.ElideRight
Layout.fillWidth: true
}
}
}
MouseArea {
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
acceptedButtons: Qt.LeftButton
onClicked: notifyItem.modelData.dismiss()
}
}
}
} }
} }
} }

View File

@ -0,0 +1,77 @@
import QtQuick
import QtQuick.Layouts
import "../../"
import "../../reusables"
import Quickshell.Widgets
Rectangle {
id: notifyItem
required property var modelData
implicitWidth: ListView.view ? ListView.view.width : 300
implicitHeight: fullLayout.implicitHeight + 20
color: Colors.background
border.color: dismissArea.containsMouse ? Colors.foreground : Colors.color8
radius: 24
Timer {
id: dismissTimer
interval: 5000
running: true
onTriggered: notifyItem.modelData.dismiss()
}
RowLayout {
id: fullLayout
anchors.margins: 10
anchors.fill: parent
spacing: 10
ClippingWrapperRectangle {
id: notiIcon
radius: notifyItem.radius - notifyItem.radius / 3
implicitWidth: 64
implicitHeight: 64
visible: notifyItem.modelData.image !== ""
IconImage {
source: notifyItem.modelData.image
visible: notifyItem.modelData.image !== ""
implicitSize: 30
asynchronous: true
}
}
ColumnLayout {
id: textLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
spacing: 2
CustomText {
id: summary
text: notifyItem.modelData.summary
font.bold: true
elide: Text.ElideRight
Layout.fillWidth: true
onTextChanged: {
dismissTimer.restart();
}
}
CustomText {
text: notifyItem.modelData.body
maximumLineCount: 2
wrapMode: Text.WordWrap
elide: Text.ElideRight
Layout.fillWidth: true
}
}
}
MouseArea {
id: dismissArea
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: notifyItem.modelData.dismiss()
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
}
}

View File

@ -1,2 +1,4 @@
singleton NotiServer 1.0 NotiServer.qml singleton NotiServer 1.0 NotiServer.qml
Notification 1.0 Notification.qml Notification 1.0 Notification.qml
NotificationCard 1.0 NotificationCard.qml

View File

@ -0,0 +1,5 @@
import Quickshell
import Quickshell.Services.Polkit

View File

@ -21,6 +21,7 @@ Singleton {
adapter: JsonAdapter { adapter: JsonAdapter {
id: settingsAdapter id: settingsAdapter
property var margins: 10
property var currentWall: "" property var currentWall: ""
property var barHeight: 28 property var barHeight: 28
property var font: "Google Sans" property var font: "Google Sans"