style: format qml files

This commit is contained in:
tux
2026-08-24 15:44:57 +05:30
parent ca7ac0696b
commit adfd353e85
19 changed files with 500 additions and 519 deletions

View File

@@ -5,20 +5,17 @@ import qs.ui
import qs.services
RowLayout {
BarButton {
hoverHighlight: false
pointerCursor: false
label: Audio.inputName
iconSource: Audio.inputIcon
BarButton {
hoverHighlight: false
pointerCursor: false
label: Audio.inputName
iconSource: Audio.inputIcon
}
BarButton {
hoverHighlight: false
pointerCursor: false
label: Audio.outputName
iconSource: Audio.outputIcon
}
}
BarButton {
hoverHighlight: false
pointerCursor: false
label: Audio.outputName
iconSource: Audio.outputIcon
}
}

View File

@@ -4,8 +4,8 @@ import qs.ui
import qs.services
BarButton {
hoverHighlight: false
pointerCursor: false
label: `${Battery.percentage}% ${Battery.energyRate}W`
iconSource: Battery.icon
hoverHighlight: false
pointerCursor: false
label: `${Battery.percentage}% ${Battery.energyRate}W`
iconSource: Battery.icon
}

View File

@@ -5,47 +5,47 @@ import qs.config
import qs.services
Rectangle {
id: root
id: root
property int barCount: 14
property real maxValue: 100
readonly property bool shouldVisualize: barCount > 0 && Cava.values.some(v => v >= 0.001)
property int barCount: 14
property real maxValue: 100
readonly property bool shouldVisualize: barCount > 0 && Cava.values.some(v => v >= 0.001)
implicitWidth: 96
implicitHeight: 32
radius: Appearance.radius
color: Appearance.colors.inActive
visible: shouldVisualize
implicitWidth: 96
implicitHeight: 32
radius: Appearance.radius
color: Appearance.colors.inActive
visible: shouldVisualize
Row {
id: barRow
Row {
id: barRow
anchors.fill: parent
anchors.margins: 8
spacing: 3
anchors.fill: parent
anchors.margins: 8
spacing: 3
Repeater {
model: root.barCount
Repeater {
model: root.barCount
Rectangle {
id: bar
Rectangle {
id: bar
required property int index
readonly property real value: Cava.values[index] ?? 0
required property int index
readonly property real value: Cava.values[index] ?? 0
width: (barRow.width - barRow.spacing * (root.barCount - 1)) / root.barCount
height: Math.max(2, (bar.value / root.maxValue) * barRow.height)
anchors.bottom: parent.bottom
radius: bar.width / 2
color: Appearance.colors.accent
antialiasing: true
width: (barRow.width - barRow.spacing * (root.barCount - 1)) / root.barCount
height: Math.max(2, (bar.value / root.maxValue) * barRow.height)
anchors.bottom: parent.bottom
radius: bar.width / 2
color: Appearance.colors.accent
antialiasing: true
Behavior on height {
NumberAnimation {
duration: Appearance.duration
}
Behavior on height {
NumberAnimation {
duration: Appearance.duration
}
}
}
}
}
}
}
}

View File

@@ -4,7 +4,7 @@ import qs.ui
import qs.services
BarButton {
hoverHighlight: false
pointerCursor: false
label: Time.time
hoverHighlight: false
pointerCursor: false
label: Time.time
}

View File

@@ -4,6 +4,6 @@ import Quickshell
import qs.ui
BarButton {
iconOnly: true
iconSource: `${Quickshell.shellPath("assets")}/icons/ghost.svg`
iconOnly: true
iconSource: `${Quickshell.shellPath("assets")}/icons/ghost.svg`
}

View File

@@ -4,8 +4,8 @@ import qs.ui
import qs.services
BarButton {
hoverHighlight: false
pointerCursor: false
label: Home.latency >= 0 ? `${Home.latency} ms` : "NA"
iconSource: Home.icon
hoverHighlight: false
pointerCursor: false
label: Home.latency >= 0 ? `${Home.latency} ms` : "NA"
iconSource: Home.icon
}

View File

@@ -4,7 +4,7 @@ import Quickshell
import qs.ui
BarButton {
iconOnly: true
iconSource: `${Quickshell.shellPath("assets")}/icons/nix.svg`
onClicked: Quickshell.execDetached(["vicinae", "toggle"])
iconOnly: true
iconSource: `${Quickshell.shellPath("assets")}/icons/nix.svg`
onClicked: Quickshell.execDetached(["vicinae", "toggle"])
}

View File

@@ -4,8 +4,8 @@ import qs.ui
import qs.services
BarButton {
hoverHighlight: false
pointerCursor: false
label: PowerProfile.name
iconSource: PowerProfile.icon
hoverHighlight: false
pointerCursor: false
label: PowerProfile.name
iconSource: PowerProfile.icon
}

View File

@@ -6,27 +6,27 @@ import qs.config
import qs.ui
BarButton {
id: root
id: root
property int iconSize: 16
property int iconSize: 16
hoverHighlight: false
pointerCursor: false
visible: SystemTray.items.values.length > 0
hoverHighlight: false
pointerCursor: false
visible: SystemTray.items.values.length > 0
contentItem: Row {
spacing: Appearance.spacing
contentItem: Row {
spacing: Appearance.spacing
Repeater {
model: SystemTray.items.values
Repeater {
model: SystemTray.items.values
Image {
required property var modelData
Image {
required property var modelData
source: modelData.icon
width: root.iconSize
height: root.iconSize
}
source: modelData.icon
width: root.iconSize
height: root.iconSize
}
}
}
}
}

View File

@@ -5,56 +5,56 @@ import Quickshell.Hyprland
import qs.config
Row {
id: root
id: root
property int count: 7
property int count: 7
spacing: Appearance.spacing
spacing: Appearance.spacing
Repeater {
model: root.count
Repeater {
model: root.count
Rectangle {
id: pill
Rectangle {
id: pill
required property int index
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
required property int index
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
radius: 1000
implicitHeight: 15
implicitWidth: pill.isActive ? pill.implicitHeight * 2.3 : pill.implicitHeight
color: {
if (handler.hovered)
return Appearance.colors.accent;
if (pill.isActive || pill.ws)
return Appearance.colors.accent;
return Appearance.colors.inActive;
}
radius: 1000
implicitHeight: 15
implicitWidth: pill.isActive ? pill.implicitHeight * 2.3 : pill.implicitHeight
color: {
if (handler.hovered)
return Appearance.colors.accent;
if (pill.isActive || pill.ws)
return Appearance.colors.accent;
return Appearance.colors.inActive;
}
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: Hyprland.dispatch("workspace " + (pill.index + 1))
}
MouseArea {
hoverEnabled: true
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: Hyprland.dispatch("workspace " + (pill.index + 1))
}
HoverHandler {
id: handler
}
HoverHandler {
id: handler
}
Behavior on color {
ColorAnimation {
duration: Appearance.duration
Behavior on color {
ColorAnimation {
duration: Appearance.duration
}
}
Behavior on implicitWidth {
NumberAnimation {
duration: Appearance.duration
easing.type: Easing.OutQuad
}
}
}
}
Behavior on implicitWidth {
NumberAnimation {
duration: Appearance.duration
easing.type: Easing.OutQuad
}
}
}
}
}

View File

@@ -7,111 +7,110 @@ import Quickshell.Services.Notifications
import qs.config
Rectangle {
id: root
id: root
property Notification notif
readonly property bool critical: notif?.urgency === NotificationUrgency.Critical
readonly property int timeoutDuration: {
const seconds = Math.round((notif?.expireTimeout ?? 0) / 1000);
return seconds > 0 ? seconds : 5;
}
readonly property string iconName: {
if (!notif)
return "";
property Notification notif
readonly property bool critical: notif?.urgency === NotificationUrgency.Critical
readonly property int timeoutDuration: {
const seconds = Math.round((notif?.expireTimeout ?? 0) / 1000);
return seconds > 0 ? seconds : 5;
}
readonly property string iconName: {
if (!notif)
return "";
const hints = notif.hints ?? {};
const hinted = String(hints["image-path"] ?? hints["image_path"] ?? hints["icon_path"] ?? "");
return notif.appIcon || notif.desktopEntry || hinted;
}
readonly property url themedIconUrl: iconName !== "" ? Quickshell.iconPath(iconName, false) : ""
readonly property url iconUrl: `${Quickshell.shellPath("assets")}/icons/notification.svg`
const hints = notif.hints ?? {};
const hinted = String(hints["image-path"] ?? hints["image_path"] ?? hints["icon_path"] ?? "");
return notif.appIcon || notif.desktopEntry || hinted;
}
readonly property url themedIconUrl: iconName !== "" ? Quickshell.iconPath(iconName, false) : ""
readonly property url iconUrl: `${Quickshell.shellPath("assets")}/icons/notification.svg`
implicitWidth: 360
implicitHeight: content.implicitHeight + Appearance.padding * 2
radius: Appearance.radius
color: Appearance.colors.background
border.width: critical ? 1 : 0
border.color: Appearance.colors.accent
implicitWidth: 360
implicitHeight: content.implicitHeight + Appearance.padding * 2
radius: Appearance.radius
color: Appearance.colors.background
border.width: critical ? 1 : 0
border.color: Appearance.colors.accent
Timer {
id: countdown
Timer {
id: countdown
interval: root.timeoutDuration * 1000
repeat: false
running: !root.critical && !hovered.hovered && visible
onTriggered: root.notif.expire()
}
HoverHandler {
id: hovered
}
RowLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: Appearance.padding
spacing: Appearance.spacing
Item {
width: 40
height: 40
Layout.alignment: Qt.AlignTop
Image {
anchors.fill: parent
source: root.iconUrl
fillMode: Image.PreserveAspectFit
smooth: true
}
Image {
anchors.fill: parent
source: root.themedIconUrl
visible: root.themedIconUrl !== "" && status === Image.Ready
fillMode: Image.PreserveAspectFit
smooth: true
}
interval: root.timeoutDuration * 1000
repeat: false
running: !root.critical && !hovered.hovered && visible
onTriggered: root.notif.expire()
}
ColumnLayout {
spacing: 2
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Text {
text: root.notif?.appName ?? ""
color: Appearance.colors.accent
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize - 2
elide: Text.ElideRight
Layout.fillWidth: true
}
Text {
text: root.notif?.summary ?? ""
color: Appearance.colors.foreground
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize
font.weight: Font.DemiBold
elide: Text.ElideRight
Layout.fillWidth: true
}
Text {
text: root.notif?.body ?? ""
visible: text !== ""
color: Appearance.colors.foreground
opacity: 0.8
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize - 1
wrapMode: Text.Wrap
maximumLineCount: 3
elide: Text.ElideRight
textFormat: Text.PlainText
Layout.fillWidth: true
}
HoverHandler {
id: hovered
}
RowLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: Appearance.padding
spacing: Appearance.spacing
Item {
width: 40
height: 40
Layout.alignment: Qt.AlignTop
Image {
anchors.fill: parent
source: root.iconUrl
fillMode: Image.PreserveAspectFit
smooth: true
}
Image {
anchors.fill: parent
source: root.themedIconUrl
visible: root.themedIconUrl !== "" && status === Image.Ready
fillMode: Image.PreserveAspectFit
smooth: true
}
}
ColumnLayout {
spacing: 2
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Text {
text: root.notif?.appName ?? ""
color: Appearance.colors.accent
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize - 2
elide: Text.ElideRight
Layout.fillWidth: true
}
Text {
text: root.notif?.summary ?? ""
color: Appearance.colors.foreground
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize
font.weight: Font.DemiBold
elide: Text.ElideRight
Layout.fillWidth: true
}
Text {
text: root.notif?.body ?? ""
visible: text !== ""
color: Appearance.colors.foreground
opacity: 0.8
font.family: Appearance.font.family
font.pointSize: Appearance.font.pointSize - 1
wrapMode: Text.Wrap
maximumLineCount: 3
elide: Text.ElideRight
textFormat: Text.PlainText
Layout.fillWidth: true
}
}
}
}
}