refactor: use signals instead of functions

This commit is contained in:
2 * r + 2 * t 2026-04-18 01:04:04 +10:00
parent 20dca094ec
commit 6e234d6656
57 changed files with 282 additions and 401 deletions

View file

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Shapes
import Caelestia.Config import Caelestia.Config
import qs.services import qs.services
@ -7,90 +8,168 @@ MouseArea {
property bool disabled property bool disabled
property bool showHoverBackground: true property bool showHoverBackground: true
property color color: Colours.palette.m3onSurface readonly property alias rect: base
// Pick up radius from parent if it has one (parent can be anything with a radius property)
property real radius: parent?.radius ?? 0 // qmllint disable missing-property
property alias rect: hoverLayer
function onClicked(): void { property bool shapeMorph
property real stateOpacity: pressed ? 0.1 : containsMouse ? 0.08 : 0
property real pressX: width / 2
property real pressY: height / 2
property real circleRadius
property alias color: base.color
property alias radius: base.radius
property alias topLeftRadius: base.topLeftRadius
property alias topRightRadius: base.topRightRadius
property alias bottomLeftRadius: base.bottomLeftRadius
property alias bottomRightRadius: base.bottomRightRadius
readonly property real endRadius: {
const d1 = distSq(0, 0);
const d2 = distSq(width, 0);
const d3 = distSq(0, height);
const d4 = distSq(width, height);
return Math.sqrt(Math.max(d1, d2, d3, d4)) * (shapeMorph ? 1.16 : 1);
}
property real endRadiusAtPress
function distSq(x: real, y: real): real {
return (pressX - x) ** 2 + (pressY - y) ** 2;
}
function press(x: real, y: real): void {
pressX = x;
pressY = y;
fadeAnim.complete();
circleRadius = 0;
circle.opacity = 0.1;
rippleAnim.restart();
endRadiusAtPress = endRadius;
} }
anchors.fill: parent anchors.fill: parent
enabled: !disabled enabled: !disabled
cursorShape: disabled ? undefined : Qt.PointingHandCursor cursorShape: disabled ? undefined : Qt.PointingHandCursor
hoverEnabled: true hoverEnabled: true
onPressed: event => { onPressedChanged: {
if (disabled) if (!pressed && !rippleAnim.running && circle.opacity > 0)
return; fadeAnim.start();
rippleAnim.x = event.x;
rippleAnim.y = event.y;
const dist = (ox, oy) => ox * ox + oy * oy;
rippleAnim.radius = Math.sqrt(Math.max(dist(event.x, event.y), dist(event.x, height - event.y), dist(width - event.x, event.y), dist(width - event.x, height - event.y)));
rippleAnim.restart();
} }
onClicked: event => !disabled && onClicked(event) onCircleRadiusChanged: {
if (!pressed && circleRadius > endRadiusAtPress * 0.99 && !fadeAnim.running)
fadeAnim.start();
}
SequentialAnimation { Anim {
id: rippleAnim id: rippleAnim
property real x alwaysRunToEnd: true
property real y target: root
property real radius property: "circleRadius"
to: root.endRadius
PropertyAction { easing: Tokens.anim.standardDecel
target: ripple duration: Tokens.anim.durations.normal * 2
property: "x"
value: rippleAnim.x
}
PropertyAction {
target: ripple
property: "y"
value: rippleAnim.y
}
PropertyAction {
target: ripple
property: "opacity"
value: 0.08
}
Anim {
target: ripple
properties: "implicitWidth,implicitHeight"
from: 0
to: rippleAnim.radius * 2
easing: Tokens.anim.standardDecel
}
Anim {
target: ripple
property: "opacity"
to: 0
}
} }
StyledClippingRect { Anim {
id: hoverLayer id: fadeAnim
target: circle
property: "opacity"
to: 0
}
StyledRect {
id: base
anchors.fill: parent anchors.fill: parent
opacity: root.stateOpacity
color: Colours.palette.m3onSurface
// Pick up radius from parent if it has one (parent can be anything with a radius property)
radius: root.parent?.radius ?? 0 // qmllint disable missing-property
}
color: Qt.alpha(root.color, root.disabled ? 0 : root.pressed ? 0.12 : (root.showHoverBackground && root.containsMouse) ? 0.08 : 0) Shape {
radius: root.radius id: circle
StyledRect { anchors.fill: parent
id: ripple opacity: 0
preferredRendererType: Shape.CurveRenderer
radius: Tokens.rounding.full ShapePath {
color: root.color strokeWidth: 0
opacity: 0 strokeColor: "transparent"
fillColor: base.color
fillGradient: RadialGradient {
centerX: root.pressX
centerY: root.pressY
centerRadius: root.circleRadius
focalX: centerX
focalY: centerY
transform: Translate { GradientStop {
x: -ripple.width / 2 position: 0
y: -ripple.height / 2 color: Qt.alpha(base.color, 1)
}
GradientStop {
position: 0.99
color: Qt.alpha(base.color, 1)
}
GradientStop {
position: 1
color: Qt.alpha(base.color, 0)
}
}
startX: base.topLeftRadius
startY: 0
PathLine {
x: root.width - base.topLeftRadius
y: 0
}
PathArc {
relativeX: base.topLeftRadius
relativeY: base.topLeftRadius
radiusX: base.topLeftRadius
radiusY: base.topLeftRadius
}
PathLine {
x: root.width
y: root.height - base.bottomRightRadius
}
PathArc {
relativeX: -base.bottomRightRadius
relativeY: base.bottomRightRadius
radiusX: base.bottomRightRadius
radiusY: base.bottomRightRadius
}
PathLine {
x: base.bottomLeftRadius
y: root.height
}
PathArc {
relativeX: -base.bottomLeftRadius
relativeY: -base.bottomLeftRadius
radiusX: base.bottomLeftRadius
radiusY: base.bottomLeftRadius
}
PathLine {
x: 0
y: base.topLeftRadius
}
PathArc {
x: base.topLeftRadius
y: 0
radiusX: base.topLeftRadius
radiusY: base.topLeftRadius
} }
} }
} }
Behavior on stateOpacity {
Anim {}
}
} }

View file

@ -62,15 +62,14 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void {
root.toggleRequested();
root.expanded = !root.expanded;
}
anchors.fill: parent anchors.fill: parent
color: Colours.palette.m3onSurface color: Colours.palette.m3onSurface
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
showHoverBackground: false showHoverBackground: false
onClicked: {
root.toggleRequested();
root.expanded = !root.expanded;
}
} }
} }

View file

@ -94,7 +94,12 @@ RowLayout {
StateLayer { StateLayer {
id: upState id: upState
function onClicked(): void { color: Colours.palette.m3onPrimary
onPressAndHold: timer.start()
onReleased: timer.stop()
onClicked: {
let newValue = Math.min(root.max, root.value + root.step); let newValue = Math.min(root.max, root.value + root.step);
// Round to avoid floating point precision errors // Round to avoid floating point precision errors
const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0; const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0;
@ -103,11 +108,6 @@ RowLayout {
root.displayText = newValue.toString(); root.displayText = newValue.toString();
root.valueModified(newValue); root.valueModified(newValue);
} }
color: Colours.palette.m3onPrimary
onPressAndHold: timer.start()
onReleased: timer.stop()
} }
MaterialIcon { MaterialIcon {
@ -129,7 +129,7 @@ RowLayout {
StateLayer { StateLayer {
id: downState id: downState
function onClicked(): void { onClicked: {
let newValue = Math.max(root.min, root.value - root.step); let newValue = Math.max(root.min, root.value - root.step);
// Round to avoid floating point precision errors // Round to avoid floating point precision errors
const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0; const decimals = root.step < 1 ? Math.max(1, Math.ceil(-Math.log10(root.step))) : 0;
@ -162,9 +162,9 @@ RowLayout {
triggeredOnStart: true triggeredOnStart: true
onTriggered: { onTriggered: {
if (upState.pressed) if (upState.pressed)
upState.onClicked(); upState.clicked();
else if (downState.pressed) else if (downState.pressed)
downState.onClicked(); downState.clicked();
} }
} }
} }

View file

@ -53,14 +53,13 @@ StyledRect {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
disabled: root.disabled
onClicked: {
if (root.toggle) if (root.toggle)
root.internalChecked = !root.internalChecked; root.internalChecked = !root.internalChecked;
root.clicked(); root.clicked();
} }
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
disabled: root.disabled
} }
MaterialIcon { MaterialIcon {

View file

@ -45,13 +45,12 @@ StyledRect {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
onClicked: {
if (root.toggle) if (root.toggle)
root.internalChecked = !root.internalChecked; root.internalChecked = !root.internalChecked;
root.clicked(); root.clicked();
} }
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
} }
RowLayout { RowLayout {

View file

@ -52,15 +52,14 @@ Elevation {
color: Qt.alpha(Colours.palette.m3secondaryContainer, active ? 1 : 0) color: Qt.alpha(Colours.palette.m3secondaryContainer, active ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
disabled: !root.expanded
onClicked: {
root.itemSelected(item.modelData); root.itemSelected(item.modelData);
root.active = item.modelData; root.active = item.modelData;
item.modelData.clicked(); item.modelData.clicked();
root.expanded = false; root.expanded = false;
} }
color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
disabled: !root.expanded
} }
RowLayout { RowLayout {

View file

@ -47,14 +47,11 @@ Row {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void {
root.active?.clicked();
}
rect.topRightRadius: parent.topRightRadius rect.topRightRadius: parent.topRightRadius
rect.bottomRightRadius: parent.bottomRightRadius rect.bottomRightRadius: parent.bottomRightRadius
color: root.textColour color: root.textColour
disabled: root.disabled disabled: root.disabled
onClicked: root.active?.clicked()
} }
RowLayout { RowLayout {
@ -109,7 +106,7 @@ Row {
StateLayer { StateLayer {
id: expandStateLayer id: expandStateLayer
function onClicked(): void { onClicked: {
root.expanded = !root.expanded; root.expanded = !root.expanded;
} }

View file

@ -24,13 +24,11 @@ RadioButton {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StateLayer { StateLayer {
function onClicked(): void {
root.click();
}
anchors.margins: -Tokens.padding.smaller anchors.margins: -Tokens.padding.smaller
color: root.checked ? Colours.palette.m3onSurface : Colours.palette.m3primary color: root.checked ? Colours.palette.m3onSurface : Colours.palette.m3primary
z: -1 z: -1
onClicked: root.click()
} }
StyledRect { StyledRect {

View file

@ -56,13 +56,12 @@ StyledRect {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
onClicked: {
if (root.toggle) if (root.toggle)
root.internalChecked = !root.internalChecked; root.internalChecked = !root.internalChecked;
root.clicked(); root.clicked();
} }
color: root.internalChecked ? root.activeOnColour : root.inactiveOnColour
} }
StyledText { StyledText {

View file

@ -46,11 +46,8 @@ StyledRect {
StateLayer { StateLayer {
id: toggleStateLayer id: toggleStateLayer
function onClicked(): void {
root.clicked();
}
color: root.toggled ? Colours.palette[`m3on${root.accent}`] : Colours.palette[`m3on${root.accent}Container`] color: root.toggled ? Colours.palette[`m3on${root.accent}`] : Colours.palette[`m3on${root.accent}Container`]
onClicked: root.clicked()
} }
RowLayout { RowLayout {

View file

@ -49,11 +49,9 @@ StyledRect {
implicitHeight: cancelText.implicitHeight + Tokens.padding.normal * 2 implicitHeight: cancelText.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void {
root.dialog.accepted(root.folder.currentItem.modelData.path);
}
disabled: !root.dialog.selectionValid disabled: !root.dialog.selectionValid
onClicked: root.dialog.accepted(root.folder.currentItem.modelData.path)
} }
StyledText { StyledText {
@ -75,7 +73,7 @@ StyledRect {
implicitHeight: cancelText.implicitHeight + Tokens.padding.normal * 2 implicitHeight: cancelText.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.dialog.rejected(); root.dialog.rejected();
} }
} }

View file

@ -173,10 +173,7 @@ Item {
clip: true clip: true
StateLayer { StateLayer {
function onClicked(): void { onClicked: view.currentIndex = item.index
view.currentIndex = item.index;
}
onDoubleClicked: { onDoubleClicked: {
if (item.modelData.isDir) if (item.modelData.isDir)
root.dialog.cwd.push(item.modelData.name); root.dialog.cwd.push(item.modelData.name);

View file

@ -28,12 +28,10 @@ StyledRect {
implicitHeight: upIcon.implicitHeight + Tokens.padding.small * 2 implicitHeight: upIcon.implicitHeight + Tokens.padding.small * 2
StateLayer { StateLayer {
function onClicked(): void {
root.dialog.cwd.pop();
}
radius: Tokens.rounding.small radius: Tokens.rounding.small
disabled: root.dialog.cwd.length === 1 disabled: root.dialog.cwd.length === 1
onClicked: root.dialog.cwd.pop()
} }
MaterialIcon { MaterialIcon {
@ -94,7 +92,7 @@ StyledRect {
anchors.fill: parent anchors.fill: parent
active: folder.index < root.dialog.cwd.length - 1 active: folder.index < root.dialog.cwd.length - 1
sourceComponent: StateLayer { sourceComponent: StateLayer {
function onClicked(): void { onClicked: {
root.dialog.cwd = root.dialog.cwd.slice(0, folder.index + 1); root.dialog.cwd = root.dialog.cwd.slice(0, folder.index + 1);
} }

View file

@ -52,14 +52,13 @@ StyledRect {
color: Qt.alpha(Colours.palette.m3secondaryContainer, selected ? 1 : 0) color: Qt.alpha(Colours.palette.m3secondaryContainer, selected ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { color: place.selected ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
onClicked: {
if (place.modelData === "Home") if (place.modelData === "Home")
root.dialog.cwd = ["Home"]; root.dialog.cwd = ["Home"];
else else
root.dialog.cwd = ["Home", place.modelData]; root.dialog.cwd = ["Home", place.modelData];
} }
color: place.selected ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
} }
RowLayout { RowLayout {

View file

@ -79,12 +79,9 @@ Item {
} }
StateLayer { StateLayer {
function onClicked(): void {
dialog.open();
}
radius: parent.radius radius: parent.radius
color: Colours.palette.m3onPrimary color: Colours.palette.m3onPrimary
onClicked: dialog.open()
} }
StyledText { StyledText {

View file

@ -13,15 +13,12 @@ Item {
StateLayer { StateLayer {
// Cursed workaround to make the height larger than the parent // Cursed workaround to make the height larger than the parent
function onClicked(): void {
root.visibilities.session = !root.visibilities.session;
}
anchors.fill: undefined anchors.fill: undefined
anchors.centerIn: parent anchors.centerIn: parent
implicitWidth: implicitHeight implicitWidth: implicitHeight
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2 implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
radius: Tokens.rounding.full radius: Tokens.rounding.full
onClicked: root.visibilities.session = !root.visibilities.session
} }
MaterialIcon { MaterialIcon {

View file

@ -1,39 +0,0 @@
import QtQuick
import Caelestia.Config
import qs.components
import qs.services
import qs.modules.controlcenter
Item {
id: root
implicitWidth: icon.implicitHeight + Tokens.padding.small * 2
implicitHeight: icon.implicitHeight
StateLayer {
// Cursed workaround to make the height larger than the parent
function onClicked(): void {
WindowFactory.create(null, {
active: "network"
});
}
anchors.fill: undefined
anchors.centerIn: parent
implicitWidth: implicitHeight
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
radius: Tokens.rounding.full
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.horizontalCenterOffset: -1
text: "settings"
color: Colours.palette.m3onSurface
font.bold: true
font.pointSize: Tokens.font.size.normal
}
}

View file

@ -1,39 +0,0 @@
import QtQuick
import Caelestia.Config
import qs.components
import qs.services
import qs.modules.controlcenter
Item {
id: root
implicitWidth: icon.implicitHeight + Tokens.padding.small * 2
implicitHeight: icon.implicitHeight
StateLayer {
// Cursed workaround to make the height larger than the parent
function onClicked(): void {
WindowFactory.create(null, {
active: "network"
});
}
anchors.fill: undefined
anchors.centerIn: parent
implicitWidth: implicitHeight
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
radius: Tokens.rounding.full
}
MaterialIcon {
id: icon
anchors.centerIn: parent
anchors.horizontalCenterOffset: -1
text: "settings"
color: Colours.palette.m3onSurface
font.bold: true
font.pointSize: Tokens.font.size.normal
}
}

View file

@ -65,11 +65,8 @@ Item {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
StateLayer { StateLayer {
function onClicked(): void {
root.popouts.detachRequested("winfo");
}
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: root.popouts.detachRequested("winfo")
} }
MaterialIcon { MaterialIcon {

View file

@ -203,12 +203,9 @@ Column {
implicitHeight: icon.implicitHeight + Tokens.padding.small * 2 implicitHeight: icon.implicitHeight + Tokens.padding.small * 2
StateLayer { StateLayer {
function onClicked(): void {
PowerProfiles.profile = parent.profile;
}
radius: Tokens.rounding.full radius: Tokens.rounding.full
color: profiles.current === parent.icon ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface color: profiles.current === parent.icon ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
onClicked: PowerProfiles.profile = parent.profile
} }
MaterialIcon { MaterialIcon {

View file

@ -124,12 +124,9 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void {
device.modelData.connected = !device.modelData.connected;
}
color: device.modelData.state === BluetoothDeviceState.Connected ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface // qmllint disable unresolved-type color: device.modelData.state === BluetoothDeviceState.Connected ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface // qmllint disable unresolved-type
disabled: device.loading disabled: device.loading
onClicked: device.modelData.connected = !device.modelData.connected
} }
MaterialIcon { MaterialIcon {
@ -157,11 +154,8 @@ ColumnLayout {
implicitHeight: connectBtn.implicitHeight implicitHeight: connectBtn.implicitHeight
StateLayer { StateLayer {
function onClicked(): void {
device.modelData.forget();
}
radius: Tokens.rounding.full radius: Tokens.rounding.full
onClicked: device.modelData.forget()
} }
MaterialIcon { MaterialIcon {

View file

@ -123,7 +123,10 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void { color: networkItem.modelData.active ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
disabled: networkItem.loading || !Nmcli.wifiEnabled
onClicked: {
if (networkItem.modelData.active) { if (networkItem.modelData.active) {
Nmcli.disconnectFromNetwork(); Nmcli.disconnectFromNetwork();
} else { } else {
@ -139,9 +142,6 @@ ColumnLayout {
// This is handled by the onActiveChanged connection below // This is handled by the onActiveChanged connection below
} }
} }
color: networkItem.modelData.active ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
disabled: networkItem.loading || !Nmcli.wifiEnabled
} }
MaterialIcon { MaterialIcon {
@ -173,12 +173,9 @@ ColumnLayout {
color: Colours.palette.m3primaryContainer color: Colours.palette.m3primaryContainer
StateLayer { StateLayer {
function onClicked(): void {
Nmcli.rescanWifi();
}
color: Colours.palette.m3onPrimaryContainer color: Colours.palette.m3onPrimaryContainer
disabled: Nmcli.scanning || !Nmcli.wifiEnabled disabled: Nmcli.scanning || !Nmcli.wifiEnabled
onClicked: Nmcli.rescanWifi()
} }
RowLayout { RowLayout {
@ -303,16 +300,16 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void { color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
disabled: ethernetItem.loading
onClicked: {
if (ethernetItem.modelData.connected && ethernetItem.modelData.connection) { if (ethernetItem.modelData.connected && ethernetItem.modelData.connection) {
Nmcli.disconnectEthernet(ethernetItem.modelData.connection, () => {}); Nmcli.disconnectEthernet(ethernetItem.modelData.connection, () => {});
} else { } else {
Nmcli.connectEthernet(ethernetItem.modelData.connection || "", ethernetItem.modelData.interface || "", () => {}); Nmcli.connectEthernet(ethernetItem.modelData.connection || "", ethernetItem.modelData.interface || "", () => {});
} }
} }
color: ethernetItem.modelData.connected ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
disabled: ethernetItem.loading
} }
MaterialIcon { MaterialIcon {

View file

@ -97,7 +97,14 @@ StackView {
implicitHeight: label.implicitHeight implicitHeight: label.implicitHeight
StateLayer { StateLayer {
function onClicked(): void { anchors.margins: -Tokens.padding.small / 2
anchors.leftMargin: -Tokens.padding.smaller
anchors.rightMargin: -Tokens.padding.smaller
radius: item.radius
disabled: !item.modelData.enabled
onClicked: {
const entry = item.modelData; const entry = item.modelData;
if (entry.hasChildren) if (entry.hasChildren)
root.push(subMenuComp.createObject(null, { root.push(subMenuComp.createObject(null, {
@ -109,13 +116,6 @@ StackView {
root.popouts.hasCurrent = false; root.popouts.hasCurrent = false;
} }
} }
anchors.margins: -Tokens.padding.small / 2
anchors.leftMargin: -Tokens.padding.smaller
anchors.rightMargin: -Tokens.padding.smaller
radius: item.radius
disabled: !item.modelData.enabled
} }
Loader { Loader {
@ -197,12 +197,9 @@ StackView {
color: Colours.palette.m3secondaryContainer color: Colours.palette.m3secondaryContainer
StateLayer { StateLayer {
function onClicked(): void {
root.pop();
}
radius: parent.radius radius: parent.radius
color: Colours.palette.m3onSecondaryContainer color: Colours.palette.m3onSecondaryContainer
onClicked: root.pop()
} }
} }

View file

@ -363,13 +363,10 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void {
passwordContainer.forceActiveFocus();
}
hoverEnabled: false hoverEnabled: false
cursorShape: Qt.IBeamCursor cursorShape: Qt.IBeamCursor
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: passwordContainer.forceActiveFocus()
} }
StyledText { StyledText {

View file

@ -95,7 +95,7 @@ ColumnLayout {
StateLayer { StateLayer {
id: layer id: layer
function onClicked(): void { onClicked: {
if (!kbDelegate.isDisabled) if (!kbDelegate.isDisabled)
kb.switchTo(kbDelegate.layoutIndex); kb.switchTo(kbDelegate.layoutIndex);
} }

View file

@ -59,7 +59,7 @@ Item {
StateLayer { StateLayer {
id: normalWinState id: normalWinState
function onClicked(): void { onClicked: {
root.session.root.close(); root.session.root.close();
WindowFactory.create(null, { WindowFactory.create(null, {
active: root.session.active, active: root.session.active,
@ -173,7 +173,7 @@ Item {
implicitHeight: icon.implicitHeight + Tokens.padding.small implicitHeight: icon.implicitHeight + Tokens.padding.small
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
// Prevent tab switching during initial opening animation to avoid blank pages // Prevent tab switching during initial opening animation to avoid blank pages
if (!root.initialOpeningComplete) { if (!root.initialOpeningComplete) {
return; return;

View file

@ -34,7 +34,7 @@ StyledRect {
implicitHeight: closeIcon.implicitHeight + Tokens.padding.small implicitHeight: closeIcon.implicitHeight + Tokens.padding.small
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
QsWindow.window.destroy(); QsWindow.window.destroy();
} }

View file

@ -38,7 +38,7 @@ CollapsibleSection {
implicitHeight: schemeRow.implicitHeight + Tokens.padding.normal * 2 implicitHeight: schemeRow.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
const name = modelData.name; const name = modelData.name;
const flavour = modelData.flavour; const flavour = modelData.flavour;
const schemeKey = `${name} ${flavour}`; const schemeKey = `${name} ${flavour}`;

View file

@ -35,7 +35,7 @@ CollapsibleSection {
implicitHeight: variantRow.implicitHeight + Tokens.padding.normal * 2 implicitHeight: variantRow.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
const variant = modelData.variant; const variant = modelData.variant;
Schemes.currentVariant = variant; Schemes.currentVariant = variant;

View file

@ -58,7 +58,7 @@ CollapsibleSection {
implicitHeight: fontFamilySansRow.implicitHeight + Tokens.padding.normal * 2 implicitHeight: fontFamilySansRow.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
rootPane.fontFamilySans = modelData; rootPane.fontFamilySans = modelData;
rootPane.saveConfig(); rootPane.saveConfig();
} }
@ -139,7 +139,7 @@ CollapsibleSection {
implicitHeight: fontFamilyMonoRow.implicitHeight + Tokens.padding.normal * 2 implicitHeight: fontFamilyMonoRow.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
rootPane.fontFamilyMono = modelData; rootPane.fontFamilyMono = modelData;
rootPane.saveConfig(); rootPane.saveConfig();
} }
@ -222,7 +222,7 @@ CollapsibleSection {
implicitHeight: fontFamilyMaterialRow.implicitHeight + Tokens.padding.normal * 2 implicitHeight: fontFamilyMaterialRow.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
rootPane.fontFamilyMaterial = modelData; rootPane.fontFamilyMaterial = modelData;
rootPane.saveConfig(); rootPane.saveConfig();
} }

View file

@ -97,7 +97,7 @@ Item {
implicitHeight: outputRowLayout.implicitHeight + Tokens.padding.normal * 2 implicitHeight: outputRowLayout.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
Audio.setAudioSink(modelData); Audio.setAudioSink(modelData);
} }
} }
@ -174,7 +174,7 @@ Item {
implicitHeight: inputRowLayout.implicitHeight + Tokens.padding.normal * 2 implicitHeight: inputRowLayout.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
Audio.setAudioSource(modelData); Audio.setAudioSource(modelData);
} }
} }
@ -318,7 +318,7 @@ Item {
color: Audio.muted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer color: Audio.muted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (Audio.sink?.audio) { if (Audio.sink?.audio) {
Audio.sink.audio.muted = !Audio.sink.audio.muted; Audio.sink.audio.muted = !Audio.sink.audio.muted;
} }
@ -436,7 +436,7 @@ Item {
color: Audio.sourceMuted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer color: Audio.sourceMuted ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (Audio.source?.audio) { if (Audio.source?.audio) {
Audio.source.audio.muted = !Audio.source.audio.muted; Audio.source.audio.muted = !Audio.source.audio.muted;
} }
@ -570,7 +570,7 @@ Item {
color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer color: Audio.getStreamMuted(modelData) ? Colours.palette.m3secondary : Colours.palette.m3secondaryContainer
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData)); Audio.setStreamMuted(modelData, !Audio.getStreamMuted(modelData));
} }
} }

View file

@ -239,7 +239,7 @@ StyledFlickable {
scale: root.session.bt.editingDeviceName ? 1 : 0.5 scale: root.session.bt.editingDeviceName ? 1 : 0.5
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.bt.editingDeviceName = false; root.session.bt.editingDeviceName = false;
deviceNameEdit.text = Qt.binding(() => root.device?.name ?? ""); deviceNameEdit.text = Qt.binding(() => root.device?.name ?? "");
} }
@ -276,7 +276,7 @@ StyledFlickable {
color: Qt.alpha(Colours.palette.m3primary, root.session.bt.editingDeviceName ? 1 : 0) color: Qt.alpha(Colours.palette.m3primary, root.session.bt.editingDeviceName ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.bt.editingDeviceName = !root.session.bt.editingDeviceName; root.session.bt.editingDeviceName = !root.session.bt.editingDeviceName;
if (root.session.bt.editingDeviceName) if (root.session.bt.editingDeviceName)
deviceNameEdit.forceActiveFocus(); deviceNameEdit.forceActiveFocus();
@ -527,7 +527,7 @@ StyledFlickable {
] ]
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.bt.fabMenuOpen = false; root.session.bt.fabMenuOpen = false;
const name = fabMenuItem.modelData.name; const name = fabMenuItem.modelData.name;
@ -624,7 +624,7 @@ StyledFlickable {
StateLayer { StateLayer {
id: fabState id: fabState
function onClicked(): void { onClicked: {
root.session.bt.fabMenuOpen = !root.session.bt.fabMenuOpen; root.session.bt.fabMenuOpen = !root.session.bt.fabMenuOpen;
} }

View file

@ -145,7 +145,7 @@ DeviceList {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { onClicked: {
if (device.modelData) if (device.modelData)
root.session.bt.active = device.modelData; root.session.bt.active = device.modelData;
} }
@ -222,7 +222,7 @@ DeviceList {
} }
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (device.loading) if (device.loading)
return; return;

View file

@ -131,7 +131,7 @@ ColumnLayout {
implicitHeight: adapterPicker.implicitHeight + Tokens.padding.smaller * 2 implicitHeight: adapterPicker.implicitHeight + Tokens.padding.smaller * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
adapterPickerButton.expanded = !adapterPickerButton.expanded; adapterPickerButton.expanded = !adapterPickerButton.expanded;
} }
@ -209,7 +209,7 @@ ColumnLayout {
implicitHeight: adapterInner.implicitHeight + Tokens.padding.normal * 2 implicitHeight: adapterInner.implicitHeight + Tokens.padding.normal * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
adapterPickerButton.expanded = false; adapterPickerButton.expanded = false;
root.session.bt.currentAdapter = adapter.modelData; root.session.bt.currentAdapter = adapter.modelData;
} }
@ -376,7 +376,7 @@ ColumnLayout {
scale: root.session.bt.editingAdapterName ? 1 : 0.5 scale: root.session.bt.editingAdapterName ? 1 : 0.5
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.bt.editingAdapterName = false; root.session.bt.editingAdapterName = false;
adapterNameEdit.text = Qt.binding(() => root.session.bt.currentAdapter?.name ?? ""); adapterNameEdit.text = Qt.binding(() => root.session.bt.currentAdapter?.name ?? "");
} }
@ -413,7 +413,7 @@ ColumnLayout {
color: Qt.alpha(Colours.palette.m3primary, root.session.bt.editingAdapterName ? 1 : 0) color: Qt.alpha(Colours.palette.m3primary, root.session.bt.editingAdapterName ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.bt.editingAdapterName = !root.session.bt.editingAdapterName; root.session.bt.editingAdapterName = !root.session.bt.editingAdapterName;
if (root.session.bt.editingAdapterName) if (root.session.bt.editingAdapterName)
adapterNameEdit.forceActiveFocus(); adapterNameEdit.forceActiveFocus();

View file

@ -40,7 +40,7 @@ GridView {
height: root.cellHeight height: root.cellHeight
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
Wallpapers.setWallpaper(modelData.path); Wallpapers.setWallpaper(modelData.path);
} }

View file

@ -328,7 +328,7 @@ Item {
} }
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.launcher.active = modelData; root.session.launcher.active = modelData;
} }
} }

View file

@ -70,7 +70,7 @@ DeviceList {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { onClicked: {
root.session.ethernet.active = modelData; root.session.ethernet.active = modelData;
} }
} }
@ -147,7 +147,7 @@ DeviceList {
color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.connected ? 1 : 0) color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.connected ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (modelData.connected && modelData.connection) { if (modelData.connected && modelData.connection) {
Nmcli.disconnectEthernet(modelData.connection, () => {}); Nmcli.disconnectEthernet(modelData.connection, () => {});
} else { } else {

View file

@ -109,7 +109,7 @@ ColumnLayout {
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (root.session && root.session.vpn) { if (root.session && root.session.vpn) {
root.session.vpn.active = modelData; root.session.vpn.active = modelData;
} }
@ -211,7 +211,7 @@ ColumnLayout {
color: Qt.alpha(Colours.palette.m3primaryContainer, VPN.connected && modelData.enabled ? 1 : 0) color: Qt.alpha(Colours.palette.m3primaryContainer, VPN.connected && modelData.enabled ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
const clickedIndex = modelData.index; const clickedIndex = modelData.index;
if (modelData.enabled) { if (modelData.enabled) {
@ -271,7 +271,7 @@ ColumnLayout {
color: "transparent" color: "transparent"
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
const providers = []; const providers = [];
for (let i = 0; i < GlobalConfig.utilities.vpn.provider.length; i++) { for (let i = 0; i < GlobalConfig.utilities.vpn.provider.length; i++) {
if (i !== modelData.index) { if (i !== modelData.index) {

View file

@ -116,7 +116,7 @@ DeviceList {
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.session.network.active = modelData; root.session.network.active = modelData;
if (modelData && modelData.ssid) { if (modelData && modelData.ssid) {
root.checkSavedProfileForNetwork(modelData.ssid); root.checkSavedProfileForNetwork(modelData.ssid);
@ -197,7 +197,7 @@ DeviceList {
color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0) color: Qt.alpha(Colours.palette.m3primaryContainer, modelData.active ? 1 : 0)
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
if (modelData.active) { if (modelData.active) {
Nmcli.disconnectFromNetwork(); Nmcli.disconnectFromNetwork();
} else { } else {

View file

@ -288,7 +288,7 @@ Item {
} }
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
passwordContainer.forceActiveFocus(); passwordContainer.forceActiveFocus();
} }

View file

@ -51,11 +51,8 @@ CustomMouseArea {
StateLayer { StateLayer {
id: prevMonthStateLayer id: prevMonthStateLayer
function onClicked(): void {
root.dashState.currentDate = new Date(root.currYear, root.currMonth - 1, 1);
}
radius: Tokens.rounding.full radius: Tokens.rounding.full
onClicked: root.dashState.currentDate = new Date(root.currYear, root.currMonth - 1, 1)
} }
MaterialIcon { MaterialIcon {
@ -76,7 +73,7 @@ CustomMouseArea {
implicitHeight: monthYearDisplay.implicitHeight + Tokens.padding.small * 2 implicitHeight: monthYearDisplay.implicitHeight + Tokens.padding.small * 2
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
root.dashState.currentDate = new Date(); root.dashState.currentDate = new Date();
} }
@ -111,7 +108,7 @@ CustomMouseArea {
StateLayer { StateLayer {
id: nextMonthStateLayer id: nextMonthStateLayer
function onClicked(): void { onClicked: {
root.dashState.currentDate = new Date(root.currYear, root.currMonth + 1, 1); root.dashState.currentDate = new Date(root.currYear, root.currMonth + 1, 1);
} }

View file

@ -173,31 +173,22 @@ Item {
spacing: Tokens.spacing.small spacing: Tokens.spacing.small
Control { PlayerControl {
function onClicked(): void {
Players.active?.previous();
}
icon: "skip_previous" icon: "skip_previous"
canUse: Players.active?.canGoPrevious ?? false canUse: Players.active?.canGoPrevious ?? false
onClicked: Players.active?.previous()
} }
Control { PlayerControl {
function onClicked(): void {
Players.active?.togglePlaying();
}
icon: Players.active?.isPlaying ? "pause" : "play_arrow" icon: Players.active?.isPlaying ? "pause" : "play_arrow"
canUse: Players.active?.canTogglePlaying ?? false canUse: Players.active?.canTogglePlaying ?? false
onClicked: Players.active?.togglePlaying()
} }
Control { PlayerControl {
function onClicked(): void {
Players.active?.next();
}
icon: "skip_next" icon: "skip_next"
canUse: Players.active?.canGoNext ?? false canUse: Players.active?.canGoNext ?? false
onClicked: Players.active?.next()
} }
} }
@ -219,25 +210,21 @@ Item {
fillMode: AnimatedImage.PreserveAspectFit fillMode: AnimatedImage.PreserveAspectFit
} }
component Control: StyledRect { component PlayerControl: StyledRect {
id: control id: control
required property string icon required property string icon
required property bool canUse required property bool canUse
function onClicked(): void { signal clicked
}
implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + Tokens.padding.small implicitWidth: Math.max(icon.implicitHeight, icon.implicitHeight) + Tokens.padding.small
implicitHeight: implicitWidth implicitHeight: implicitWidth
StateLayer { StateLayer {
function onClicked(): void {
control.onClicked();
}
disabled: !control.canUse disabled: !control.canUse
radius: Tokens.rounding.full radius: Tokens.rounding.full
onClicked: control.clicked()
} }
MaterialIcon { MaterialIcon {

View file

@ -69,12 +69,11 @@ Row {
opacity: parent.containsMouse ? 1 : 0 opacity: parent.containsMouse ? 1 : 0
StateLayer { StateLayer {
function onClicked(): void { color: Colours.palette.m3onPrimary
onClicked: {
root.visibilities.launcher = false; root.visibilities.launcher = false;
root.facePicker.open(); root.facePicker.open();
} }
color: Colours.palette.m3onPrimary
} }
MaterialIcon { MaterialIcon {

View file

@ -15,11 +15,8 @@ Item {
anchors.right: parent?.right anchors.right: parent?.right
StateLayer { StateLayer {
function onClicked(): void {
root.modelData?.onClicked(root.list);
}
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: root.modelData?.onClicked(root.list)
} }
Item { Item {

View file

@ -19,12 +19,11 @@ Item {
anchors.right: parent?.right anchors.right: parent?.right
StateLayer { StateLayer {
function onClicked(): void { radius: Tokens.rounding.normal
onClicked: {
Apps.launch(root.modelData); Apps.launch(root.modelData);
root.visibilities.launcher = false; root.visibilities.launcher = false;
} }
radius: Tokens.rounding.normal
} }
Item { Item {

View file

@ -28,11 +28,8 @@ Item {
anchors.right: parent?.right anchors.right: parent?.right
StateLayer { StateLayer {
function onClicked(): void {
root.onClicked();
}
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: root.onClicked()
} }
RowLayout { RowLayout {
@ -80,7 +77,7 @@ Item {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void { onClicked: {
Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.terminal, "fish", "-C", `exec qalc -i '${root.math}'`]); Quickshell.execDetached(["app2unit", "--", ...Config.general.apps.terminal, "fish", "-C", `exec qalc -i '${root.math}'`]);
root.list.visibilities.launcher = false; root.list.visibilities.launcher = false;
} }

View file

@ -16,11 +16,8 @@ Item {
anchors.right: parent?.right anchors.right: parent?.right
StateLayer { StateLayer {
function onClicked(): void {
root.modelData?.onClicked(root.list);
}
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: root.modelData?.onClicked(root.list)
} }
Item { Item {

View file

@ -16,11 +16,8 @@ Item {
anchors.right: parent?.right anchors.right: parent?.right
StateLayer { StateLayer {
function onClicked(): void {
root.modelData?.onClicked(root.list);
}
radius: Tokens.rounding.normal radius: Tokens.rounding.normal
onClicked: root.modelData?.onClicked(root.list)
} }
Item { Item {

View file

@ -25,12 +25,11 @@ Item {
implicitHeight: image.height + label.height + Tokens.spacing.small / 2 + Tokens.padding.large + Tokens.padding.normal implicitHeight: image.height + label.height + Tokens.spacing.small / 2 + Tokens.padding.large + Tokens.padding.normal
StateLayer { StateLayer {
function onClicked(): void { radius: Tokens.rounding.normal
onClicked: {
Wallpapers.setWallpaper(root.modelData.path); Wallpapers.setWallpaper(root.modelData.path);
root.visibilities.launcher = false; root.visibilities.launcher = false;
} }
radius: Tokens.rounding.normal
} }
Elevation { Elevation {

View file

@ -135,7 +135,7 @@ ColumnLayout {
} }
StateLayer { StateLayer {
function onClicked(): void { onClicked: {
parent.forceActiveFocus(); parent.forceActiveFocus();
} }
@ -194,11 +194,8 @@ ColumnLayout {
radius: Tokens.rounding.full radius: Tokens.rounding.full
StateLayer { StateLayer {
function onClicked(): void {
root.lock.pam.passwd.start();
}
color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface color: root.lock.pam.buffer ? Colours.palette.m3onPrimary : Colours.palette.m3onSurface
onClicked: root.lock.pam.passwd.start()
} }
MaterialIcon { MaterialIcon {

View file

@ -110,34 +110,31 @@ Item {
spacing: Tokens.spacing.large spacing: Tokens.spacing.large
PlayerControl { PlayerControl {
function onClicked(): void { icon: "skip_previous"
onClicked: {
if (Players.active?.canGoPrevious) if (Players.active?.canGoPrevious)
Players.active.previous(); Players.active.previous();
} }
icon: "skip_previous"
} }
PlayerControl { PlayerControl {
function onClicked(): void {
if (Players.active?.canTogglePlaying)
Players.active.togglePlaying();
}
animate: true animate: true
icon: active ? "pause" : "play_arrow" icon: active ? "pause" : "play_arrow"
colour: "Primary" colour: "Primary"
level: active ? 2 : 1 level: active ? 2 : 1
active: Players.active?.isPlaying ?? false active: Players.active?.isPlaying ?? false
onClicked: {
if (Players.active?.canTogglePlaying)
Players.active.togglePlaying();
}
} }
PlayerControl { PlayerControl {
function onClicked(): void { icon: "skip_next"
onClicked: {
if (Players.active?.canGoNext) if (Players.active?.canGoNext)
Players.active.next(); Players.active.next();
} }
icon: "skip_next"
} }
} }
} }
@ -151,8 +148,7 @@ Item {
property string colour: "Secondary" property string colour: "Secondary"
property int level: 1 property int level: 1
function onClicked(): void { signal clicked
}
Layout.preferredWidth: implicitWidth + (controlState.pressed ? Tokens.padding.normal * 2 : active ? Tokens.padding.small * 2 : 0) Layout.preferredWidth: implicitWidth + (controlState.pressed ? Tokens.padding.normal * 2 : active ? Tokens.padding.small * 2 : 0)
implicitWidth: controlIcon.implicitWidth + Tokens.padding.large * 2 implicitWidth: controlIcon.implicitWidth + Tokens.padding.large * 2
@ -171,11 +167,8 @@ Item {
StateLayer { StateLayer {
id: controlState id: controlState
function onClicked(): void {
control.onClicked();
}
color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`] color: control.active ? Colours.palette[`m3on${control.colour}`] : Colours.palette[`m3on${control.colour}Container`]
onClicked: control.clicked()
} }
MaterialIcon { MaterialIcon {

View file

@ -176,11 +176,8 @@ StyledRect {
Layout.preferredWidth: root.notifs.length > Config.notifs.groupPreviewNum ? implicitWidth : 0 Layout.preferredWidth: root.notifs.length > Config.notifs.groupPreviewNum ? implicitWidth : 0
StateLayer { StateLayer {
function onClicked(): void {
root.expanded = !root.expanded;
}
color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface
onClicked: root.expanded = !root.expanded
} }
RowLayout { RowLayout {

View file

@ -356,12 +356,9 @@ StyledRect {
implicitHeight: expandIcon.height implicitHeight: expandIcon.height
StateLayer { StateLayer {
function onClicked() {
root.expanded = !root.expanded;
}
radius: Tokens.rounding.full radius: Tokens.rounding.full
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
onClicked: root.expanded = !root.expanded
} }
MaterialIcon { MaterialIcon {
@ -487,12 +484,9 @@ StyledRect {
implicitHeight: actionText.height + Tokens.padding.small * 2 implicitHeight: actionText.height + Tokens.padding.small * 2
StateLayer { StateLayer {
function onClicked(): void {
action.modelData.invoke();
}
radius: Tokens.rounding.full radius: Tokens.rounding.full
color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onSecondary : Colours.palette.m3onSurface color: root.modelData.urgency === NotificationUrgency.Critical ? Colours.palette.m3onSecondary : Colours.palette.m3onSurface
onClicked: action.modelData.invoke()
} }
StyledText { StyledText {

View file

@ -115,12 +115,9 @@ Column {
} }
StateLayer { StateLayer {
function onClicked(): void {
Quickshell.execDetached(button.command);
}
radius: parent.radius radius: parent.radius
color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface color: button.activeFocus ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
onClicked: Quickshell.execDetached(button.command)
} }
MaterialIcon { MaterialIcon {

View file

@ -131,7 +131,7 @@ Item {
StateLayer { StateLayer {
id: actionStateLayer id: actionStateLayer
function onClicked(): void { onClicked: {
if (action.modelData.isClose) { if (action.modelData.isClose) {
root.notif.close(); root.notif.close();
} else if (action.modelData.isCopy) { } else if (action.modelData.isCopy) {

View file

@ -204,11 +204,8 @@ StyledRect {
radius: Tokens.rounding.full radius: Tokens.rounding.full
StateLayer { StateLayer {
function onClicked(): void {
root.toggleExpand(!root.expanded);
}
color: root.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : Colours.palette.m3onSurface color: root.urgency === NotificationUrgency.Critical ? Colours.palette.m3onError : Colours.palette.m3onSurface
onClicked: root.toggleExpand(!root.expanded)
} }
RowLayout { RowLayout {

View file

@ -37,11 +37,8 @@ ColumnLayout {
implicitHeight: moveToWsIcon.implicitHeight + Tokens.padding.small implicitHeight: moveToWsIcon.implicitHeight + Tokens.padding.small
StateLayer { StateLayer {
function onClicked(): void {
root.moveToWsExpanded = !root.moveToWsExpanded;
}
color: Colours.palette.m3onPrimary color: Colours.palette.m3onPrimary
onClicked: root.moveToWsExpanded = !root.moveToWsExpanded
} }
MaterialIcon { MaterialIcon {
@ -83,7 +80,7 @@ ColumnLayout {
readonly property int wsId: Math.floor((Hypr.activeWsId - 1) / 10) * 10 + index + 1 readonly property int wsId: Math.floor((Hypr.activeWsId - 1) / 10) * 10 + index + 1
readonly property bool isCurrent: root.client?.workspace.id === wsId readonly property bool isCurrent: root.client?.workspace.id === wsId
function onClicked(): void { onClicked: {
Hypr.dispatch(`movetoworkspace ${wsId},address:0x${root.client?.address}`); Hypr.dispatch(`movetoworkspace ${wsId},address:0x${root.client?.address}`);
} }
@ -109,13 +106,10 @@ ColumnLayout {
spacing: root.client?.lastIpcObject.floating ? Tokens.spacing.normal : Tokens.spacing.small spacing: root.client?.lastIpcObject.floating ? Tokens.spacing.normal : Tokens.spacing.small
Button { Button {
function onClicked(): void {
Hypr.dispatch(`togglefloating address:0x${root.client?.address}`);
}
color: Colours.palette.m3secondaryContainer color: Colours.palette.m3secondaryContainer
onColor: Colours.palette.m3onSecondaryContainer onColor: Colours.palette.m3onSecondaryContainer
text: root.client?.lastIpcObject.floating ? qsTr("Tile") : qsTr("Float") text: root.client?.lastIpcObject.floating ? qsTr("Tile") : qsTr("Float")
onClicked: Hypr.dispatch(`togglefloating address:0x${root.client?.address}`)
} }
Loader { Loader {
@ -126,24 +120,18 @@ ColumnLayout {
Layout.rightMargin: active ? 0 : -parent.spacing Layout.rightMargin: active ? 0 : -parent.spacing
sourceComponent: Button { sourceComponent: Button {
function onClicked(): void {
Hypr.dispatch(`pin address:0x${root.client?.address}`);
}
color: Colours.palette.m3secondaryContainer color: Colours.palette.m3secondaryContainer
onColor: Colours.palette.m3onSecondaryContainer onColor: Colours.palette.m3onSecondaryContainer
text: root.client?.lastIpcObject.pinned ? qsTr("Unpin") : qsTr("Pin") text: root.client?.lastIpcObject.pinned ? qsTr("Unpin") : qsTr("Pin")
onClicked: Hypr.dispatch(`pin address:0x${root.client?.address}`)
} }
} }
Button { Button {
function onClicked(): void {
Hypr.dispatch(`killwindow address:0x${root.client?.address}`);
}
color: Colours.palette.m3errorContainer color: Colours.palette.m3errorContainer
onColor: Colours.palette.m3onErrorContainer onColor: Colours.palette.m3onErrorContainer
text: qsTr("Kill") text: qsTr("Kill")
onClicked: Hypr.dispatch(`killwindow address:0x${root.client?.address}`)
} }
} }
@ -152,8 +140,7 @@ ColumnLayout {
property alias disabled: stateLayer.disabled property alias disabled: stateLayer.disabled
property alias text: label.text property alias text: label.text
function onClicked(): void { signal clicked
}
radius: Tokens.rounding.small radius: Tokens.rounding.small
@ -163,11 +150,8 @@ ColumnLayout {
StateLayer { StateLayer {
id: stateLayer id: stateLayer
function onClicked(): void {
parent.onClicked();
}
color: parent.onColor color: parent.onColor
onClicked: parent.clicked()
} }
StyledText { StyledText {