summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/Settings/LauncherTab.qml
blob: 8705d4207e92878fd481693b4ef1c817738ba2fb (plain)
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
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
import QtQuick
import qs.Common
import qs.Modals.FileBrowser
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets

Item {
    id: root

    FileBrowserModal {
        id: logoFileBrowser
        browserTitle: I18n.tr("Select Launcher Logo")
        browserIcon: "image"
        browserType: "generic"
        filterExtensions: ["*.svg", "*.png", "*.jpg", "*.jpeg", "*.webp"]
        onFileSelected: path => SettingsData.set("launcherLogoCustomPath", path.replace("file://", ""))
    }

    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: "apps"
                title: I18n.tr("Launcher Button Logo")
                settingKey: "launcherLogo"

                StyledText {
                    width: parent.width
                    text: I18n.tr("Choose the logo displayed on the launcher button in DankBar")
                    font.pixelSize: Theme.fontSizeSmall
                    color: Theme.surfaceVariantText
                    wrapMode: Text.WordWrap
                }

                Item {
                    width: parent.width
                    height: logoModeGroup.implicitHeight
                    clip: true

                    DankButtonGroup {
                        id: logoModeGroup
                        anchors.horizontalCenter: parent.horizontalCenter
                        buttonPadding: parent.width < 480 ? Theme.spacingS : Theme.spacingL
                        minButtonWidth: parent.width < 480 ? 44 : 64
                        textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
                        model: {
                            const modes = [I18n.tr("Apps Icon"), I18n.tr("OS Logo"), I18n.tr("Dank")];
                            if (CompositorService.isNiri) {
                                modes.push("niri");
                            } else if (CompositorService.isHyprland) {
                                modes.push("Hyprland");
                            } else if (CompositorService.isDwl) {
                                modes.push("mango");
                            } else if (CompositorService.isSway) {
                                modes.push("Sway");
                            } else if (CompositorService.isScroll) {
                                modes.push("Scroll");
                            } else if (CompositorService.isMiracle) {
                                modes.push("Miracle");
                            } else {
                                modes.push(I18n.tr("Compositor"));
                            }
                            modes.push(I18n.tr("Custom"));
                            return modes;
                        }
                        currentIndex: {
                            if (SettingsData.launcherLogoMode === "apps")
                                return 0;
                            if (SettingsData.launcherLogoMode === "os")
                                return 1;
                            if (SettingsData.launcherLogoMode === "dank")
                                return 2;
                            if (SettingsData.launcherLogoMode === "compositor")
                                return 3;
                            if (SettingsData.launcherLogoMode === "custom")
                                return 4;
                            return 0;
                        }
                        onSelectionChanged: (index, selected) => {
                            if (!selected)
                                return;
                            switch (index) {
                            case 0:
                                SettingsData.set("launcherLogoMode", "apps");
                                break;
                            case 1:
                                SettingsData.set("launcherLogoMode", "os");
                                break;
                            case 2:
                                SettingsData.set("launcherLogoMode", "dank");
                                break;
                            case 3:
                                SettingsData.set("launcherLogoMode", "compositor");
                                break;
                            case 4:
                                SettingsData.set("launcherLogoMode", "custom");
                                break;
                            }
                        }
                    }
                }

                Row {
                    width: parent.width
                    visible: SettingsData.launcherLogoMode === "custom"
                    spacing: Theme.spacingM

                    StyledRect {
                        width: parent.width - selectButton.width - Theme.spacingM
                        height: 36
                        radius: Theme.cornerRadius
                        color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.9)
                        border.color: Theme.outlineStrong
                        border.width: 1

                        StyledText {
                            anchors.left: parent.left
                            anchors.leftMargin: Theme.spacingM
                            anchors.verticalCenter: parent.verticalCenter
                            text: SettingsData.launcherLogoCustomPath || I18n.tr("Select an image file...")
                            font.pixelSize: Theme.fontSizeMedium
                            color: SettingsData.launcherLogoCustomPath ? Theme.surfaceText : Theme.outlineButton
                            width: parent.width - Theme.spacingM * 2
                            elide: Text.ElideMiddle
                        }
                    }

                    DankActionButton {
                        id: selectButton
                        iconName: "folder_open"
                        width: 36
                        height: 36
                        onClicked: logoFileBrowser.open()
                    }
                }

                Column {
                    width: parent.width
                    spacing: Theme.spacingL
                    visible: SettingsData.launcherLogoMode !== "apps"

                    Column {
                        width: parent.width
                        spacing: Theme.spacingM

                        StyledText {
                            text: I18n.tr("Color Override")
                            font.pixelSize: Theme.fontSizeSmall
                            color: Theme.surfaceText
                            font.weight: Font.Medium
                            anchors.horizontalCenter: parent.horizontalCenter
                        }

                        Item {
                            width: parent.width
                            height: colorOverrideRow.implicitHeight
                            clip: true

                            Row {
                                id: colorOverrideRow
                                anchors.horizontalCenter: parent.horizontalCenter
                                spacing: Theme.spacingM

                                DankButtonGroup {
                                    id: colorModeGroup
                                    buttonPadding: parent.parent.width < 480 ? Theme.spacingS : Theme.spacingL
                                    minButtonWidth: parent.parent.width < 480 ? 44 : 64
                                    textSize: parent.parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
                                    model: [I18n.tr("Default"), I18n.tr("Primary"), I18n.tr("Surface"), I18n.tr("Custom")]
                                    currentIndex: {
                                        const override = SettingsData.launcherLogoColorOverride;
                                        if (override === "")
                                            return 0;
                                        if (override === "primary")
                                            return 1;
                                        if (override === "surface")
                                            return 2;
                                        return 3;
                                    }
                                    onSelectionChanged: (index, selected) => {
                                        if (!selected)
                                            return;
                                        switch (index) {
                                        case 0:
                                            SettingsData.set("launcherLogoColorOverride", "");
                                            break;
                                        case 1:
                                            SettingsData.set("launcherLogoColorOverride", "primary");
                                            break;
                                        case 2:
                                            SettingsData.set("launcherLogoColorOverride", "surface");
                                            break;
                                        case 3:
                                            const currentOverride = SettingsData.launcherLogoColorOverride;
                                            const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface";
                                            if (isPreset) {
                                                SettingsData.set("launcherLogoColorOverride", "#ffffff");
                                            }
                                            break;
                                        }
                                    }
                                }

                                Rectangle {
                                    id: colorPickerCircle
                                    visible: {
                                        const override = SettingsData.launcherLogoColorOverride;
                                        return override !== "" && override !== "primary" && override !== "surface";
                                    }
                                    width: 36
                                    height: 36
                                    radius: 18
                                    color: {
                                        const override = SettingsData.launcherLogoColorOverride;
                                        if (override !== "" && override !== "primary" && override !== "surface")
                                            return override;
                                        return "#ffffff";
                                    }
                                    border.color: Theme.outline
                                    border.width: 1
                                    anchors.verticalCenter: parent.verticalCenter

                                    MouseArea {
                                        anchors.fill: parent
                                        cursorShape: Qt.PointingHandCursor
                                        onClicked: {
                                            if (!PopoutService.colorPickerModal)
                                                return;
                                            PopoutService.colorPickerModal.selectedColor = SettingsData.launcherLogoColorOverride;
                                            PopoutService.colorPickerModal.pickerTitle = I18n.tr("Choose Launcher Logo Color");
                                            PopoutService.colorPickerModal.onColorSelectedCallback = function (selectedColor) {
                                                SettingsData.set("launcherLogoColorOverride", selectedColor);
                                            };
                                            PopoutService.colorPickerModal.show();
                                        }
                                    }
                                }
                            }
                        }
                    }

                    SettingsSliderRow {
                        settingKey: "launcherLogoSizeOffset"
                        tags: ["launcher", "logo", "size", "offset", "scale"]
                        text: I18n.tr("Size Offset")
                        minimum: -12
                        maximum: 12
                        value: SettingsData.launcherLogoSizeOffset
                        defaultValue: 0
                        onSliderValueChanged: newValue => SettingsData.set("launcherLogoSizeOffset", newValue)
                    }

                    Column {
                        width: parent.width
                        spacing: Theme.spacingM
                        visible: {
                            const override = SettingsData.launcherLogoColorOverride;
                            return override !== "" && override !== "primary" && override !== "surface";
                        }

                        SettingsSliderRow {
                            settingKey: "launcherLogoBrightness"
                            tags: ["launcher", "logo", "brightness", "color"]
                            text: I18n.tr("Brightness")
                            minimum: 0
                            maximum: 100
                            value: Math.round(SettingsData.launcherLogoBrightness * 100)
                            unit: "%"
                            defaultValue: 100
                            onSliderValueChanged: newValue => SettingsData.set("launcherLogoBrightness", newValue / 100)
                        }

                        SettingsSliderRow {
                            settingKey: "launcherLogoContrast"
                            tags: ["launcher", "logo", "contrast", "color"]
                            text: I18n.tr("Contrast")
                            minimum: 0
                            maximum: 200
                            value: Math.round(SettingsData.launcherLogoContrast * 100)
                            unit: "%"
                            defaultValue: 100
                            onSliderValueChanged: newValue => SettingsData.set("launcherLogoContrast", newValue / 100)
                        }

                        SettingsToggleRow {
                            settingKey: "launcherLogoColorInvertOnMode"
                            tags: ["launcher", "logo", "invert", "mode", "color"]
                            text: I18n.tr("Invert on mode change")
                            checked: SettingsData.launcherLogoColorInvertOnMode
                            onToggled: checked => SettingsData.set("launcherLogoColorInvertOnMode", checked)
                        }
                    }
                }
            }

            SettingsCard {
                width: parent.width
                iconName: "terminal"
                title: I18n.tr("Launch Prefix")
                settingKey: "launchPrefix"

                StyledText {
                    width: parent.width
                    text: I18n.tr("Add a custom prefix to all application launches. This can be used for things like 'uwsm-app', 'systemd-run', or other command wrappers.")
                    font.pixelSize: Theme.fontSizeSmall
                    color: Theme.surfaceVariantText
                    wrapMode: Text.WordWrap
                }

                DankTextField {
                    width: parent.width
                    text: SettingsData.launchPrefix
                    placeholderText: I18n.tr("Enter launch prefix (e.g., 'uwsm-app')")
                    onTextEdited: SettingsData.set("launchPrefix", text)
                }
            }

            SettingsCard {
                width: parent.width
                iconName: "sort_by_alpha"
                title: I18n.tr("Sorting & Layout")
                settingKey: "launcherSorting"

                SettingsToggleRow {
                    settingKey: "sortAppsAlphabetically"
                    tags: ["launcher", "sort", "alphabetically", "apps", "order"]
                    text: I18n.tr("Sort Alphabetically")
                    description: I18n.tr("When enabled, apps are sorted alphabetically. When disabled, apps are sorted by usage frequency.")
                    checked: SettingsData.sortAppsAlphabetically
                    onToggled: checked => SettingsData.set("sortAppsAlphabetically", checked)
                }

                SettingsSliderRow {
                    settingKey: "appLauncherGridColumns"
                    tags: ["launcher", "grid", "columns", "layout"]
                    text: I18n.tr("Grid Columns")
                    description: I18n.tr("Adjust the number of columns in grid view mode.")
                    minimum: 2
                    maximum: 8
                    value: SettingsData.appLauncherGridColumns
                    defaultValue: 5
                    onSliderValueChanged: newValue => SettingsData.set("appLauncherGridColumns", newValue)
                }
            }

            SettingsCard {
                width: parent.width
                iconName: "tune"
                title: I18n.tr("Appearance", "launcher appearance settings")
                settingKey: "dankLauncherV2Appearance"

                Column {
                    width: parent.width
                    spacing: Theme.spacingM

                    StyledText {
                        text: I18n.tr("Size", "launcher size option")
                        font.pixelSize: Theme.fontSizeSmall
                        color: Theme.surfaceText
                        font.weight: Font.Medium
                        anchors.horizontalCenter: parent.horizontalCenter
                    }

                    Item {
                        width: parent.width
                        height: sizeGroup.implicitHeight
                        clip: true

                        DankButtonGroup {
                            id: sizeGroup
                            anchors.horizontalCenter: parent.horizontalCenter
                            buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
                            minButtonWidth: parent.width < 400 ? 60 : 80
                            textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
                            model: ["1", "2", "3", "4"]
                            currentIndex: {
                                switch (SettingsData.dankLauncherV2Size) {
                                case "micro":
                                    return 0;
                                case "compact":
                                    return 1;
                                case "large":
                                    return 3;
                                default:
                                    return 2;
                                }
                            }
                            onSelectionChanged: (index, selected) => {
                                if (!selected)
                                    return;
                                var sizes = ["micro", "compact", "medium", "large"];
                                SettingsData.set("dankLauncherV2Size", sizes[index]);
                            }
                        }
                    }
                }

                SettingsToggleRow {
                    settingKey: "dankLauncherV2ShowFooter"
                    tags: ["launcher", "footer", "hints", "shortcuts"]
                    text: I18n.tr("Show Footer", "launcher footer visibility")
                    description: I18n.tr("Show mode tabs and keyboard hints at the bottom.", "launcher footer description")
                    checked: SettingsData.dankLauncherV2ShowFooter
                    enabled: SettingsData.dankLauncherV2Size !== "micro"
                    onToggled: checked => SettingsData.set("dankLauncherV2ShowFooter", checked)
                }

                SettingsToggleRow {
                    settingKey: "dankLauncherV2UnloadOnClose"
                    tags: ["launcher", "unload", "close", "memory", "vram"]
                    text: I18n.tr("Unload on Close")
                    description: I18n.tr("Free VRAM/memory when the launcher is closed. May cause a slight delay when reopening.")
                    checked: SettingsData.dankLauncherV2UnloadOnClose
                    onToggled: checked => SettingsData.set("dankLauncherV2UnloadOnClose", checked)
                }

                SettingsToggleRow {
                    settingKey: "dankLauncherV2BorderEnabled"
                    tags: ["launcher", "border", "outline"]
                    text: I18n.tr("Border", "launcher border option")
                    checked: SettingsData.dankLauncherV2BorderEnabled
                    onToggled: checked => SettingsData.set("dankLauncherV2BorderEnabled", checked)
                }

                Column {
                    width: parent.width
                    spacing: Theme.spacingM
                    visible: SettingsData.dankLauncherV2BorderEnabled

                    SettingsSliderRow {
                        settingKey: "dankLauncherV2BorderThickness"
                        tags: ["launcher", "border", "thickness"]
                        text: I18n.tr("Thickness", "border thickness")
                        minimum: 1
                        maximum: 6
                        value: SettingsData.dankLauncherV2BorderThickness
                        defaultValue: 2
                        unit: "px"
                        onSliderValueChanged: newValue => SettingsData.set("dankLauncherV2BorderThickness", newValue)
                    }

                    Column {
                        width: parent.width
                        spacing: Theme.spacingS

                        StyledText {
                            text: I18n.tr("Color", "border color")
                            font.pixelSize: Theme.fontSizeSmall
                            color: Theme.surfaceText
                            font.weight: Font.Medium
                            anchors.horizontalCenter: parent.horizontalCenter
                        }

                        Item {
                            width: parent.width
                            height: borderColorGroup.implicitHeight
                            clip: true

                            DankButtonGroup {
                                id: borderColorGroup
                                anchors.horizontalCenter: parent.horizontalCenter
                                buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
                                minButtonWidth: parent.width < 400 ? 50 : 70
                                textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
                                model: [I18n.tr("Primary", "primary color"), I18n.tr("Secondary", "secondary color"), I18n.tr("Outline", "outline color"), I18n.tr("Text", "text color")]
                                currentIndex: SettingsData.dankLauncherV2BorderColor === "secondary" ? 1 : SettingsData.dankLauncherV2BorderColor === "outline" ? 2 : SettingsData.dankLauncherV2BorderColor === "surfaceText" ? 3 : 0
                                onSelectionChanged: (index, selected) => {
                                    if (!selected)
                                        return;
                                    SettingsData.set("dankLauncherV2BorderColor", index === 1 ? "secondary" : index === 2 ? "outline" : index === 3 ? "surfaceText" : "primary");
                                }
                            }
                        }
                    }
                }
            }

            SettingsCard {
                width: parent.width
                iconName: "open_in_new"
                title: I18n.tr("Niri Integration").replace("Niri", "niri")
                visible: CompositorService.isNiri

                SettingsToggleRow {
                    settingKey: "spotlightCloseNiriOverview"
                    tags: ["launcher", "niri", "overview", "close", "launch"]
                    text: I18n.tr("Close Overview on Launch")
                    description: I18n.tr("Auto-close Niri overview when launching apps.")
                    checked: SettingsData.spotlightCloseNiriOverview
                    onToggled: checked => SettingsData.set("spotlightCloseNiriOverview", checked)
                }

                SettingsToggleRow {
                    settingKey: "niriOverviewOverlayEnabled"
                    tags: ["launcher", "niri", "overview", "overlay", "enable"]
                    text: I18n.tr("Enable Overview Overlay")
                    description: I18n.tr("Show launcher overlay when typing in Niri overview. Disable to use another launcher.")
                    checked: SettingsData.niriOverviewOverlayEnabled
                    onToggled: checked => SettingsData.set("niriOverviewOverlayEnabled", checked)
                }
            }

            SettingsCard {
                id: builtInPluginsCard
                width: parent.width
                iconName: "extension"
                title: "DMS"
                settingKey: "builtInPlugins"

                Column {
                    width: parent.width
                    spacing: Theme.spacingS

                    Repeater {
                        model: ["dms_settings", "dms_notepad", "dms_sysmon", "dms_settings_search"]

                        delegate: Rectangle {
                            id: pluginDelegate
                            required property string modelData
                            required property int index
                            readonly property var plugin: AppSearchService.builtInPlugins[modelData]

                            width: parent.width
                            height: 56
                            radius: Theme.cornerRadius
                            color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)

                            Row {
                                anchors.left: parent.left
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                spacing: Theme.spacingM

                                DankIcon {
                                    name: pluginDelegate.plugin?.cornerIcon ?? "extension"
                                    size: Theme.iconSize
                                    color: Theme.primary
                                    anchors.verticalCenter: parent.verticalCenter
                                }

                                Column {
                                    anchors.verticalCenter: parent.verticalCenter
                                    spacing: 2

                                    StyledText {
                                        text: pluginDelegate.plugin?.name ?? pluginDelegate.modelData
                                        font.pixelSize: Theme.fontSizeMedium
                                        color: Theme.surfaceText
                                    }

                                    StyledText {
                                        text: pluginDelegate.plugin?.comment ?? ""
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Theme.surfaceVariantText
                                    }
                                }
                            }

                            Row {
                                anchors.right: parent.right
                                anchors.rightMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                spacing: Theme.spacingM

                                DankTextField {
                                    id: triggerField
                                    width: 60
                                    visible: pluginDelegate.plugin?.isLauncher === true
                                    anchors.verticalCenter: parent.verticalCenter
                                    placeholderText: I18n.tr("Trigger")
                                    onTextEdited: SettingsData.setBuiltInPluginSetting(pluginDelegate.modelData, "trigger", text)
                                    Component.onCompleted: text = SettingsData.getBuiltInPluginSetting(pluginDelegate.modelData, "trigger", pluginDelegate.plugin?.defaultTrigger ?? "")
                                }

                                DankToggle {
                                    id: enableToggle
                                    anchors.verticalCenter: parent.verticalCenter
                                    checked: SettingsData.getBuiltInPluginSetting(pluginDelegate.modelData, "enabled", true)
                                    onToggled: SettingsData.setBuiltInPluginSetting(pluginDelegate.modelData, "enabled", checked)
                                }
                            }
                        }
                    }
                }
            }

            SettingsCard {
                id: pluginVisibilityCard
                width: parent.width
                iconName: "filter_list"
                title: I18n.tr("Plugin Visibility")
                settingKey: "pluginVisibility"

                property var allLauncherPlugins: {
                    SettingsData.launcherPluginVisibility;
                    SettingsData.launcherPluginOrder;
                    SettingsData.dankLauncherV2IncludeFilesInAll;
                    SettingsData.dankLauncherV2IncludeFoldersInAll;
                    var plugins = [];
                    var builtIn = AppSearchService.getBuiltInLauncherPlugins() || {};
                    for (var pluginId in builtIn) {
                        var plugin = builtIn[pluginId];
                        plugins.push({
                            id: pluginId,
                            name: plugin.name || pluginId,
                            icon: plugin.cornerIcon || "extension",
                            iconType: "material",
                            isBuiltIn: true,
                            isVirtual: false,
                            trigger: AppSearchService.getBuiltInPluginTrigger(pluginId) || ""
                        });
                    }
                    var thirdParty = PluginService.getLauncherPlugins() || {};
                    for (var pluginId in thirdParty) {
                        var plugin = thirdParty[pluginId];
                        var rawIcon = plugin.icon || "extension";
                        plugins.push({
                            id: pluginId,
                            name: plugin.name || pluginId,
                            icon: rawIcon.startsWith("material:") ? rawIcon.substring(9) : rawIcon.startsWith("unicode:") ? rawIcon.substring(8) : rawIcon,
                            iconType: rawIcon.startsWith("unicode:") ? "unicode" : "material",
                            isBuiltIn: false,
                            isVirtual: false,
                            trigger: PluginService.getPluginTrigger(pluginId) || ""
                        });
                    }
                    if (SettingsData.dankLauncherV2IncludeFilesInAll) {
                        plugins.push({
                            id: "__files",
                            name: I18n.tr("Files"),
                            icon: "insert_drive_file",
                            iconType: "material",
                            isBuiltIn: false,
                            isVirtual: true,
                            trigger: "/"
                        });
                    }
                    if (SettingsData.dankLauncherV2IncludeFoldersInAll) {
                        plugins.push({
                            id: "__folders",
                            name: I18n.tr("Folders"),
                            icon: "folder",
                            iconType: "material",
                            isBuiltIn: false,
                            isVirtual: true,
                            trigger: "/"
                        });
                    }
                    return SettingsData.getOrderedLauncherPlugins(plugins);
                }

                function reorderPlugin(fromIndex, toIndex) {
                    if (fromIndex === toIndex)
                        return;
                    var currentOrder = allLauncherPlugins.map(p => p.id);
                    var item = currentOrder.splice(fromIndex, 1)[0];
                    currentOrder.splice(toIndex, 0, item);
                    SettingsData.setLauncherPluginOrder(currentOrder);
                }

                StyledText {
                    width: parent.width
                    text: I18n.tr("Control which plugins appear in 'All' mode without requiring a trigger prefix. Drag to reorder.")
                    font.pixelSize: Theme.fontSizeSmall
                    color: Theme.surfaceVariantText
                    wrapMode: Text.WordWrap
                }

                Column {
                    id: pluginVisibilityColumn
                    width: parent.width
                    spacing: Theme.spacingS

                    Repeater {
                        model: pluginVisibilityCard.allLauncherPlugins

                        delegate: Item {
                            id: visibilityDelegateItem
                            required property var modelData
                            required property int index

                            property bool held: pluginDragArea.pressed
                            property real originalY: y

                            width: pluginVisibilityColumn.width
                            height: 52
                            z: held ? 2 : 1

                            Rectangle {
                                id: visibilityDelegate
                                width: parent.width
                                height: 52
                                radius: Theme.cornerRadius
                                color: visibilityDelegateItem.held ? Theme.surfaceHover : Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)

                                Row {
                                    anchors.left: parent.left
                                    anchors.leftMargin: 28
                                    anchors.verticalCenter: parent.verticalCenter
                                    spacing: Theme.spacingM

                                    Item {
                                        width: Theme.iconSize
                                        height: Theme.iconSize
                                        anchors.verticalCenter: parent.verticalCenter

                                        DankIcon {
                                            anchors.centerIn: parent
                                            visible: visibilityDelegateItem.modelData.iconType !== "unicode"
                                            name: visibilityDelegateItem.modelData.icon
                                            size: Theme.iconSize
                                            color: Theme.primary
                                        }

                                        StyledText {
                                            anchors.centerIn: parent
                                            visible: visibilityDelegateItem.modelData.iconType === "unicode"
                                            text: visibilityDelegateItem.modelData.icon
                                            font.pixelSize: Theme.iconSize
                                            color: Theme.primary
                                        }
                                    }

                                    Column {
                                        anchors.verticalCenter: parent.verticalCenter
                                        spacing: 2

                                        Row {
                                            spacing: Theme.spacingS

                                            StyledText {
                                                text: visibilityDelegateItem.modelData.name
                                                font.pixelSize: Theme.fontSizeMedium
                                                color: Theme.surfaceText
                                            }

                                            Rectangle {
                                                visible: visibilityDelegateItem.modelData.isBuiltIn
                                                width: dmsBadgeLabel.implicitWidth + Theme.spacingS
                                                height: 16
                                                radius: 8
                                                color: Theme.primaryContainer
                                                anchors.verticalCenter: parent.verticalCenter

                                                StyledText {
                                                    id: dmsBadgeLabel
                                                    anchors.centerIn: parent
                                                    text: "DMS"
                                                    font.pixelSize: Theme.fontSizeSmall - 2
                                                    color: Theme.primary
                                                }
                                            }
                                        }

                                        StyledText {
                                            text: visibilityDelegateItem.modelData.trigger ? I18n.tr("Trigger: %1").arg(visibilityDelegateItem.modelData.trigger) : I18n.tr("No trigger")
                                            font.pixelSize: Theme.fontSizeSmall
                                            color: Theme.surfaceVariantText
                                        }
                                    }
                                }

                                DankToggle {
                                    anchors.right: parent.right
                                    anchors.rightMargin: Theme.spacingM
                                    anchors.verticalCenter: parent.verticalCenter
                                    checked: {
                                        switch (visibilityDelegateItem.modelData.id) {
                                        case "__files":
                                            return SettingsData.dankLauncherV2IncludeFilesInAll;
                                        case "__folders":
                                            return SettingsData.dankLauncherV2IncludeFoldersInAll;
                                        default:
                                            return SettingsData.getPluginAllowWithoutTrigger(visibilityDelegateItem.modelData.id);
                                        }
                                    }
                                    onToggled: function (isChecked) {
                                        switch (visibilityDelegateItem.modelData.id) {
                                        case "__files":
                                            SettingsData.set("dankLauncherV2IncludeFilesInAll", isChecked);
                                            break;
                                        case "__folders":
                                            SettingsData.set("dankLauncherV2IncludeFoldersInAll", isChecked);
                                            break;
                                        default:
                                            SettingsData.setPluginAllowWithoutTrigger(visibilityDelegateItem.modelData.id, isChecked);
                                        }
                                    }
                                }
                            }

                            MouseArea {
                                id: pluginDragArea
                                anchors.left: parent.left
                                anchors.top: parent.top
                                width: 28
                                height: parent.height
                                hoverEnabled: true
                                cursorShape: Qt.SizeVerCursor
                                drag.target: visibilityDelegateItem.held ? visibilityDelegateItem : undefined
                                drag.axis: Drag.YAxis
                                preventStealing: true

                                onPressed: {
                                    visibilityDelegateItem.originalY = visibilityDelegateItem.y;
                                }

                                onReleased: {
                                    if (!drag.active) {
                                        visibilityDelegateItem.y = visibilityDelegateItem.originalY;
                                        return;
                                    }
                                    const spacing = Theme.spacingS;
                                    const itemH = visibilityDelegateItem.height + spacing;
                                    var newIndex = Math.round(visibilityDelegateItem.y / itemH);
                                    newIndex = Math.max(0, Math.min(newIndex, pluginVisibilityCard.allLauncherPlugins.length - 1));
                                    pluginVisibilityCard.reorderPlugin(visibilityDelegateItem.index, newIndex);
                                    visibilityDelegateItem.y = visibilityDelegateItem.originalY;
                                }
                            }

                            DankIcon {
                                x: Theme.spacingXS
                                anchors.verticalCenter: parent.verticalCenter
                                name: "drag_indicator"
                                size: 18
                                color: Theme.outline
                                opacity: pluginDragArea.containsMouse || pluginDragArea.pressed ? 1 : 0.5
                            }

                            Behavior on y {
                                enabled: !pluginDragArea.pressed && !pluginDragArea.drag.active
                                NumberAnimation {
                                    duration: Theme.shortDuration
                                    easing.type: Theme.standardEasing
                                }
                            }
                        }
                    }

                    StyledText {
                        width: parent.width
                        text: I18n.tr("No launcher plugins installed.")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.surfaceVariantText
                        horizontalAlignment: Text.AlignHCenter
                        visible: pluginVisibilityCard.allLauncherPlugins.length === 0
                    }
                }
            }

            SettingsCard {
                width: parent.width
                iconName: "search"
                title: I18n.tr("Search Options")
                settingKey: "searchOptions"

                SettingsToggleRow {
                    settingKey: "searchAppActions"
                    tags: ["launcher", "search", "actions", "shortcuts"]
                    text: I18n.tr("Search App Actions")
                    description: I18n.tr("Include desktop actions (shortcuts) in search results.")
                    checked: SessionData.searchAppActions
                    onToggled: checked => SessionData.setSearchAppActions(checked)
                }

                SettingsToggleRow {
                    settingKey: "rememberLastQuery"
                    tags: ["launcher", "remember", "last", "search", "query"]
                    text: I18n.tr("Remember Last Query")
                    description: I18n.tr("Autofill last remembered query when opened")
                    checked: SettingsData.rememberLastQuery
                    onToggled: checked => SettingsData.set("rememberLastQuery", checked)
                }

                SettingsToggleRow {
                    settingKey: "dankLauncherV2IncludeFilesInAll"
                    tags: ["launcher", "files", "dsearch", "all", "results", "indexed"]
                    text: I18n.tr("Include Files in All Tab")
                    description: I18n.tr("Merge indexed file results into the All tab (requires dsearch).")
                    checked: SettingsData.dankLauncherV2IncludeFilesInAll
                    onToggled: checked => SettingsData.set("dankLauncherV2IncludeFilesInAll", checked)
                }

                SettingsToggleRow {
                    settingKey: "dankLauncherV2IncludeFoldersInAll"
                    tags: ["launcher", "folders", "dirs", "dsearch", "all", "results", "indexed"]
                    text: I18n.tr("Include Folders in All Tab")
                    description: I18n.tr("Merge indexed folder results into the All tab (requires dsearch).")
                    checked: SettingsData.dankLauncherV2IncludeFoldersInAll
                    onToggled: checked => SettingsData.set("dankLauncherV2IncludeFoldersInAll", checked)
                }
            }

            SettingsCard {
                id: hiddenAppsCard
                width: parent.width
                iconName: "visibility_off"
                title: I18n.tr("Hidden Apps")
                settingKey: "hiddenApps"

                property var hiddenAppsModel: {
                    SessionData.hiddenApps;
                    const apps = [];
                    const allApps = AppSearchService.applications || [];
                    for (const hiddenId of SessionData.hiddenApps) {
                        const app = allApps.find(a => (a.id || a.execString || a.exec) === hiddenId);
                        if (app) {
                            apps.push({
                                id: hiddenId,
                                name: app.name || hiddenId,
                                icon: app.icon || "",
                                comment: app.comment || ""
                            });
                        } else {
                            apps.push({
                                id: hiddenId,
                                name: hiddenId,
                                icon: "",
                                comment: ""
                            });
                        }
                    }
                    return apps.sort((a, b) => a.name.localeCompare(b.name));
                }

                StyledText {
                    width: parent.width
                    text: I18n.tr("Hidden apps won't appear in the launcher. Right-click an app and select 'Hide App' to hide it.")
                    font.pixelSize: Theme.fontSizeSmall
                    color: Theme.surfaceVariantText
                    wrapMode: Text.WordWrap
                }

                Column {
                    id: hiddenAppsList
                    width: parent.width
                    spacing: Theme.spacingS

                    Repeater {
                        model: hiddenAppsCard.hiddenAppsModel

                        delegate: Rectangle {
                            width: hiddenAppsList.width
                            height: 48
                            radius: Theme.cornerRadius
                            color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
                            border.width: 0

                            Row {
                                anchors.left: parent.left
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                spacing: Theme.spacingM

                                Image {
                                    width: 24
                                    height: 24
                                    source: Paths.resolveIconUrl(modelData.icon || "application-x-executable")
                                    sourceSize.width: 24
                                    sourceSize.height: 24
                                    fillMode: Image.PreserveAspectFit
                                    anchors.verticalCenter: parent.verticalCenter
                                    onStatusChanged: {
                                        if (status === Image.Error)
                                            source = "image://icon/application-x-executable";
                                    }
                                }

                                Column {
                                    anchors.verticalCenter: parent.verticalCenter
                                    spacing: 2

                                    StyledText {
                                        text: modelData.name
                                        font.pixelSize: Theme.fontSizeMedium
                                        font.weight: Font.Medium
                                        color: Theme.surfaceText
                                    }

                                    StyledText {
                                        text: modelData.comment || modelData.id
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Theme.surfaceVariantText
                                        visible: text.length > 0
                                    }
                                }
                            }

                            DankActionButton {
                                anchors.right: parent.right
                                anchors.rightMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                iconName: "visibility"
                                iconSize: 18
                                iconColor: Theme.primary
                                onClicked: SessionData.showApp(modelData.id)
                            }
                        }
                    }

                    StyledText {
                        width: parent.width
                        text: I18n.tr("No hidden apps.")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.surfaceVariantText
                        horizontalAlignment: Text.AlignHCenter
                        visible: hiddenAppsCard.hiddenAppsModel.length === 0
                    }
                }
            }

            SettingsCard {
                id: appOverridesCard
                width: parent.width
                iconName: "edit"
                title: I18n.tr("App Customizations")
                settingKey: "appOverrides"

                property var overridesModel: {
                    SessionData.appOverrides;
                    const items = [];
                    const allApps = AppSearchService.applications || [];
                    for (const appId in SessionData.appOverrides) {
                        const override = SessionData.appOverrides[appId];
                        const app = allApps.find(a => (a.id || a.execString || a.exec) === appId);
                        items.push({
                            id: appId,
                            name: override.name || app?.name || appId,
                            originalName: app?.name || appId,
                            icon: override.icon || app?.icon || "",
                            hasOverride: true
                        });
                    }
                    return items.sort((a, b) => a.name.localeCompare(b.name));
                }

                StyledText {
                    width: parent.width
                    text: I18n.tr("Apps with custom display name, icon, or launch options. Right-click an app and select 'Edit App' to customize.")
                    font.pixelSize: Theme.fontSizeSmall
                    color: Theme.surfaceVariantText
                    wrapMode: Text.WordWrap
                }

                Column {
                    id: overridesList
                    width: parent.width
                    spacing: Theme.spacingS

                    Repeater {
                        model: appOverridesCard.overridesModel

                        delegate: Rectangle {
                            width: overridesList.width
                            height: 48
                            radius: Theme.cornerRadius
                            color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
                            border.width: 0

                            Row {
                                anchors.left: parent.left
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                spacing: Theme.spacingM

                                Image {
                                    width: 24
                                    height: 24
                                    source: Paths.resolveIconUrl(modelData.icon || "application-x-executable")
                                    sourceSize.width: 24
                                    sourceSize.height: 24
                                    fillMode: Image.PreserveAspectFit
                                    anchors.verticalCenter: parent.verticalCenter
                                    onStatusChanged: {
                                        if (status === Image.Error)
                                            source = "image://icon/application-x-executable";
                                    }
                                }

                                Column {
                                    anchors.verticalCenter: parent.verticalCenter
                                    spacing: 2

                                    StyledText {
                                        text: modelData.name
                                        font.pixelSize: Theme.fontSizeMedium
                                        font.weight: Font.Medium
                                        color: Theme.surfaceText
                                    }

                                    StyledText {
                                        text: modelData.originalName !== modelData.name ? modelData.originalName : modelData.id
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Theme.surfaceVariantText
                                    }
                                }
                            }

                            DankActionButton {
                                anchors.right: parent.right
                                anchors.rightMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                iconName: "delete"
                                iconSize: 18
                                iconColor: Theme.error
                                onClicked: SessionData.clearAppOverride(modelData.id)
                            }
                        }
                    }

                    StyledText {
                        width: parent.width
                        text: I18n.tr("No app customizations.")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.surfaceVariantText
                        horizontalAlignment: Text.AlignHCenter
                        visible: appOverridesCard.overridesModel.length === 0
                    }
                }
            }

            SettingsCard {
                id: recentAppsCard
                width: parent.width
                iconName: "history"
                title: I18n.tr("Recently Used Apps")
                settingKey: "recentApps"
                collapsible: true
                expanded: false

                property var rankedAppsModel: {
                    var ranking = AppUsageHistoryData.appUsageRanking;
                    if (!ranking)
                        return [];
                    var apps = [];
                    for (var appId in ranking) {
                        var appData = ranking[appId];
                        apps.push({
                            "id": appId,
                            "name": appData.name,
                            "exec": appData.exec,
                            "icon": appData.icon,
                            "comment": appData.comment,
                            "usageCount": appData.usageCount,
                            "lastUsed": appData.lastUsed
                        });
                    }
                    apps.sort(function (a, b) {
                        if (a.usageCount !== b.usageCount)
                            return b.usageCount - a.usageCount;
                        return a.name.localeCompare(b.name);
                    });
                    return apps.slice(0, 20);
                }

                Row {
                    width: parent.width
                    spacing: Theme.spacingM

                    StyledText {
                        width: parent.width - clearAllButton.width - Theme.spacingM
                        text: I18n.tr("Apps are ordered by usage frequency, then last used, then alphabetically.")
                        font.pixelSize: Theme.fontSizeSmall
                        color: Theme.surfaceVariantText
                        wrapMode: Text.WordWrap
                        anchors.verticalCenter: parent.verticalCenter
                    }

                    DankActionButton {
                        id: clearAllButton
                        iconName: "delete_sweep"
                        iconSize: Theme.iconSize - 2
                        iconColor: Theme.error
                        anchors.verticalCenter: parent.verticalCenter
                        onClicked: {
                            AppUsageHistoryData.appUsageRanking = {};
                            AppUsageHistoryData.saveSettings();
                        }
                    }
                }

                Column {
                    id: rankedAppsList
                    width: parent.width
                    spacing: Theme.spacingS

                    Repeater {
                        model: recentAppsCard.rankedAppsModel

                        delegate: Rectangle {
                            width: rankedAppsList.width
                            height: 48
                            radius: Theme.cornerRadius
                            color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3)
                            border.width: 0

                            Row {
                                anchors.left: parent.left
                                anchors.leftMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                spacing: Theme.spacingM

                                StyledText {
                                    text: (index + 1).toString()
                                    font.pixelSize: Theme.fontSizeSmall
                                    font.weight: Font.Medium
                                    color: Theme.primary
                                    width: 20
                                    anchors.verticalCenter: parent.verticalCenter
                                }

                                Image {
                                    width: 24
                                    height: 24
                                    source: Paths.resolveIconUrl(modelData.icon || "application-x-executable")
                                    sourceSize.width: 24
                                    sourceSize.height: 24
                                    fillMode: Image.PreserveAspectFit
                                    anchors.verticalCenter: parent.verticalCenter
                                    onStatusChanged: {
                                        if (status === Image.Error)
                                            source = "image://icon/application-x-executable";
                                    }
                                }

                                Column {
                                    anchors.verticalCenter: parent.verticalCenter
                                    spacing: 2

                                    StyledText {
                                        text: modelData.name || I18n.tr("Unknown App")
                                        font.pixelSize: Theme.fontSizeMedium
                                        font.weight: Font.Medium
                                        color: Theme.surfaceText
                                    }

                                    StyledText {
                                        text: {
                                            if (!modelData.lastUsed)
                                                return I18n.tr("Never used");
                                            var date = new Date(modelData.lastUsed);
                                            var now = new Date();
                                            var diffMs = now - date;
                                            var diffMins = Math.floor(diffMs / (1000 * 60));
                                            var diffHours = Math.floor(diffMs / (1000 * 60 * 60));
                                            var diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
                                            if (diffMins < 1)
                                                return I18n.tr("Last launched just now");
                                            if (diffMins < 60)
                                                return diffMins === 1 ? I18n.tr("Last launched %1 minute ago").arg(diffMins) : I18n.tr("Last launched %1 minutes ago").arg(diffMins);
                                            if (diffHours < 24)
                                                return diffHours === 1 ? I18n.tr("Last launched %1 hour ago").arg(diffHours) : I18n.tr("Last launched %1 hours ago").arg(diffHours);
                                            if (diffDays < 7)
                                                return diffDays === 1 ? I18n.tr("Last launched %1 day ago").arg(diffDays) : I18n.tr("Last launched %1 days ago").arg(diffDays);
                                            return I18n.tr("Last launched %1").arg(date.toLocaleDateString());
                                        }
                                        font.pixelSize: Theme.fontSizeSmall
                                        color: Theme.surfaceVariantText
                                    }
                                }
                            }

                            DankActionButton {
                                anchors.right: parent.right
                                anchors.rightMargin: Theme.spacingM
                                anchors.verticalCenter: parent.verticalCenter
                                circular: true
                                iconName: "close"
                                iconSize: 16
                                iconColor: Theme.error
                                onClicked: {
                                    var currentRanking = Object.assign({}, AppUsageHistoryData.appUsageRanking || {});
                                    delete currentRanking[modelData.id];
                                    AppUsageHistoryData.appUsageRanking = currentRanking;
                                    AppUsageHistoryData.saveSettings();
                                }
                            }
                        }
                    }

                    StyledText {
                        width: parent.width
                        text: I18n.tr("No apps have been launched yet.")
                        font.pixelSize: Theme.fontSizeMedium
                        color: Theme.surfaceVariantText
                        horizontalAlignment: Text.AlignHCenter
                        visible: recentAppsCard.rankedAppsModel.length === 0
                    }
                }
            }
        }
    }
}