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 {
property var modelData
property string wallpaperSource: Qt.resolvedUrl("../../Assets/Tests/wallpaper.png")
property string wallpaperSource: Qt.resolvedUrl(
"../../Assets/Tests/wallpaper.png")
Variants {
model: Quickshell.screens
@ -40,6 +41,4 @@ ShellRoot {
}
}
}
}

View file

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

View file

@ -14,7 +14,8 @@ PanelWindow {
screen: modelData
implicitHeight: Style.barHeight * scaling
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 {
top: true
@ -56,7 +57,6 @@ PanelWindow {
spacing: Style.marginMedium * scaling
Workspace {}
}
Row {
@ -79,7 +79,9 @@ PanelWindow {
NIconButton {
id: demoPanelToggler
icon: "experiment"
onClicked: function () { demoPanel.isLoaded = !demoPanel.isLoaded }
onClicked: function () {
demoPanel.isLoaded = !demoPanel.isLoaded
}
}
}
}

View file

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

View file

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

View file

@ -16,16 +16,19 @@ Loader {
sourceComponent: panel
onActiveChanged: {
if (active && item && item.show) item.show()
if (active && item && item.show)
item.show()
}
onItemChanged: {
if (active && item && item.show) item.show()
if (active && item && item.show)
item.show()
}
Connections {
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 int topMargin: Style.barHeight * scaling
property color overlayColor: showOverlay ? Colors.overlay : "transparent"
signal dismissed()
signal dismissed
function hide() {
visible = false

View file

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