New update to current version

This commit is contained in:
2026-03-12 00:10:08 -04:00
parent fbd7836ffd
commit 79f8a99c86
8 changed files with 252 additions and 253 deletions

View File

@@ -6,93 +6,94 @@ import qs.common
import qs.common.widgets import qs.common.widgets
Scope { Scope {
Variants { Variants {
model: Quickshell.screens; model: Quickshell.screens
PanelWindow { PanelWindow {
required property var modelData required property var modelData
screen: modelData screen: modelData
WlrLayershell.layer: WlrLayer.Bottom WlrLayershell.layer: WlrLayer.Bottom
color: "transparent" color: "transparent"
Rectangle {
id: barBackground
anchors {
fill: parent
margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
}
color: Config.options.bar.showBackground ? Appearance.colors.colLayer1 : "transparent"
}
anchors {
top: true
left: true
right: true
}
implicitHeight: Config.options.bar.height Rectangle {
id: barBackground
anchors {
fill: parent
margins: Config.options.bar.cornerStyle === 1 ? (Appearance.sizes.hyprlandGapsOut) : 0
}
color: Config.options.bar.showBackground ? Appearance.colors.colLayer1 : "transparent"
}
RowLayout { // Left Section anchors {
id: leftSection top: true
anchors { left: true
verticalCenter: parent.verticalCenter right: true
left: parent.left }
leftMargin: 5
}
spacing: Config.options?.bar.borderless ? 4 : 8
Workspaces {}
}
RowLayout { // Middle section implicitHeight: Config.options.bar.height
id: middleSection
anchors.centerIn: parent
spacing: Config.options?.bar.borderless ? 4 : 8
Media { RowLayout { // Left Section
visible: true id: leftSection
Layout.fillWidth: true anchors {
} verticalCenter: parent.verticalCenter
} left: parent.left
leftMargin: 5
}
spacing: Config.options?.bar.borderless ? 4 : 8
Workspaces {}
}
RowLayout { // Right Section RowLayout { // Middle section
id: rightSection id: middleSection
anchors { anchors.centerIn: parent
verticalCenter: parent.verticalCenter spacing: Config.options?.bar.borderless ? 4 : 8
right: parent.right
rightMargin: 5 Media {
visible: true
Layout.fillWidth: true
}
}
RowLayout { // Right Section
id: rightSection
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 5
}
spacing: Config.options?.bar.borderless ? 4 : 8
SysTray {
Layout.fillWidth: false
Layout.fillHeight: true
}
StyledText {
Layout.alignment: Qt.AlignVCenter
font.pixelSize: Appearance.font.pixelSize.larger
color: Appearance.colors.colSubtext
text: "•"
visible: true
}
NotificationIcon {
Layout.fillWidth: false
Layout.fillHeight: true
}
StyledText {
Layout.alignment: Qt.AlignVCenter
font.pixelSize: Appearance.font.pixelSize.larger
color: Appearance.colors.colSubtext
text: "•"
visible: true
}
ClockWidget {
id: clock
Layout.alignment: Qt.AlignVCenter
Layout.fillHeight: true
Layout.fillWidth: false
}
PowerButton {
Layout.fillWidth: false
Layout.fillHeight: true
}
}
} }
spacing: Config.options?.bar.borderless ? 4 : 8
SysTray {
Layout.fillWidth: false
Layout.fillHeight: true
}
StyledText {
Layout.alignment: Qt.AlignVCenter
font.pixelSize: Appearance.font.pixelSize.larger
color: Appearance.colors.colSubtext
text: "•"
visible: true
}
NotificationIcon {
Layout.fillWidth: false
Layout.fillHeight: true
}
StyledText {
Layout.alignment: Qt.AlignVCenter
font.pixelSize: Appearance.font.pixelSize.larger
color: Appearance.colors.colSubtext
text: "•"
visible: true
}
ClockWidget {
id: clock
Layout.fillHeight: true
Layout.fillWidth: false
}
PowerButton {
Layout.fillWidth: false
Layout.fillHeight: true
}
}
} }
} }
}

View File

@@ -1,4 +1,4 @@
import qs.modules.common import qs.common
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
@@ -6,4 +6,4 @@ Item {
id: root id: root
property real padding: 5 property real padding: 5
implicitHeight: Appearance.sizes.baseBarHeight implicitHeight: Appearance.sizes.baseBarHeight
} }

View File

@@ -4,5 +4,5 @@ import qs.common
import qs.common.widgets import qs.common.widgets
StyledText { StyledText {
text: Time.time text: Time.time
} }

View File

@@ -8,74 +8,74 @@ import qs.common
import qs.common.widgets import qs.common.widgets
Item { Item {
id: root id: root
property bool borderless: Config.options.bar.borderless property bool borderless: Config.options.bar.borderless
Layout.fillHeight: true
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
implicitHeight: Appearance.sizes.barHeight
Timer { Layout.fillHeight: true
running: MprisController.hasPlayers && MprisController.activePlayer().isPlaying && MprisController.activePlayer().lengthSupported implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
interval: 1000 implicitHeight: Appearance.sizes.barHeight
repeat: true
onTriggered: MprisController.activePlayer().positionChanged()
}
MouseArea { Timer {
anchors.fill: parent running: MprisController.hasPlayers && MprisController.activePlayer().isPlaying && MprisController.activePlayer().lengthSupported
acceptedButtons: Qt.MiddleButton | Qt.BackButton | Qt.ForwardButton | Qt.RightButton | Qt.LeftButton interval: 1000
onPressed: (event) => { repeat: true
if (event.button === Qt.MiddleButton) { onTriggered: MprisController.activePlayer().positionChanged()
MprisController.activePlayer().togglePlaying();
} else if (event.button === Qt.BackButton) {
MprisController.shiftPlayer(-1);
} else if (event.button === Qt.ForwardButton) {
MprisController.shiftPlayer(1);
} else if (event.button === Qt.LeftButton) {
GlobalStates.mediaControlsOpen = !GlobalStates.mediaControlsOpen;
}
}
}
RowLayout {
id: rowLayout
spacing: 4
anchors.fill: parent
visible: MprisController.hasPlayers
CircularProgress {
id: circularProgress
visible: MprisController.hasPlayers && MprisController.activePlayer().lengthSupported
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: rowLayout.spacing
lineWidth: 2
value: MprisController.activePlayer().lengthSupported ? MprisController.activePlayer()?.position / MprisController.activePlayer()?.length : 0
implicitSize: 26
colSecondary: Appearance.colors.colSecondaryContainer
colPrimary: Appearance.m3colors.m3onSecondaryContainer
enableAnimation: false
MaterialSymbol {
visible: MprisController.hasPlayers && MprisController.activePlayer().lengthSupported
anchors.centerIn: parent
fill: 1
text: MprisController.activePlayer()?.isPlaying ? "music_note" : "pause"
iconSize: Appearance.font.pixelSize.normal
color: Appearance.m3colors.m3onSecondaryContainer
}
} }
StyledText { MouseArea {
visible: Config.options.bar.verbose anchors.fill: parent
width: rowLayout.width - (circularProgress.size + rowLayout.spacing * 2) acceptedButtons: Qt.MiddleButton | Qt.BackButton | Qt.ForwardButton | Qt.RightButton | Qt.LeftButton
Layout.alignment: Qt.AlignCenter onPressed: event => {
Layout.fillWidth: true if (event.button === Qt.MiddleButton) {
Layout.rightMargin: rowLayout.spacing MprisController.activePlayer().togglePlaying();
horizontalAlignment: Text.AlignHCenter } else if (event.button === Qt.BackButton) {
elide: Text.ElideRight MprisController.shiftPlayer(-1);
color: Appearance.colors.colOnLayer1 } else if (event.button === Qt.ForwardButton) {
text: `${MprisController.activePlayer()?.trackTitle}${MprisController.activePlayer()?.trackArtist ? ' • ' + MprisController.activePlayer().trackArtist : ''}` MprisController.shiftPlayer(1);
} else if (event.button === Qt.LeftButton) {
GlobalStates.mediaControlsOpen = !GlobalStates.mediaControlsOpen;
}
}
} }
}
} RowLayout {
id: rowLayout
spacing: 4
anchors.fill: parent
visible: MprisController.hasPlayers
CircularProgress {
id: circularProgress
visible: false && MprisController.hasPlayers && MprisController.activePlayer().lengthSupported
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: rowLayout.spacing
lineWidth: 2
value: MprisController.activePlayer().lengthSupported ? MprisController.activePlayer()?.position / MprisController.activePlayer()?.length : 0
implicitSize: 26
colSecondary: Appearance.colors.colSecondaryContainer
colPrimary: Appearance.m3colors.m3onSecondaryContainer
enableAnimation: false
MaterialSymbol {
visible: MprisController.hasPlayers && MprisController.activePlayer().lengthSupported
anchors.centerIn: parent
fill: 1
text: MprisController.activePlayer()?.isPlaying ? "music_note" : "pause"
iconSize: Appearance.font.pixelSize.normal
color: Appearance.m3colors.m3onSecondaryContainer
}
}
StyledText {
visible: Config.options.bar.verbose
width: rowLayout.width - (circularProgress.size + rowLayout.spacing * 2)
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
Layout.rightMargin: rowLayout.spacing
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideRight
color: Appearance.colors.colOnLayer1
text: `${MprisController.activePlayer()?.trackTitle}${MprisController.activePlayer()?.trackArtist ? ' • ' + MprisController.activePlayer().trackArtist : ''}`
}
}
}

View File

@@ -14,7 +14,7 @@ Item {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onPressed: (event) => { onPressed: (event) => {
GlobalStates.notificationPanelOpen = !GlobalStates.notificationPanelOpen; GlobalStates.notificationPanelOpen = !GlobalStates.notificationPanelOpen && NotificationService.amountNotifications > 0;
} }
} }
@@ -43,4 +43,4 @@ Item {
color: NotificationService.amountNotifications > 0 ? Appearance.m3colors.m3error : Appearance.m3colors.m3onSecondaryContainer color: NotificationService.amountNotifications > 0 ? Appearance.m3colors.m3error : Appearance.m3colors.m3onSecondaryContainer
} }
} }
} }

View File

@@ -4,13 +4,13 @@ import Quickshell
import QtQuick import QtQuick
Singleton { Singleton {
id: root id: root
readonly property string time: { readonly property string time: {
Qt.formatDateTime(clock.date, "ddd, MMM dd hh:mm:ss AP") Qt.formatDateTime(clock.date, "ddd, MMM dd hh:mm AP");
} }
SystemClock { SystemClock {
id: clock id: clock
precision: SystemClock.Seconds precision: SystemClock.Minutes
} }
} }

View File

@@ -17,19 +17,13 @@ Scope {
onTriggered: GlobalStates.notificationPanelOpen = false onTriggered: GlobalStates.notificationPanelOpen = false
} }
Timer {
id: quickHideTimer
interval: 1
onTriggered: GlobalStates.notificationPanelOpen = false
}
Loader { Loader {
id: notificationPanelLoader id: notificationPanelLoader
active: GlobalStates.notificationPanelOpen active: GlobalStates.notificationPanelOpen
onActiveChanged: { onActiveChanged: {
if (notificationPanelLoader.active & NotificationService.amountNotifications == 0) { if (notificationPanelLoader.active) {
quickHideTimer.restart(); hideTimer.restart();
} }
} }
sourceComponent: PanelWindow { sourceComponent: PanelWindow {
@@ -87,4 +81,4 @@ Scope {
} }
} }
} }
} }

View File

@@ -5,100 +5,104 @@ import Quickshell.Services.Pipewire
import Quickshell.Widgets import Quickshell.Widgets
import qs import qs
import qs.common import qs.common
import qs.common.widgets
Scope { Scope {
id: root id: root
// communicate when the volume display should show or not // communicate when the volume display should show or not
property bool showVolumeDisplay: false property bool showVolumeDisplay: false
// Bind to pipewire's default output node // Bind to pipewire's default output node
// https://quickshell.org/docs/v0.2.0/types/Quickshell.Services.Pipewire/PwObjectTracker/ // https://quickshell.org/docs/v0.2.0/types/Quickshell.Services.Pipewire/PwObjectTracker/
PwObjectTracker { PwObjectTracker {
objects: [ Pipewire.defaultAudioSink ] objects: [Pipewire.defaultAudioSink]
}
// Setup a connection to when the volume is changed
// https://doc.qt.io/qt-6/qml-qtqml-connections.html
Connections {
target: Pipewire.defaultAudioSink?.audio
function onVolumeChanged() {
GlobalStates.osdVolumeOpen = true;
hideTimer.restart();
} }
}
// timer after 1 second hide the volume display // Setup a connection to when the volume is changed
// https://doc.qt.io/qt-6/qml-qtqml-timer.html // https://doc.qt.io/qt-6/qml-qtqml-connections.html
Timer { Connections {
id: hideTimer target: Pipewire.defaultAudioSink?.audio
interval: Config.options.osd.timeout
onTriggered: GlobalStates.osdVolumeOpen = false
}
// loader to create and destroy volume display function onVolumeChanged() {
LazyLoader { GlobalStates.osdVolumeOpen = true;
active: GlobalStates.osdVolumeOpen hideTimer.restart();
}
}
// according to documentation in Quickshell, PanelWindow is not an uncreatable-type, despite the qmlls language server's warning // timer after 1 second hide the volume display
// I assume that the yelling is because there is a discrepancy between implementation and language server // https://doc.qt.io/qt-6/qml-qtqml-timer.html
PanelWindow { Timer {
// it seems you can use {} if you want multiple under a category id: hideTimer
// the example for that is in Bar.qml interval: Config.options.osd.timeout
anchors.bottom: true onTriggered: GlobalStates.osdVolumeOpen = false
// similar discrepancy it seems }
margins.bottom: screen.height / 5
exclusiveZone: 0
implicitHeight: 50 // loader to create and destroy volume display
implicitWidth: 400 LazyLoader {
color: "transparent" active: GlobalStates.osdVolumeOpen
// prevents clicking on volume display // according to documentation in Quickshell, PanelWindow is not an uncreatable-type, despite the qmlls language server's warning
mask: Region {} // I assume that the yelling is because there is a discrepancy between implementation and language server
PanelWindow {
// it seems you can use {} if you want multiple under a category
// the example for that is in Bar.qml
anchors.bottom: true
// similar discrepancy it seems
margins.bottom: screen.height / 5
exclusiveZone: 0
Rectangle { implicitHeight: 50
anchors.fill: parent implicitWidth: 400
radius: height / 2 color: "transparent"
color: Appearance?.colors.colLayer1
// requires QtQuick.Layouts // prevents clicking on volume display
RowLayout { mask: Region {}
anchors {
fill: parent
leftMargin: 10
rightMargin: 15
}
IconImage {
implicitSize: 30
// comes from Quickshell.Widgets
source: Quickshell.iconPath("audio-volume-high-symbolic")
}
Rectangle {
Layout.fillWidth: true
implicitHeight: 20
radius: height / 2
color: Appearance?.m3colors.m3secondaryContainer
Rectangle { Rectangle {
anchors { anchors.fill: parent
left: parent.left radius: height / 2
top: parent.top color: Appearance?.colors.colLayer1
bottom: parent.bottom
}
color: Appearance.colors.colPrimary
// What I presume is that the first ? is to check if defaultAudioSink is there, and if not, the ?? marks the returning value in place // requires QtQuick.Layouts
implicitWidth: parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0) RowLayout {
radius: parent.radius anchors {
fill: parent
leftMargin: 10
rightMargin: 15
}
MaterialSymbol {
iconSize: 30
visible: true
fill: 1
// comes from Quickshell.Widgets
text: "volume_up"
color: Appearance.m3colors.m3onSecondaryContainer
}
Rectangle {
Layout.fillWidth: true
implicitHeight: 20
radius: height / 2
color: Appearance?.m3colors.m3secondaryContainer
Rectangle {
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
}
color: Appearance.colors.colPrimary
// What I presume is that the first ? is to check if defaultAudioSink is there, and if not, the ?? marks the returning value in place
implicitWidth: parent.width * (Pipewire.defaultAudioSink?.audio.volume ?? 0)
radius: parent.radius
}
}
}
} }
}
} }
}
} }
} }
}