qmlformat

This commit is contained in:
quadbyte 2025-08-10 08:13:58 -04:00
parent ff7dff8a6d
commit 0c044c7b81
9 changed files with 338 additions and 333 deletions

View file

@ -6,7 +6,8 @@ import qs.Services
ShellRoot { ShellRoot {
property var modelData property var modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png") property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
@ -40,6 +41,4 @@ ShellRoot {
} }
} }
} }
} }

View file

@ -5,7 +5,8 @@ import Quickshell.Wayland
import qs.Services import qs.Services
ShellRoot { ShellRoot {
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png") property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
property var modelData property var modelData
Variants { Variants {
@ -46,9 +47,7 @@ ShellRoot {
} }
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: Qt.rgba( color: Qt.rgba(Colors.backgroundPrimary.r, Colors.backgroundPrimary.g,
Colors.backgroundPrimary.r,
Colors.backgroundPrimary.g,
Colors.backgroundPrimary.b, 0.5) Colors.backgroundPrimary.b, 0.5)
} }
} }

View file

@ -14,7 +14,8 @@ PanelWindow {
screen: modelData screen: modelData
implicitHeight: Style.barHeight * scaling implicitHeight: Style.barHeight * scaling
color: "transparent" color: "transparent"
visible: Settings.settings.barMonitors.includes(modelData.name) || (Settings.settings.barMonitors.length === 0) visible: Settings.settings.barMonitors.includes(modelData.name)
|| (Settings.settings.barMonitors.length === 0)
anchors { anchors {
top: true top: true
@ -56,7 +57,6 @@ PanelWindow {
spacing: Style.marginMedium * scaling spacing: Style.marginMedium * scaling
Workspace {} Workspace {}
} }
Row { Row {
@ -79,7 +79,9 @@ PanelWindow {
NIconButton { NIconButton {
id: demoPanelToggler id: demoPanelToggler
icon: "experiment" icon: "experiment"
onClicked: function () { demoPanel.isLoaded = !demoPanel.isLoaded } onClicked: function () {
demoPanel.isLoaded = !demoPanel.isLoaded
}
} }
} }
} }

View file

@ -17,12 +17,12 @@ NClock {
visible: false visible: false
} }
onEntered: function (){ onEntered: function () {
if (!calendar.visible) { if (!calendar.visible) {
tooltip.show() tooltip.show()
} }
} }
onExited: function (){ onExited: function () {
tooltip.hide() tooltip.hide()
} }
onClicked: function () { onClicked: function () {

View file

@ -28,54 +28,54 @@ Item {
property int spacingBetweenPills: Math.round(8 * s) property int spacingBetweenPills: Math.round(8 * s)
width: { width: {
let total = 0; let total = 0
for (let i = 0; i < localWorkspaces.count; i++) { for (var i = 0; i < localWorkspaces.count; i++) {
const ws = localWorkspaces.get(i); const ws = localWorkspaces.get(i)
if (ws.isFocused) if (ws.isFocused)
total += Math.round(44 * s); total += Math.round(44 * s)
else if (ws.isActive) else if (ws.isActive)
total += Math.round(28 * s); total += Math.round(28 * s)
else else
total += Math.round(16 * s); total += Math.round(16 * s)
} }
total += Math.max(localWorkspaces.count - 1, 0) * spacingBetweenPills; total += Math.max(localWorkspaces.count - 1, 0) * spacingBetweenPills
total += horizontalPadding * 2; total += horizontalPadding * 2
return total; return total
} }
height: Math.round(36 * s) height: Math.round(36 * s)
Component.onCompleted: { Component.onCompleted: {
localWorkspaces.clear(); localWorkspaces.clear()
for (let i = 0; i < Workspaces.workspaces.count; i++) { for (var i = 0; i < Workspaces.workspaces.count; i++) {
const ws = Workspaces.workspaces.get(i); const ws = Workspaces.workspaces.get(i)
if (ws.output.toLowerCase() === screen.name.toLowerCase()) { if (ws.output.toLowerCase() === screen.name.toLowerCase()) {
localWorkspaces.append(ws); localWorkspaces.append(ws)
} }
} }
workspaceRepeater.model = localWorkspaces; workspaceRepeater.model = localWorkspaces
updateWorkspaceFocus(); updateWorkspaceFocus()
} }
Connections { Connections {
target: Workspaces target: Workspaces
function onWorkspacesChanged() { function onWorkspacesChanged() {
localWorkspaces.clear(); localWorkspaces.clear()
for (let i = 0; i < Workspaces.workspaces.count; i++) { for (var i = 0; i < Workspaces.workspaces.count; i++) {
const ws = Workspaces.workspaces.get(i); const ws = Workspaces.workspaces.get(i)
if (ws.output.toLowerCase() === screen.name.toLowerCase()) { if (ws.output.toLowerCase() === screen.name.toLowerCase()) {
localWorkspaces.append(ws); localWorkspaces.append(ws)
} }
} }
workspaceRepeater.model = localWorkspaces; workspaceRepeater.model = localWorkspaces
updateWorkspaceFocus(); updateWorkspaceFocus()
} }
} }
function triggerUnifiedWave() { function triggerUnifiedWave() {
effectColor = Colors.accentPrimary; effectColor = Colors.accentPrimary
masterAnimation.restart(); masterAnimation.restart()
} }
SequentialAnimation { SequentialAnimation {
@ -106,12 +106,12 @@ Item {
} }
function updateWorkspaceFocus() { function updateWorkspaceFocus() {
for (let i = 0; i < localWorkspaces.count; i++) { for (var i = 0; i < localWorkspaces.count; i++) {
const ws = localWorkspaces.get(i); const ws = localWorkspaces.get(i)
if (ws.isFocused === true) { if (ws.isFocused === true) {
root.triggerUnifiedWave(); root.triggerUnifiedWave()
root.workspaceChanged(ws.id, Colors.accentPrimary); root.workspaceChanged(ws.id, Colors.accentPrimary)
break; break
} }
} }
} }
@ -124,13 +124,14 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
radius: Math.round(12 * s) radius: Math.round(12 * s)
color: Colors.surfaceVariant color: Colors.surfaceVariant
border.color: Qt.rgba(Colors.textPrimary.r, Colors.textPrimary.g, Colors.textPrimary.b, 0.1) border.color: Qt.rgba(Colors.textPrimary.r, Colors.textPrimary.g,
Colors.textPrimary.b, 0.1)
border.width: Math.max(1, Math.round(1 * s)) border.width: Math.max(1, Math.round(1 * s))
layer.enabled: true layer.enabled: true
layer.effect: MultiEffect { layer.effect: MultiEffect {
shadowColor: "black" shadowColor: "black"
// radius: 12
// radius: 12
shadowVerticalOffset: 0 shadowVerticalOffset: 0
shadowHorizontalOffset: 0 shadowHorizontalOffset: 0
shadowOpacity: 0.10 shadowOpacity: 0.10
@ -151,11 +152,11 @@ Item {
height: Math.round(12 * s) height: Math.round(12 * s)
width: { width: {
if (model.isFocused) if (model.isFocused)
return Math.round(44 * s); return Math.round(44 * s)
else if (model.isActive) else if (model.isActive)
return Math.round(28 * s); return Math.round(28 * s)
else else
return Math.round(16 * s); return Math.round(16 * s)
} }
Rectangle { Rectangle {
@ -163,22 +164,22 @@ Item {
anchors.fill: parent anchors.fill: parent
radius: { radius: {
if (model.isFocused) if (model.isFocused)
return Math.round(12 * s); return Math.round(12 * s)
else else
// half of focused height (if you want to animate this too) // half of focused height (if you want to animate this too)
return Math.round(6 * s); return Math.round(6 * s)
} }
color: { color: {
if (model.isFocused) if (model.isFocused)
return Colors.accentPrimary; return Colors.accentPrimary
if (model.isUrgent) if (model.isUrgent)
return Colors.error; return Colors.error
if (model.isActive || model.isOccupied) if (model.isActive || model.isOccupied)
return Colors.accentTertiary; return Colors.accentTertiary
if (model.isUrgent) if (model.isUrgent)
return Colors.error; return Colors.error
return Colors.outline; return Colors.outline
} }
scale: model.isFocused ? 1.0 : 0.9 scale: model.isFocused ? 1.0 : 0.9
z: 0 z: 0
@ -188,7 +189,7 @@ Item {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Workspaces.switchToWorkspace(model.idx); Workspaces.switchToWorkspace(model.idx)
} }
hoverEnabled: true hoverEnabled: true
} }
@ -252,8 +253,10 @@ Item {
radius: width / 2 radius: width / 2
color: "transparent" color: "transparent"
border.color: root.effectColor border.color: root.effectColor
border.width: Math.max(1, Math.round((2 + 6 * (1.0 - root.masterProgress)) * s)) border.width: Math.max(1, Math.round(
opacity: root.effectsActive && model.isFocused ? (1.0 - root.masterProgress) * 0.7 : 0 (2 + 6 * (1.0 - root.masterProgress)) * s))
opacity: root.effectsActive
&& model.isFocused ? (1.0 - root.masterProgress) * 0.7 : 0
visible: root.effectsActive && model.isFocused visible: root.effectsActive && model.isFocused
z: 1 z: 1
} }
@ -262,6 +265,6 @@ Item {
} }
Component.onDestruction: { Component.onDestruction: {
root.isDestroying = true; root.isDestroying = true
} }
} }

View file

@ -16,16 +16,19 @@ Loader {
sourceComponent: panel sourceComponent: panel
onActiveChanged: { onActiveChanged: {
if (active && item && item.show) item.show() if (active && item && item.show)
item.show()
} }
onItemChanged: { onItemChanged: {
if (active && item && item.show) item.show() if (active && item && item.show)
item.show()
} }
Connections { Connections {
target: loader.item target: loader.item
function onDismissed() { loader.isLoaded = false } function onDismissed() {
loader.isLoaded = false
}
} }
} }

View file

@ -10,7 +10,7 @@ PanelWindow {
property bool showOverlay: Settings.settings.dimPanels property bool showOverlay: Settings.settings.dimPanels
property int topMargin: Style.barHeight * scaling property int topMargin: Style.barHeight * scaling
property color overlayColor: showOverlay ? Colors.overlay : "transparent" property color overlayColor: showOverlay ? Colors.overlay : "transparent"
signal dismissed() signal dismissed
function hide() { function hide() {
visible = false visible = false

View file

@ -1,6 +1,6 @@
// Disable reload popup // Disable reload popup
//@ pragma Env QS_NO_RELOAD_POPUP=1 //@ pragma Env QS_NO_RELOAD_POPUP=1
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
@ -12,7 +12,6 @@ import qs.Modules.Background
ShellRoot { ShellRoot {
id: root id: root
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens