1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
|
import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
Item {
id: root
DankFlickable {
anchors.fill: parent
clip: true
contentHeight: mainColumn.height + Theme.spacingXL
contentWidth: width
Column {
id: mainColumn
topPadding: 4
width: Math.min(550, parent.width - Theme.spacingL * 2)
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingXL
SettingsCard {
width: parent.width
iconName: "view_module"
title: I18n.tr("Workspace Settings")
settingKey: "workspaceSettings"
SettingsToggleRow {
settingKey: "showWorkspaceIndex"
tags: ["workspace", "index", "numbers", "labels"]
text: I18n.tr("Workspace Index Numbers")
description: I18n.tr("Show workspace index numbers in the top bar workspace switcher")
checked: SettingsData.showWorkspaceIndex
onToggled: checked => SettingsData.set("showWorkspaceIndex", checked)
}
SettingsToggleRow {
settingKey: "showWorkspaceName"
tags: ["workspace", "name", "labels"]
text: I18n.tr("Workspace Names")
description: I18n.tr("Show workspace name on horizontal bars, and first letter on vertical bars")
checked: SettingsData.showWorkspaceName
onToggled: checked => SettingsData.set("showWorkspaceName", checked)
}
SettingsToggleRow {
settingKey: "showWorkspacePadding"
tags: ["workspace", "padding", "minimum"]
text: I18n.tr("Workspace Padding")
description: I18n.tr("Always show a minimum of 3 workspaces, even if fewer are available")
checked: SettingsData.showWorkspacePadding
onToggled: checked => SettingsData.set("showWorkspacePadding", checked)
}
SettingsToggleRow {
settingKey: "showWorkspaceApps"
tags: ["workspace", "apps", "icons", "applications"]
text: I18n.tr("Show Workspace Apps")
description: I18n.tr("Display application icons in workspace indicators")
checked: SettingsData.showWorkspaceApps
visible: CompositorService.isNiri || CompositorService.isHyprland
onToggled: checked => SettingsData.set("showWorkspaceApps", checked)
}
Item {
width: parent.width
height: maxAppsColumn.height
visible: SettingsData.showWorkspaceApps
opacity: visible ? 1 : 0
Column {
id: maxAppsColumn
x: Theme.spacingL
width: 120
spacing: Theme.spacingS
StyledText {
text: I18n.tr("Max apps to show")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Medium
horizontalAlignment: Text.AlignLeft
}
DankTextField {
width: 100
height: 28
placeholderText: "3"
text: SettingsData.maxWorkspaceIcons
maximumLength: 2
font.pixelSize: Theme.fontSizeSmall
topPadding: Theme.spacingXS
bottomPadding: Theme.spacingXS
onEditingFinished: SettingsData.set("maxWorkspaceIcons", parseInt(text, 10))
}
}
Behavior on opacity {
NumberAnimation {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
SettingsSliderRow {
visible: SettingsData.showWorkspaceApps
text: I18n.tr("Icon Size")
value: SettingsData.workspaceAppIconSizeOffset
minimum: 0
maximum: 10
unit: "px"
defaultValue: 0
onSliderValueChanged: newValue => SettingsData.set("workspaceAppIconSizeOffset", newValue)
}
SettingsToggleRow {
settingKey: "groupWorkspaceApps"
tags: ["workspace", "apps", "icons", "group", "grouped", "collapse"]
text: I18n.tr("Group Workspace Apps")
description: I18n.tr("Group repeated application icons in unfocused workspaces")
checked: SettingsData.groupWorkspaceApps
visible: SettingsData.showWorkspaceApps
onToggled: checked => SettingsData.set("groupWorkspaceApps", checked)
}
SettingsToggleRow {
settingKey: "workspaceActiveAppHighlightEnabled"
tags: ["workspace", "apps", "icons", "highlight", "active", "focused"]
text: I18n.tr("Highlight Active Workspace App")
description: I18n.tr("Highlight the currently focused app inside workspace indicators")
checked: SettingsData.workspaceActiveAppHighlightEnabled
visible: SettingsData.showWorkspaceApps
onToggled: checked => SettingsData.set("workspaceActiveAppHighlightEnabled", checked)
}
SettingsToggleRow {
settingKey: "workspaceFollowFocus"
tags: ["workspace", "focus", "follow", "monitor"]
text: I18n.tr("Follow Monitor Focus")
description: I18n.tr("Show workspaces of the currently focused monitor")
checked: SettingsData.workspaceFollowFocus
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
onToggled: checked => SettingsData.set("workspaceFollowFocus", checked)
}
SettingsToggleRow {
settingKey: "showOccupiedWorkspacesOnly"
tags: ["workspace", "occupied", "active", "windows"]
text: I18n.tr("Show Occupied Workspaces Only")
description: I18n.tr("Display only workspaces that contain windows")
checked: SettingsData.showOccupiedWorkspacesOnly
visible: CompositorService.isNiri || CompositorService.isHyprland
onToggled: checked => SettingsData.set("showOccupiedWorkspacesOnly", checked)
}
SettingsToggleRow {
settingKey: "reverseScrolling"
tags: ["workspace", "scroll", "scrolling", "reverse", "direction"]
text: I18n.tr("Reverse Scrolling Direction")
description: I18n.tr("Reverse workspace switch direction when scrolling over the bar")
checked: SettingsData.reverseScrolling
visible: CompositorService.isNiri || CompositorService.isHyprland
onToggled: checked => SettingsData.set("reverseScrolling", checked)
}
SettingsToggleRow {
settingKey: "workspaceDragReorder"
tags: ["workspace", "drag", "reorder", "sort", "move"]
text: I18n.tr("Drag to Reorder")
description: I18n.tr("Drag workspace indicators to reorder them")
checked: SettingsData.workspaceDragReorder
visible: CompositorService.isNiri
onToggled: checked => SettingsData.set("workspaceDragReorder", checked)
}
SettingsToggleRow {
settingKey: "dwlShowAllTags"
tags: ["dwl", "tags", "workspace"]
text: I18n.tr("Show All Tags")
description: I18n.tr("Show all 9 tags instead of only occupied tags (DWL only)")
checked: SettingsData.dwlShowAllTags
visible: CompositorService.isDwl
onToggled: checked => SettingsData.set("dwlShowAllTags", checked)
}
}
SettingsCard {
width: parent.width
iconName: "palette"
title: I18n.tr("Workspace Appearance")
settingKey: "workspaceAppearance"
SettingsButtonGroupRow {
text: I18n.tr("Focused Color")
model: ["pri", "s", "sc", "sch", "none"]
buttonHeight: 22
minButtonWidth: 36
buttonPadding: Theme.spacingS
checkIconSize: Theme.iconSizeSmall - 2
textSize: Theme.fontSizeSmall - 1
spacing: 1
currentIndex: {
switch (SettingsData.workspaceColorMode) {
case "s":
return 1;
case "sc":
return 2;
case "sch":
return 3;
case "none":
return 4;
default:
return 0;
}
}
onSelectionChanged: (index, selected) => {
if (!selected)
return;
const modes = ["default", "s", "sc", "sch", "none"];
SettingsData.set("workspaceColorMode", modes[index]);
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
}
SettingsButtonGroupRow {
text: I18n.tr("Occupied Color")
model: ["none", "sec", "s", "sc", "sch", "schh"]
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl
buttonHeight: 22
minButtonWidth: 36
buttonPadding: Theme.spacingS
checkIconSize: Theme.iconSizeSmall - 2
textSize: Theme.fontSizeSmall - 1
spacing: 1
currentIndex: {
switch (SettingsData.workspaceOccupiedColorMode) {
case "sec":
return 1;
case "s":
return 2;
case "sc":
return 3;
case "sch":
return 4;
case "schh":
return 5;
default:
return 0;
}
}
onSelectionChanged: (index, selected) => {
if (!selected)
return;
const modes = ["none", "sec", "s", "sc", "sch", "schh"];
SettingsData.set("workspaceOccupiedColorMode", modes[index]);
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl
}
SettingsButtonGroupRow {
text: I18n.tr("Unfocused Color")
model: ["def", "s", "sc", "sch"]
buttonHeight: 22
minButtonWidth: 36
buttonPadding: Theme.spacingS
checkIconSize: Theme.iconSizeSmall - 2
textSize: Theme.fontSizeSmall - 1
spacing: 1
currentIndex: {
switch (SettingsData.workspaceUnfocusedColorMode) {
case "s":
return 1;
case "sc":
return 2;
case "sch":
return 3;
default:
return 0;
}
}
onSelectionChanged: (index, selected) => {
if (!selected)
return;
const modes = ["default", "s", "sc", "sch"];
SettingsData.set("workspaceUnfocusedColorMode", modes[index]);
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
}
SettingsButtonGroupRow {
text: I18n.tr("Urgent Color")
visible: CompositorService.isNiri || CompositorService.isHyprland || CompositorService.isDwl || CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle
model: ["err", "pri", "sec", "s", "sc"]
buttonHeight: 22
minButtonWidth: 36
buttonPadding: Theme.spacingS
checkIconSize: Theme.iconSizeSmall - 2
textSize: Theme.fontSizeSmall - 1
spacing: 1
currentIndex: {
switch (SettingsData.workspaceUrgentColorMode) {
case "primary":
return 1;
case "secondary":
return 2;
case "s":
return 3;
case "sc":
return 4;
default:
return 0;
}
}
onSelectionChanged: (index, selected) => {
if (!selected)
return;
const modes = ["default", "primary", "secondary", "s", "sc"];
SettingsData.set("workspaceUrgentColorMode", modes[index]);
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.15
}
SettingsToggleRow {
settingKey: "workspaceFocusedBorderEnabled"
tags: ["workspace", "border", "outline", "focused", "ring"]
text: I18n.tr("Focused Border")
description: I18n.tr("Show an outline ring around the focused workspace indicator")
checked: SettingsData.workspaceFocusedBorderEnabled
onToggled: checked => SettingsData.set("workspaceFocusedBorderEnabled", checked)
}
Column {
width: parent.width
spacing: Theme.spacingS
visible: SettingsData.workspaceFocusedBorderEnabled
leftPadding: Theme.spacingM
SettingsButtonGroupRow {
width: parent.width - parent.leftPadding
text: I18n.tr("Border Color")
model: [I18n.tr("Surface"), I18n.tr("Secondary"), I18n.tr("Primary")]
currentIndex: {
switch (SettingsData.workspaceFocusedBorderColor) {
case "surfaceText":
return 0;
case "secondary":
return 1;
case "primary":
return 2;
default:
return 2;
}
}
onSelectionChanged: (index, selected) => {
if (!selected)
return;
let newColor = "primary";
switch (index) {
case 0:
newColor = "surfaceText";
break;
case 1:
newColor = "secondary";
break;
case 2:
newColor = "primary";
break;
}
SettingsData.set("workspaceFocusedBorderColor", newColor);
}
}
SettingsSliderRow {
width: parent.width - parent.leftPadding
text: I18n.tr("Thickness")
value: SettingsData.workspaceFocusedBorderThickness
minimum: 1
maximum: 6
unit: "px"
defaultValue: 2
onSliderValueChanged: newValue => SettingsData.set("workspaceFocusedBorderThickness", newValue)
}
}
}
SettingsCard {
width: parent.width
iconName: "label"
title: I18n.tr("Named Workspace Icons")
settingKey: "workspaceIcons"
visible: SettingsData.hasNamedWorkspaces()
StyledText {
width: parent.width
text: I18n.tr("Configure icons for named workspaces. Icons take priority over numbers when both are enabled.")
font.pixelSize: Theme.fontSizeSmall
color: Theme.outline
wrapMode: Text.WordWrap
}
Repeater {
model: SettingsData.getNamedWorkspaces()
Rectangle {
width: parent.width
height: workspaceIconRow.implicitHeight + Theme.spacingM
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5)
border.width: 0
Row {
id: workspaceIconRow
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
spacing: Theme.spacingM
StyledText {
text: "\"" + modelData + "\""
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
width: 150
elide: Text.ElideRight
}
DankIconPicker {
id: iconPicker
anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: {
var iconData = SettingsData.getWorkspaceNameIcon(modelData);
if (iconData) {
setIcon(iconData.value, iconData.type);
}
}
onIconSelected: (iconName, iconType) => {
SettingsData.setWorkspaceNameIcon(modelData, {
"type": iconType,
"value": iconName
});
setIcon(iconName, iconType);
}
Connections {
target: SettingsData
function onWorkspaceIconsUpdated() {
var iconData = SettingsData.getWorkspaceNameIcon(modelData);
if (iconData) {
iconPicker.setIcon(iconData.value, iconData.type);
} else {
iconPicker.setIcon("", "icon");
}
}
}
}
Rectangle {
width: 28
height: 28
radius: Theme.cornerRadius
color: clearMouseArea.containsMouse ? Theme.errorHover : Theme.surfaceContainer
border.width: 0
anchors.verticalCenter: parent.verticalCenter
DankIcon {
name: "close"
size: 16
color: clearMouseArea.containsMouse ? Theme.error : Theme.outline
anchors.centerIn: parent
}
MouseArea {
id: clearMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: SettingsData.removeWorkspaceNameIcon(modelData)
}
}
Item {
width: parent.width - 150 - 240 - 28 - Theme.spacingM * 4
height: 1
}
}
}
}
}
}
}
}
|