Skip to content

Commit 7e9785a

Browse files
committed
chore: linting
1 parent eda60d9 commit 7e9785a

14 files changed

Lines changed: 85 additions & 54 deletions

modules/nexus/ContentArea.qml

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma ComponentBehavior: Bound
33
import QtQuick
44
import QtQuick.Layouts
55
import qs.components
6-
import qs.config
76
import qs.services
7+
import qs.config
88
import qs.modules.nexus
99

1010
Item {
@@ -17,6 +17,30 @@ Item {
1717

1818
property int activeTabIndex: 0
1919

20+
function updateTabIndicator() {
21+
const item = tabRepeater.itemAt(activeTabIndex);
22+
if (item) {
23+
tabIndicator.targetX = item.x;
24+
tabIndicator.targetWidth = item.width;
25+
} else {
26+
tabIndicator.targetX = 0;
27+
tabIndicator.targetWidth = 0;
28+
}
29+
}
30+
31+
function onForcedTabChanged() {
32+
if (session.forcedTab !== "") {
33+
const tabList = root.tabs;
34+
for (let i = 0; i < tabList.length; i++) {
35+
if (tabList[i] === session.forcedTab) {
36+
root.activeTabIndex = i;
37+
break;
38+
}
39+
}
40+
session.consumeForcedTab();
41+
}
42+
}
43+
2044
onActiveConfigChanged: {
2145
activeTabIndex = 0;
2246
tabIndicatorUpdate.restart();
@@ -28,35 +52,17 @@ Item {
2852

2953
Timer {
3054
id: tabIndicatorUpdate
55+
3156
interval: 0
3257
onTriggered: root.updateTabIndicator()
3358
}
3459

35-
function updateTabIndicator() {
36-
const item = tabRepeater.itemAt(activeTabIndex);
37-
if (item) {
38-
tabIndicator.targetX = item.x;
39-
tabIndicator.targetWidth = item.width;
40-
} else {
41-
tabIndicator.targetX = 0;
42-
tabIndicator.targetWidth = 0;
43-
}
44-
}
45-
4660
Connections {
47-
target: session
4861
function onForcedTabChanged() {
49-
if (session.forcedTab !== "") {
50-
const tabList = root.tabs;
51-
for (let i = 0; i < tabList.length; i++) {
52-
if (tabList[i] === session.forcedTab) {
53-
root.activeTabIndex = i;
54-
break;
55-
}
56-
}
57-
session.consumeForcedTab();
58-
}
62+
root.onForcedTabChanged();
5963
}
64+
65+
target: session
6066
}
6167

6268
ColumnLayout {
@@ -109,12 +115,14 @@ Item {
109115

110116
Row {
111117
id: tabRow
118+
112119
anchors.left: parent.left
113120
anchors.bottom: parent.bottom
114121
spacing: 4
115122

116123
Repeater {
117124
id: tabRepeater
125+
118126
model: root.tabs
119127

120128
delegate: Rectangle {
@@ -135,6 +143,7 @@ Item {
135143

136144
StyledText {
137145
id: tabLabel
146+
138147
anchors.centerIn: parent
139148
text: tabItem.modelData
140149
font.pointSize: Appearance.font.size.normal
@@ -150,6 +159,7 @@ Item {
150159
function onClicked() {
151160
root.activeTabIndex = tabItem.index;
152161
}
162+
153163
radius: Appearance.rounding.small
154164
color: root.activeTabIndex === tabItem.index ? Colours.palette.m3primary : Colours.palette.m3onSurface
155165
}
@@ -160,16 +170,16 @@ Item {
160170
Rectangle {
161171
id: tabIndicator
162172

173+
property real targetX: 0
174+
property real targetWidth: 0
175+
163176
anchors.bottom: parent.bottom
164177
anchors.bottomMargin: -8
165178
height: 3
166179
radius: 1.5
167180
color: Colours.palette.m3primary
168181
visible: root.tabs.length > 0
169182

170-
property real targetX: 0
171-
property real targetWidth: 0
172-
173183
x: targetX
174184
width: targetWidth
175185

@@ -199,12 +209,11 @@ Item {
199209
Loader {
200210
id: panelLoader
201211

202-
anchors.fill: parent
203-
asynchronous: true
204-
205212
readonly property string targetSource: root.activeConfig ? "panels/" + root.activeConfig.id.charAt(0).toUpperCase() + root.activeConfig.id.slice(1) + "Panel.qml" : ""
206213
property string resolvedSource: targetSource
207214

215+
anchors.fill: parent
216+
asynchronous: true
208217
source: resolvedSource
209218

210219
onTargetSourceChanged: resolvedSource = targetSource
@@ -225,12 +234,13 @@ Item {
225234
}
226235

227236
Connections {
228-
target: root
229237
function onActiveTabIndexChanged() {
230238
if (panelLoader.item && panelLoader.item.hasOwnProperty("activeTabIndex")) {
231239
panelLoader.item.activeTabIndex = root.activeTabIndex;
232240
}
233241
}
242+
243+
target: root
234244
}
235245
}
236246
}

modules/nexus/Nexus.qml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import QtQuick.Layouts
55
import Quickshell
66
import Quickshell.Hyprland
77
import qs.components
8-
import qs.config
98
import qs.services
9+
import qs.config
1010
import qs.modules.nexus
1111
import "./components"
1212

@@ -23,6 +23,7 @@ Item {
2323

2424
readonly property NexusSession session: NexusSession {
2525
id: session
26+
2627
nexusRoot: root
2728
}
2829

@@ -33,6 +34,7 @@ Item {
3334

3435
RowLayout {
3536
id: mainLayout
37+
3638
anchors.fill: parent
3739
spacing: 0
3840

@@ -57,6 +59,7 @@ Item {
5759

5860
Sidebar {
5961
id: sidebar
62+
6063
anchors.fill: parent
6164
anchors.leftMargin: 5
6265
anchors.rightMargin: 5
@@ -100,10 +103,10 @@ Item {
100103
anchors.right: parent.right
101104
width: 40
102105
height: 40
103-
color: Colours.tPalette.m3surfaceContainer
104-
105106
property bool hovered: closeMA.containsMouse
106107

108+
color: Colours.tPalette.m3surfaceContainer
109+
107110
MaterialIcon {
108111
anchors.centerIn: parent
109112
text: "close"
@@ -113,6 +116,7 @@ Item {
113116

114117
MouseArea {
115118
id: closeMA
119+
116120
anchors.fill: parent
117121
hoverEnabled: true
118122
onClicked: root.close()
@@ -122,16 +126,15 @@ Item {
122126
Rectangle {
123127
id: maximizeBtn
124128

129+
property bool hovered: maxMA.containsMouse
130+
125131
anchors.top: parent.top
126132
anchors.right: closeBtn.left
127133
width: 44
128134
height: 40
129135
color: Colours.tPalette.m3surfaceContainer
130-
131136
bottomLeftRadius: Appearance.rounding.small
132137

133-
property bool hovered: maxMA.containsMouse
134-
135138
MaterialIcon {
136139
anchors.centerIn: parent
137140
text: root.floating ? "fullscreen" : "fullscreen_exit"
@@ -141,6 +144,7 @@ Item {
141144

142145
MouseArea {
143146
id: maxMA
147+
144148
anchors.fill: parent
145149
hoverEnabled: true
146150
onClicked: {
@@ -162,19 +166,19 @@ Item {
162166
x: sidebarContainer.width + 8
163167
y: sidebar.flyoutTop
164168

169+
onHoverEntered: sidebar.cancelFlyoutClose()
170+
onHoverExited: sidebar.scheduleFlyoutClose()
171+
onChildClicked: function (id) {
172+
session.setCategory(id);
173+
}
174+
165175
Behavior on y {
166176
NumberAnimation {
167177
duration: 300
168178
easing.type: Easing.BezierSpline
169179
easing.bezierCurve: [0.34, 1.56, 0.64, 1, 1, 1]
170180
}
171181
}
172-
173-
onHoverEntered: sidebar.cancelFlyoutClose()
174-
onHoverExited: sidebar.scheduleFlyoutClose()
175-
onChildClicked: function (id) {
176-
session.setCategory(id);
177-
}
178182
}
179183

180184
// Search popout

modules/nexus/NexusWindowFactory.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Singleton {
5252

5353
Connections {
5454
target: Hyprland
55+
5556
function onToplevelsChanged() {
5657
const our = Hyprland.toplevels.values.find(t => t.title === win.title);
5758
if (our) {

modules/nexus/Sidebar.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma ComponentBehavior: Bound
33
import QtQuick
44
import QtQuick.Layouts
55
import qs.components
6-
import qs.config
76
import qs.services
7+
import qs.config
88
import qs.modules.nexus
99
import "./components"
1010

@@ -18,6 +18,7 @@ Item {
1818

1919
Timer {
2020
id: flyoutCloseTimer
21+
2122
interval: 250
2223
onTriggered: root.flyoutCategory = ""
2324
}
@@ -162,6 +163,7 @@ Item {
162163
function onClicked() {
163164
root.session.toggleSidebar();
164165
}
166+
165167
color: Colours.palette.m3onSurface
166168
}
167169

modules/nexus/SidebarFlyout.qml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma ComponentBehavior: Bound
33
import QtQuick
44
import QtQuick.Layouts
55
import qs.components
6-
import qs.config
76
import qs.services
7+
import qs.config
88
import qs.modules.nexus
99

1010
Item {
@@ -26,7 +26,6 @@ Item {
2626
implicitWidth: drawer.targetWidth + 2
2727
implicitHeight: drawer.targetHeight
2828

29-
// Track previous category for crossfade
3029
property string _prevCategory: ""
3130
property var _prevCat: null
3231

@@ -89,6 +88,7 @@ Item {
8988

9089
NumberAnimation {
9190
id: contentFadeOut
91+
9292
target: contentContainer
9393
property: "opacity"
9494
from: 1
@@ -103,6 +103,7 @@ Item {
103103

104104
NumberAnimation {
105105
id: contentFadeIn
106+
106107
target: contentContainer
107108
property: "opacity"
108109
from: 0
@@ -161,6 +162,7 @@ Item {
161162
function onClicked() {
162163
root.childClicked(flyoutChild.modelData.id);
163164
}
165+
164166
radius: Appearance.rounding.normal
165167
color: flyoutChild.isActive ? Colours.palette.m3primary : Colours.palette.m3onSurface
166168
}

modules/nexus/components/ConfigSwitcher.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pragma ComponentBehavior: Bound
33
import QtQuick
44
import QtQuick.Layouts
55
import qs.components
6-
import qs.config
76
import qs.services
7+
import qs.config
88
import ".."
99

1010
ColumnLayout {
@@ -47,6 +47,7 @@ ColumnLayout {
4747

4848
delegate: Item {
4949
id: configDelegate
50+
5051
required property var modelData
5152

5253
Layout.fillWidth: true
@@ -115,6 +116,7 @@ ColumnLayout {
115116
root.session.activeConfig = configDelegate.modelData.id;
116117
root.session.configPopoutOpen = false;
117118
}
119+
118120
radius: parent.radius
119121
color: Colours.palette.m3onSurface
120122
}

0 commit comments

Comments
 (0)