swadhinbiswas fix(plugin-manager): close on Esc/outside-click and harden marketplace RCE - shell/plugins/plugin-manager/Panel.qml:6,139,149,155,358,368,384,404,409,426,439,457,508 — PanelWindow had WlrKeyboardFocus: Exclusive always, no PanelKeyCatcher/Keys.onEscape and no outside-click MouseArea → once opened via keymap.lua:159 SUPER+SHIFT+I (shell/shell.qml:465 summon) only bar-icon BarWidget.qml:67 could close; add Quickshell.Wayland import, keyboardFocus: opened?Exclusive:None, onVisibleChanged/onOpenedChanged Qt.callLater(keyCatcher.forceActiveFocus()), scrim Qt.rgba(0,0,0,0.45), dismiss MouseArea (modal-aware) + Item#keyCatcher { focus:true; Keys.priority:BeforeItem; Esc->closeModal/close } + card swallow MouseArea, mirrors clipboard/Clipboard.qml:329; fix loadInstalled/loadMarketplace and all actionProc.command single-quote injections (enable/disable, bar remove/add, shortcut set/remove, install, install url, remove) → Util.shellQuote - plugin-library/shell.qml:104,115,121,429,439,455,475,480,495,508,526 — same injection via "'"+p.id+"'" without quoting (marketplace id/url/keys controlled by remote catalog) → add local shellQuote(v) (Util.shellQuote not importable in standalone ShellRoot) and use for all actionProc.command + loadInstalled/loadMarketplace (home/om paths); add Window#win Item { focus:true; Keys.onPressed: Esc { closeModal · 8/27/2026
4aa0eee
1919 lines · 70.0 KB
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
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io

ShellRoot {
  id: root

  // ---------------------------------------------------------------- Visual Design System (Tokyo Night / Catppuccin inspired)
  readonly property color bgBase: "#11121d"
  readonly property color bgSurface: "#161726"
  readonly property color bgCard: "#1d1f33"
  readonly property color bgCardHover: "#252842"
  readonly property color bgElevated: "#2a2e4a"
  readonly property color borderSubtle: "#282b45"
  readonly property color borderActive: "#3d426b"

  readonly property color fgMain: "#cdd6f4"
  readonly property color fgMuted: "#a6adc8"
  readonly property color fgDim: "#585b70"

  readonly property color accent: "#89b4fa"
  readonly property color accentGlow: Qt.rgba(137/255, 180/255, 250/255, 0.15)

  readonly property color greenSuccess: "#a6e3a1"
  readonly property color greenGlow: Qt.rgba(166/255, 227/255, 161/255, 0.15)

  readonly property color redDanger: "#f38ba8"
  readonly property color redGlow: Qt.rgba(243/255, 139/255, 168/255, 0.15)

  readonly property color amberWarn: "#fab387"
  readonly property color amberGlow: Qt.rgba(250/255, 179/255, 135/255, 0.15)

  readonly property color purpleTag: "#cba6f7"
  readonly property color purpleGlow: Qt.rgba(203/255, 166/255, 247/255, 0.15)

  // ---------------------------------------------------------------- Iconography
  //
  // Vector glyphs from JetBrainsMono Nerd Font — the family the bar, panels,
  // and terminal already render with — so icons stay monochrome, crisp at
  // every size, and tintable instead of colored emoji. Most Nerd Font
  // codepoints live beyond the BMP, so they are stored as ints and resolved
  // with String.fromCodePoint rather than \u escapes.
  readonly property string nfFontFamily: "JetBrainsMono Nerd Font"
  function nf(code) { return String.fromCodePoint(code) }

  // Chrome icons used by this window's own controls.
  readonly property var ic: ({
    puzzle: 0xF0327,        // md-puzzle            plugin manager brand
    package: 0xF03D3,       // md-package           installed tab
    globe: 0xF00AC,         // fa-globe             marketplace tab / web search
    plus: 0xF0415,          // md-plus              add / pin actions
    update: 0xF06B0,        // md-update            update-all button
    bolt: 0xF140B,          // md-lightning_bolt    restart shell
    magnify: 0xF0349,       // md-magnify           search fields
    close: 0xF0156,         // md-close             clear buttons
    check: 0xF012C,         // md-check             success states
    closeCircle: 0xF0159,   // md-close_circle      failure states
    checkCircle: 0xF05E0,   // md-check_circle      success toasts
    pin: 0xF0403,           // md-pin               bar placement
    keyboard: 0xF097B,      // md-keyboard_outline  shortcut keycap
    trash: 0xF1F8,          // fa-trash             remove user plugin
    star: 0xF04CE,          // md-star              marketplace stars
    externalLink: 0xF005C,  // md-arrow_top_right   repo link
    arrowLeft: 0xF004D,     // md-arrow_left        section picker
    arrowRight: 0xF0054     // md-arrow_right       section picker
  })

  // ---------------------------------------------------------------- State
  property string currentTab: "installed" // "installed" | "marketplace"
  property var installedPlugins: []
  property var marketplacePlugins: []
  property var filteredInstalled: []
  property var filteredMarketplace: []
  property var shortcutsMap: ({})
  property var barLayoutData: ({ inBar: [] })

  property string installedSearch: ""
  property string installedFilter: "all" // "all" | "active" | "inactive" | "bar" | "builtin" | "user"

  property string marketSearch: ""
  property string marketCategory: "All"
  property string marketSort: "stars" // "stars" | "name" | "date"

  property string installingId: ""
  property string statusMessage: ""
  property string statusType: "info" // "info" | "success" | "error"
  property bool updatingAll: false

  // Modals
  property bool urlDialogOpen: false
  property string urlInput: ""

  property bool confirmUninstallOpen: false
  property var pendingUninstallPlugin: null

  property bool restartDialogOpen: false

  property bool shortcutDialogOpen: false
  property var shortcutTargetPlugin: null
  property string shortcutInput: ""

  property bool barSectionDialogOpen: false
  property var barTargetPlugin: null

  function shellQuote(v) { return "'" + String(v || "").replace(/'/g, "'\\''") + "'" }

  Component.onCompleted: {
    loadInstalled()
    loadMarketplace()
    loadShortcuts()
    loadBarLayout()
  }

  // ---------------------------------------------------------------- Data Loaders
  function loadInstalled() {
    var om = Quickshell.env("OMARCHY_PATH") || "/usr/share/de-omarchy"
    installedProc.command = ["bash", "-c", "omarchy-shell shell listPlugins 2>/dev/null || " + shellQuote(om + "/bin/omarchy-plugins") + " list --json 2>/dev/null || omarchy plugins list --json 2>/dev/null || echo '[]'"]
    installedProc.running = true
  }

  function loadMarketplace() {
    var home = Quickshell.env("HOME")
    var om = Quickshell.env("OMARCHY_PATH") || "/usr/share/de-omarchy"
    marketProc.command = ["bash", "-c", "cat " + shellQuote(home + "/.cache/omarchy/marketplace_catalog.json") + " 2>/dev/null | jq -c '.plugins // []' 2>/dev/null || " + shellQuote(om + "/bin/omarchy-plugins") + " marketplace --json 2>/dev/null || cat " + shellQuote(om + "/registry.json") + " 2>/dev/null | jq -c '.plugins // []' 2>/dev/null || echo '[]'"]
    marketProc.running = true
  }

  function loadShortcuts() {
    shortcutsProc.command = ["bash", "-c", "omarchy plugins shortcut list --json 2>/dev/null || echo '[]'"]
    shortcutsProc.running = true
  }

  function loadBarLayout() {
    barProc.command = ["bash", "-c", "omarchy plugins bar list 2>/dev/null || echo '{\"inBar\":[]}'"]
    barProc.running = true
  }

  Process {
    id: installedProc
    running: false
    stdout: StdioCollector {
      waitForEnd: true
      onStreamFinished: {
        try {
          var arr = JSON.parse(String(text).trim())
          if (Array.isArray(arr)) {
            root.installedPlugins = arr
            root.applyInstalledFilter()
          }
        } catch (e) {
          console.warn("Failed to parse installed plugins: " + e)
        }
      }
    }
  }

  Process {
    id: marketProc
    running: false
    stdout: StdioCollector {
      waitForEnd: true
      onStreamFinished: {
        try {
          var data = JSON.parse(String(text).trim())
          var arr = Array.isArray(data) ? data : (data && data.plugins ? data.plugins : [])
          if (Array.isArray(arr)) {
            root.marketplacePlugins = arr
            root.applyMarketFilter()
          }
        } catch (e) {
          console.warn("Failed to parse marketplace plugins: " + e)
        }
      }
    }
  }

  Process {
    id: shortcutsProc
    running: false
    stdout: StdioCollector {
      waitForEnd: true
      onStreamFinished: {
        try {
          var arr = JSON.parse(String(text).trim())
          var map = {}
          if (Array.isArray(arr)) {
            for (var i = 0; i < arr.length; i++) {
              if (arr[i] && arr[i].id) {
                map[arr[i].id] = arr[i].keys || ""
              }
            }
          }
          root.shortcutsMap = map
        } catch (e) {
          console.warn("Failed to parse shortcuts: " + e)
        }
      }
    }
  }

  Process {
    id: barProc
    running: false
    stdout: StdioCollector {
      waitForEnd: true
      onStreamFinished: {
        try {
          var data = JSON.parse(String(text).trim())
          if (data && data.inBar) {
            root.barLayoutData = data
            root.applyInstalledFilter()
          }
        } catch (e) {
          console.warn("Failed to parse bar layout: " + e)
        }
      }
    }
  }

  // ---------------------------------------------------------------- Filter Logic
  function isPluginInBar(id) {
    if (!id || !root.barLayoutData || !root.barLayoutData.inBar) return false
    return root.barLayoutData.inBar.indexOf(id) !== -1
  }

  function getPluginIcon(id, name) {
    var map = {
      "omarchy.menu": 0xF0463,                // md-rocket
      "omarchy.active-window": 0xF05B1,       // md-window_open
      "omarchy.workspaces": 0xF0570,          // md-view_grid
      "omarchy.bar": 0xF056E,                 // md-view_dashboard
      "omarchy.agents": 0xF06A9,              // md-robot
      "omarchy.audio": 0xF057E,               // md-volume_high
      "omarchy.bluetooth": 0xF00AF,           // md-bluetooth
      "omarchy.network": 0xF05A9,             // md-wifi
      "omarchy.clock": 0xF0150,               // md-clock_outline
      "omarchy.battery": 0xF0079,             // md-battery
      "omarchy.power": 0xF0425,               // md-power
      "omarchy.sysmon": 0xF029A,              // md-gauge
      "omarchy.weather": 0xF0599,             // md-weather_sunny
      "omarchy.media": 0xF075A,               // md-music
      "omarchy.notifications": 0xF009A,       // md-bell
      "omarchy.clipboard": 0xF014D,           // md-clipboard_text
      "omarchy.emojis": 0xF01F2,              // md-emoticon_outline
      "omarchy.indicators": 0xF0335,          // md-lightbulb
      "omarchy.keyboard-layout": 0xF097B,     // md-keyboard_outline
      "omarchy.lock": 0xF033E,                // md-lock
      "omarchy.nightlight": 0xF0594,          // md-weather_night
      "omarchy.microphone": 0xF036C,          // md-microphone
      "omarchy.tray": 0xF1294,                // md-tray
      "omarchy.background": 0xF02E9,          // md-image
      "omarchy.idle": 0xF051F,                // md-timer_sand
      "omarchy.polkit": 0xF0BC5,              // md-shield_key_outline
      "omarchy.reminders": 0xF13AB,           // md-timer
      "omarchy.spacer": 0xF084E,              // md-arrow_expand_horizontal
      "omarchy.speedtest": 0xF04C5,           // md-speedometer
      "omarchy.system-update": 0xF06B0,       // md-update
      "omarchy.tailscale": 0xF0582,           // md-vpn
      "omarchy.wifiqr": 0xF0432,              // md-qrcode
      "deomarchy.docker-status": 0xF0868,     // md-docker
      "deomarchy.wallpaper-manager": 0xF0E09, // md-wallpaper
      "deomarchy.power-profile": 0xF0241,     // md-flash
      "deomarchy.system-overview": 0xF154D,   // md-chart_box
      "deomarchy.monitor-manager": 0xF0379,   // md-monitor
      "deomarchy.plugin-manager": 0xF0327,    // md-puzzle
      "deomarchy.plugin-library": 0xF0327,    // md-puzzle
      "nosignal.motion-wallpaper": 0xF022F,   // md-film
      "omaplug": 0xF06A5                      // md-power_plug
    }
    if (map[id] !== undefined) return String.fromCodePoint(map[id])
    var clean = (name || id || "").toLowerCase()
    if (clean.indexOf("docker") !== -1) return String.fromCodePoint(0xF0868) // md-docker
    if (clean.indexOf("game") !== -1) return String.fromCodePoint(0xF0296)   // md-gamepad
    if (clean.indexOf("music") !== -1 || clean.indexOf("audio") !== -1) return String.fromCodePoint(0xF075A) // md-music
    if (clean.indexOf("wall") !== -1) return String.fromCodePoint(0xF02E9)   // md-image
    if (clean.indexOf("monitor") !== -1 || clean.indexOf("cpu") !== -1) return String.fromCodePoint(0xF029A) // md-gauge
    if (clean.indexOf("calc") !== -1) return String.fromCodePoint(0xF00EC)   // md-calculator
    if (clean.indexOf("ai") !== -1 || clean.indexOf("gpt") !== -1) return String.fromCodePoint(0xF06A9) // md-robot
    return String.fromCodePoint(0xF0068)                                     // md-auto_fix
  }

  function getPluginDescription(p) {
    if (p.description && p.description.length > 0) return p.description
    var map = {
      "omarchy.active-window": "Displays the title and icon of the current focused window",
      "omarchy.agents": "Quick switcher and status for background AI coding assistants",
      "omarchy.audio": "Audio volume slider, output sink switcher, and per-app stream mixer",
      "omarchy.background": "High-performance wallpaper backdrop rendering service",
      "omarchy.bar": "Core desktop top bar container and layout supervisor",
      "omarchy.battery": "Battery level indicator, charging status, and power threshold alerts",
      "omarchy.bluetooth": "Bluetooth device scanner, pairing manager, and quick connect",
      "omarchy.clipboard": "Searchable clipboard history popup overlay",
      "omarchy.clock": "Date, time, world clocks, and integrated monthly calendar panel",
      "omarchy.dev-gallery": "Developer gallery showcase for Quickshell UI components",
      "omarchy.disk-speedtest": "Real-time disk read/write benchmark utility",
      "omarchy.dropbox": "Dropbox file sync state and folder shortcut",
      "omarchy.emojis": "Searchable emoji picker with instant clipboard copy",
      "omarchy.idle": "Wayland idle manager and automatic screen locking service",
      "omarchy.image-picker": "Desktop screenshot and image selector overlay",
      "omarchy.indicators": "Quick-glance system status indicators (caps lock, mute, recording)",
      "omarchy.keyboard-layout": "Keyboard layout indicator and XKB switcher",
      "omarchy.lock": "Wayland lock screen overlay with password authentication",
      "omarchy.media": "MPRIS media player controls (play/pause, track, seek)",
      "omarchy.menu": "Application launcher and system command launcher",
      "omarchy.microphone": "Microphone volume control and mute toggle",
      "omarchy.monitor": "Display arrangement, brightness, and resolution manager",
      "nosignal.motion-wallpaper": "Dynamic animated video and shader wallpaper background",
      "omarchy.network": "Wi-Fi network scanner, signal strength, and Ethernet status",
      "omarchy.nightlight": "Blue light reduction gamma adjustment service (Hyprsunset)",
      "omarchy.notifications": "Desktop notification center and daemon",
      "omarchy.osd": "On-screen display popup for volume and brightness adjustments",
      "omarchy.polkit": "Polkit authentication agent for administrative privilege prompts",
      "omarchy.power": "Power menu with shutdown, reboot, suspend, and logout options",
      "omarchy.reminders": "Sticky notes and system reminder overlay",
      "omarchy.spacer": "Flexible spacer element for custom bar layout separation",
      "omarchy.speedtest": "Network internet speed test benchmark panel",
      "omarchy.sysmon": "Live CPU, RAM, disk, network, and temperature monitor",
      "omarchy.system-update": "Arch Linux pacman & AUR package update notification widget",
      "omarchy.tailscale": "Tailscale VPN status toggle and exit node switcher",
      "omarchy.tray": "System tray host for background app indicators",
      "omarchy.weather": "Local weather forecast and temperature indicator",
      "omarchy.wifiqr": "Generates a Wi-Fi QR code for quick mobile connection",
      "omarchy.workspaces": "Visual Hyprland workspace indicator with active window dots",
      "deomarchy.docker-status": "Docker container monitor with one-click lazydocker integration",
      "deomarchy.power-profile": "Power profile switcher (Performance / Balanced / Power-saver)",
      "deomarchy.wallpaper-manager": "Theme-synchronized wallpaper selector panel",
      "deomarchy.system-overview": "Comprehensive system resource overview dashboard"
    }
    return map[p.id] || ("ID: " + p.id)
  }

  function applyInstalledFilter() {
    var list = root.installedPlugins || []
    var q = root.installedSearch.toLowerCase().trim()
    var filter = root.installedFilter

    var res = []
    for (var i = 0; i < list.length; i++) {
      var p = list[i]
      if (filter === "active" && !p.enabled) continue
      if (filter === "inactive" && p.enabled) continue
      if (filter === "bar" && !isPluginInBar(p.id)) continue
      if (filter === "builtin" && !p.firstParty) continue
      if (filter === "user" && p.firstParty) continue

      if (q.length > 0) {
        var name = (p.name || "").toLowerCase()
        var id = (p.id || "").toLowerCase()
        var desc = getPluginDescription(p).toLowerCase()
        var kinds = (p.kinds || []).join(" ").toLowerCase()
        if (name.indexOf(q) === -1 && id.indexOf(q) === -1 && desc.indexOf(q) === -1 && kinds.indexOf(q) === -1) continue
      }
      res.push(p)
    }
    root.filteredInstalled = res
  }

  function applyMarketFilter() {
    var list = root.marketplacePlugins || []
    var q = root.marketSearch.toLowerCase().trim()
    var cat = root.marketCategory

    var res = []
    for (var i = 0; i < list.length; i++) {
      var p = list[i]
      if (cat !== "All" && (p.category || "").toLowerCase() !== cat.toLowerCase()) continue

      if (q.length > 0) {
        var name = (p.name || "").toLowerCase()
        var id = (p.id || "").toLowerCase()
        var desc = (p.description || "").toLowerCase()
        var author = (p.author || "").toLowerCase()
        var tags = (p.tags || []).join(" ").toLowerCase()
        if (name.indexOf(q) === -1 && id.indexOf(q) === -1 && desc.indexOf(q) === -1 && author.indexOf(q) === -1 && tags.indexOf(q) === -1) continue
      }
      res.push(p)
    }

    if (root.marketSort === "stars") {
      res.sort(function(a, b) { return (b.stars || 0) - (a.stars || 0) })
    } else if (root.marketSort === "name") {
      res.sort(function(a, b) { return (a.name || a.id).localeCompare(b.name || b.id) })
    } else if (root.marketSort === "date") {
      res.sort(function(a, b) { return String(b.addedAt || "").localeCompare(String(a.addedAt || "")) })
    }

    root.filteredMarketplace = res
  }

  onInstalledSearchChanged: applyInstalledFilter()
  onInstalledFilterChanged: applyInstalledFilter()
  onMarketSearchChanged: applyMarketFilter()
  onMarketCategoryChanged: applyMarketFilter()
  onMarketSortChanged: applyMarketFilter()

  // ---------------------------------------------------------------- Actions
  function isInstalled(id) {
    if (!id) return false
    var cleanId = id.replace(/^[a-z0-9_-]+\./, "")
    for (var i = 0; i < root.installedPlugins.length; i++) {
      var instId = root.installedPlugins[i].id
      if (instId === id || instId === cleanId || instId.endsWith("." + id) || id.endsWith("." + instId)) {
        return true
      }
    }
    return false
  }

  function showToast(msg, type) {
    root.statusMessage = msg
    root.statusType = type || "info"
    toastTimer.restart()
  }

  Timer {
    id: toastTimer
    interval: 3500
    onTriggered: root.statusMessage = ""
  }

  function togglePlugin(plugin) {
    if (!plugin || !plugin.id) return
    var targetState = !plugin.enabled
    plugin.enabled = targetState
    applyInstalledFilter()

    actionProc.command = ["bash", "-c", "omarchy plugins " + (targetState ? "enable" : "disable") + " " + shellQuote(plugin.id)]
    actionProc.targetAction = "toggle"
    actionProc.targetName = plugin.name || plugin.id
    actionProc.targetState = targetState
    actionProc.running = true
  }

  function toggleBarPlacement(plugin) {
    if (!plugin || !plugin.id) return
    if (isPluginInBar(plugin.id)) {
      actionProc.command = ["bash", "-c", "omarchy plugins bar remove " + shellQuote(plugin.id)]
      actionProc.targetAction = "bar_remove"
      actionProc.targetName = plugin.name || plugin.id
      actionProc.running = true
    } else {
      root.barTargetPlugin = plugin
      root.barSectionDialogOpen = true
    }
  }

  function addPluginToBar(plugin, section) {
    root.barSectionDialogOpen = false
    root.barTargetPlugin = null
    if (!plugin || !plugin.id) return

    showToast("Adding " + (plugin.name || plugin.id) + " to bar (" + section + ")...", "info")
    actionProc.command = ["bash", "-c", "omarchy plugins bar add " + shellQuote(plugin.id) + " " + shellQuote(section)]
    actionProc.targetAction = "bar_add"
    actionProc.targetName = plugin.name || plugin.id
    actionProc.running = true
  }

  function openShortcutDialog(plugin) {
    root.shortcutTargetPlugin = plugin
    root.shortcutInput = root.shortcutsMap[plugin.id] || ""
    root.shortcutDialogOpen = true
  }

  function saveShortcut() {
    var p = root.shortcutTargetPlugin
    var keys = root.shortcutInput.trim()
    root.shortcutDialogOpen = false
    root.shortcutTargetPlugin = null
    if (!p) return

    if (keys === "") {
      actionProc.command = ["bash", "-c", "omarchy plugins shortcut remove " + shellQuote(p.id)]
      actionProc.targetAction = "shortcut_remove"
      actionProc.targetName = p.name || p.id
      actionProc.running = true
    } else {
      actionProc.command = ["bash", "-c", "omarchy plugins shortcut set " + shellQuote(p.id) + " " + shellQuote(keys)]
      actionProc.targetAction = "shortcut_set"
      actionProc.targetName = p.name || p.id
      actionProc.running = true
    }
  }

  function clearShortcut() {
    root.shortcutInput = ""
    saveShortcut()
  }

  function installPlugin(p) {
    if (!p || root.installingId !== "") return
    root.installingId = p.id
    showToast("Installing " + (p.name || p.id) + "...", "info")

    actionProc.command = ["bash", "-c", "omarchy plugins install " + shellQuote(p.id) + " --enable"]
    actionProc.targetAction = "install"
    actionProc.targetName = p.name || p.id
    actionProc.running = true
  }

  function installFromUrl(url) {
    if (!url || url.trim() === "") return
    url = url.trim()
    root.urlDialogOpen = false
    root.urlInput = ""
    showToast("Installing: " + url + "...", "info")

    actionProc.command = ["bash", "-c", "omarchy plugins install " + shellQuote(url) + " --enable"]
    actionProc.targetAction = "install"
    actionProc.targetName = url
    actionProc.running = true
  }

  function confirmUninstall(p) {
    root.pendingUninstallPlugin = p
    root.confirmUninstallOpen = true
  }

  function executeUninstall() {
    var p = root.pendingUninstallPlugin
    root.confirmUninstallOpen = false
    root.pendingUninstallPlugin = null
    if (!p) return

    showToast("Removing " + (p.name || p.id) + "...", "info")
    actionProc.command = ["bash", "-c", "omarchy plugins remove " + shellQuote(p.id)]
    actionProc.targetAction = "remove"
    actionProc.targetName = p.name || p.id
    actionProc.running = true
  }

  function updateAllPlugins() {
    root.updatingAll = true
    showToast("Checking and updating all plugins...", "info")
    actionProc.command = ["bash", "-c", "omarchy plugins update"]
    actionProc.targetAction = "update_all"
    actionProc.targetName = "all plugins"
    actionProc.running = true
  }

  function restartShell() {
    root.restartDialogOpen = false
    showToast("Restarting Quickshell...", "info")
    actionProc.command = ["bash", "-c", "omarchy-restart-shell"]
    actionProc.targetAction = "restart"
    actionProc.targetName = "shell"
    actionProc.running = true
  }

  Process {
    id: actionProc
    running: false
    property string targetAction: ""
    property string targetName: ""
    property bool targetState: false

    onExited: function(code) {
      root.installingId = ""
      root.updatingAll = false
        if (code === 0) {
          var ok = root.nf(root.ic.checkCircle)
          if (targetAction === "install") {
            root.showToast(ok + " Installed " + targetName + "!", "success")
          } else if (targetAction === "remove") {
            root.showToast(ok + " Removed " + targetName + ".", "success")
          } else if (targetAction === "toggle") {
            root.showToast(ok + " " + (targetState ? "Enabled" : "Disabled") + " " + targetName, "success")
          } else if (targetAction === "bar_add") {
            root.showToast(ok + " Pinned " + targetName + " to top bar!", "success")
          } else if (targetAction === "bar_remove") {
            root.showToast(ok + " Unpinned " + targetName + " from bar.", "success")
          } else if (targetAction === "shortcut_set") {
            root.showToast(ok + " Shortcut saved for " + targetName + "!", "success")
          } else if (targetAction === "shortcut_remove") {
            root.showToast(ok + " Shortcut cleared for " + targetName, "success")
          } else if (targetAction === "update_all") {
            root.showToast(ok + " All plugins up to date!", "success")
          } else if (targetAction === "restart") {
            root.showToast(ok + " Shell restarted successfully!", "success")
          }
        } else {
          root.showToast(root.nf(root.ic.closeCircle) + " Operation failed for " + targetName, "error")
        }
      root.loadInstalled()
      root.loadShortcuts()
      root.loadBarLayout()
    }
  }

  // ---------------------------------------------------------------- Main Floating Window
  Window {
    id: win
    title: "Omarchy Plugin Manager"
    visible: true
    width: 980
    height: 740
    minimumWidth: 840
    minimumHeight: 600
    color: root.bgBase

    // ESC handling: dismiss modals first, then close the standalone window.
    // Priority BeforeItem so it fires even when a TextField has focus.
    Item {
      anchors.fill: parent
      focus: true
      Keys.priority: Keys.BeforeItem
      Keys.onPressed: function(event) {
        if (event.key === Qt.Key_Escape) {
          if (root.urlDialogOpen) { root.urlDialogOpen = false; event.accepted = true; return }
          if (root.confirmUninstallOpen) { root.confirmUninstallOpen = false; event.accepted = true; return }
          if (root.shortcutDialogOpen) { root.shortcutDialogOpen = false; event.accepted = true; return }
          if (root.barSectionDialogOpen) { root.barSectionDialogOpen = false; event.accepted = true; return }
          if (root.restartDialogOpen) { root.restartDialogOpen = false; event.accepted = true; return }
          Qt.quit()
          event.accepted = true
        }
      }
      Component.onCompleted: forceActiveFocus()
    }

    Rectangle {
      anchors.fill: parent
      color: root.bgBase

      ColumnLayout {
        anchors.fill: parent
        anchors.margins: 20
        spacing: 16

        // ========================================================== Top Navigation Header
        RowLayout {
          Layout.fillWidth: true
          spacing: 16

          // Left Brand
          RowLayout {
            spacing: 12
            Rectangle {
              Layout.preferredWidth: 42
              Layout.preferredHeight: 42
              radius: 12
              color: root.accentGlow
              border.color: Qt.rgba(root.accent.r, root.accent.g, root.accent.b, 0.4)
              border.width: 1
              Text {
                anchors.centerIn: parent
                text: root.nf(root.ic.puzzle)
                color: root.accent
                font.family: root.nfFontFamily
                font.pixelSize: 22
              }
            }

            ColumnLayout {
              spacing: 2
              Text {
                text: "Plugin Manager"
                color: root.fgMain
                font.pixelSize: 18
                font.bold: true
              }
              Text {
                text: "Omarchy Desktop & Extensions"
                color: root.fgMuted
                font.pixelSize: 11
              }
            }
          }

          Item { Layout.fillWidth: true }

          // Center Segmented Tab Bar
          Rectangle {
            Layout.preferredWidth: 320
            Layout.preferredHeight: 40
            radius: 20
            color: root.bgSurface
            border.color: root.borderSubtle
            border.width: 1

            RowLayout {
              anchors.fill: parent
              anchors.margins: 4
              spacing: 4

              Rectangle {
                Layout.fillWidth: true
                Layout.fillHeight: true
                radius: 16
                color: root.currentTab === "installed" ? root.accent : "transparent"

                RowLayout {
                  anchors.centerIn: parent
                  spacing: 6
                  Text {
                    text: root.nf(root.ic.package)
                    color: root.currentTab === "installed" ? "#11121d" : root.fgMuted
                    font.family: root.nfFontFamily
                    font.pixelSize: 13
                  }
                  Text {
                    text: "Installed (" + root.installedPlugins.length + ")"
                    color: root.currentTab === "installed" ? "#11121d" : root.fgMuted
                    font.pixelSize: 12
                    font.bold: root.currentTab === "installed"
                  }
                }

                MouseArea {
                  anchors.fill: parent
                  cursorShape: Qt.PointingHandCursor
                  onClicked: root.currentTab = "installed"
                }
              }

              Rectangle {
                Layout.fillWidth: true
                Layout.fillHeight: true
                radius: 16
                color: root.currentTab === "marketplace" ? root.accent : "transparent"

                RowLayout {
                  anchors.centerIn: parent
                  spacing: 6
                  Text {
                    text: root.nf(root.ic.globe)
                    color: root.currentTab === "marketplace" ? "#11121d" : root.fgMuted
                    font.family: root.nfFontFamily
                    font.pixelSize: 13
                  }
                  Text {
                    text: "Marketplace (" + (root.marketplacePlugins.length || "1000+") + ")"
                    color: root.currentTab === "marketplace" ? "#11121d" : root.fgMuted
                    font.pixelSize: 12
                    font.bold: root.currentTab === "marketplace"
                  }
                }

                MouseArea {
                  anchors.fill: parent
                  cursorShape: Qt.PointingHandCursor
                  onClicked: {
                    root.currentTab = "marketplace"
                    if (root.marketplacePlugins.length === 0) root.loadMarketplace()
                  }
                }
              }
            }
          }

          Item { Layout.fillWidth: true }

          // Right Actions
          RowLayout {
            spacing: 8

            // Git URL
            Rectangle {
              Layout.preferredHeight: 36
              Layout.preferredWidth: btnGitText.implicitWidth + 28
              radius: 10
              color: root.bgSurface
              border.color: root.borderSubtle
              border.width: 1

              RowLayout {
                anchors.centerIn: parent
                spacing: 6
                Text {
                  text: root.nf(root.ic.plus)
                  color: root.accent
                  font.family: root.nfFontFamily
                  font.pixelSize: 13
                }
                Text {
                  id: btnGitText
                  text: "Git URL"
                  color: root.fgMain
                  font.pixelSize: 12
                  font.bold: true
                }
              }

              MouseArea {
                anchors.fill: parent
                cursorShape: Qt.PointingHandCursor
                onClicked: root.urlDialogOpen = true
              }
            }

            // Update All
            Rectangle {
              Layout.preferredHeight: 36
              Layout.preferredWidth: btnUpText.implicitWidth + 28
              radius: 10
              color: root.bgSurface
              border.color: root.borderSubtle
              border.width: 1

              RowLayout {
                anchors.centerIn: parent
                spacing: 6
                Text {
                  text: root.nf(root.ic.update)
                  color: root.greenSuccess
                  font.family: root.nfFontFamily
                  font.pixelSize: 13
                }
                Text {
                  id: btnUpText
                  text: "Update"
                  color: root.fgMain
                  font.pixelSize: 12
                  font.bold: true
                }
              }

              MouseArea {
                anchors.fill: parent
                cursorShape: Qt.PointingHandCursor
                onClicked: root.updateAllPlugins()
              }
            }

            // Restart Shell
            Rectangle {
              Layout.preferredHeight: 36
              Layout.preferredWidth: 38
              radius: 10
              color: root.bgSurface
              border.color: root.borderSubtle
              border.width: 1

              Text {
                anchors.centerIn: parent
                text: root.nf(root.ic.bolt)
                color: root.fgMain
                font.family: root.nfFontFamily
                font.pixelSize: 15
              }

              MouseArea {
                anchors.fill: parent
                cursorShape: Qt.PointingHandCursor
                onClicked: root.restartDialogOpen = true
              }
            }
          }
        }

        // ========================================================== Toast Banner
        Rectangle {
          Layout.fillWidth: true
          Layout.preferredHeight: root.statusMessage !== "" ? 36 : 0
          visible: root.statusMessage !== ""
          radius: 10
          color: root.statusType === "success" ? root.greenGlow : (root.statusType === "error" ? root.redGlow : root.accentGlow)
          border.color: root.statusType === "success" ? root.greenSuccess : (root.statusType === "error" ? root.redDanger : root.accent)
          border.width: 1
          clip: true

          Text {
            anchors.centerIn: parent
            text: root.statusMessage
            color: root.fgMain
            font.family: root.nfFontFamily
            font.pixelSize: 12
            font.bold: true
          }
        }

        // ========================================================== Views
        StackLayout {
          Layout.fillWidth: true
          Layout.fillHeight: true
          currentIndex: root.currentTab === "installed" ? 0 : 1

          // -------------------------------------------------------- TAB 1: INSTALLED
          Item {
            ColumnLayout {
              anchors.fill: parent
              spacing: 12

              // Filter & Search Toolbar
              RowLayout {
                Layout.fillWidth: true
                spacing: 12

                // Search Box
                Rectangle {
                  Layout.fillWidth: true
                  Layout.preferredHeight: 40
                  radius: 12
                  color: root.bgSurface
                  border.color: root.borderSubtle
                  border.width: 1

                  RowLayout {
                    anchors.fill: parent
                    anchors.leftMargin: 12
                    anchors.rightMargin: 12
                    spacing: 10

                    Text {
                      text: root.nf(root.ic.magnify)
                      color: root.fgDim
                      font.family: root.nfFontFamily
                      font.pixelSize: 14
                    }

                    TextInput {
                      id: installedSearchInput
                      Layout.fillWidth: true
                      text: root.installedSearch
                      color: root.fgMain
                      font.pixelSize: 13
                      selectByMouse: true
                      onTextChanged: root.installedSearch = text

                      Text {
                        text: "Search plugins by name, ID, or description..."
                        color: root.fgDim
                        font.pixelSize: 13
                        visible: !installedSearchInput.text
                      }
                    }

                    Text {
                      visible: installedSearchInput.text.length > 0
                      text: root.nf(root.ic.close)
                      color: root.fgDim
                      font.family: root.nfFontFamily
                      font.pixelSize: 13
                      MouseArea {
                        anchors.fill: parent
                        cursorShape: Qt.PointingHandCursor
                        onClicked: root.installedSearch = ""
                      }
                    }
                  }
                }

                // Filter Chips
                RowLayout {
                  spacing: 6

                  Repeater {
                    model: [
                      { id: "all", label: "All (" + root.installedPlugins.length + ")" },
                      { id: "active", label: "Active" },
                      { id: "inactive", label: "Inactive" },
                      { id: "bar", label: "In Bar" },
                      { id: "builtin", label: "Built-in" },
                      { id: "user", label: "User" }
                    ]

                    delegate: Rectangle {
                      required property var modelData
                      Layout.preferredHeight: 34
                      Layout.preferredWidth: instChipText.implicitWidth + 22
                      radius: 17
                      color: root.installedFilter === modelData.id ? root.accentGlow : root.bgSurface
                      border.color: root.installedFilter === modelData.id ? root.accent : root.borderSubtle
                      border.width: 1

                      Text {
                        id: instChipText
                        anchors.centerIn: parent
                        text: modelData.label
                        color: root.installedFilter === modelData.id ? root.accent : root.fgMuted
                        font.pixelSize: 12
                        font.bold: root.installedFilter === modelData.id
                      }

                      MouseArea {
                        anchors.fill: parent
                        cursorShape: Qt.PointingHandCursor
                        onClicked: root.installedFilter = modelData.id
                      }
                    }
                  }
                }
              }

              // List of Installed Plugins
              ListView {
                Layout.fillWidth: true
                Layout.fillHeight: true
                clip: true
                spacing: 8
                model: root.filteredInstalled

                delegate: Rectangle {
                  required property var modelData
                  property bool inBar: root.isPluginInBar(modelData.id)
                  property string shortcut: root.shortcutsMap[modelData.id] || ""
                  property bool isBarCompatible: {
                    var kinds = modelData.kinds || []
                    return kinds.indexOf("bar-widget") !== -1 || kinds.indexOf("bar") !== -1 || kinds.indexOf("panel") !== -1
                  }

                  width: parent ? parent.width : 0
                  height: 74
                  radius: 12
                  color: modelData.enabled ? root.bgCard : root.bgSurface
                  border.color: modelData.enabled ? root.borderActive : root.borderSubtle
                  border.width: 1

                  RowLayout {
                    anchors.fill: parent
                    anchors.margins: 12
                    spacing: 14

                    // Dynamic Icon Badge
                    Rectangle {
                      Layout.preferredWidth: 46
                      Layout.preferredHeight: 46
                      radius: 12
                      color: modelData.enabled ? root.accentGlow : root.bgElevated
                      border.color: modelData.enabled ? Qt.rgba(root.accent.r, root.accent.g, root.accent.b, 0.3) : root.borderSubtle
                      border.width: 1

                      Text {
                        anchors.centerIn: parent
                        text: root.getPluginIcon(modelData.id, modelData.name)
                        color: modelData.enabled ? root.accent : root.fgDim
                        font.family: root.nfFontFamily
                        font.pixelSize: 22
                      }
                    }

                    // Metadata
                    ColumnLayout {
                      Layout.fillWidth: true
                      spacing: 3

                      RowLayout {
                        spacing: 8
                        Text {
                          text: modelData.name || modelData.id
                          color: root.fgMain
                          font.pixelSize: 14
                          font.bold: true
                        }

                        // Kind pills
                        Repeater {
                          model: modelData.kinds || []
                          delegate: Rectangle {
                            required property var modelData
                            Layout.preferredHeight: 20
                            Layout.preferredWidth: kindText.implicitWidth + 12
                            radius: 6
                            color: root.purpleGlow
                            border.color: Qt.rgba(root.purpleTag.r, root.purpleTag.g, root.purpleTag.b, 0.3)
                            border.width: 1

                            Text {
                              id: kindText
                              anchors.centerIn: parent
                              text: modelData === "bar-widget" ? "Widget" : (modelData === "service" ? "Service" : (modelData === "panel" ? "Panel" : modelData))
                              color: root.purpleTag
                              font.pixelSize: 10
                              font.bold: true
                            }
                          }
                        }

                        // Source pill
                        Rectangle {
                          Layout.preferredHeight: 20
                          Layout.preferredWidth: srcText.implicitWidth + 12
                          radius: 6
                          color: modelData.firstParty ? Qt.rgba(255, 255, 255, 0.05) : root.greenGlow
                          border.color: modelData.firstParty ? root.borderSubtle : Qt.rgba(root.greenSuccess.r, root.greenSuccess.g, root.greenSuccess.b, 0.3)
                          border.width: 1

                          Text {
                            id: srcText
                            anchors.centerIn: parent
                            text: modelData.firstParty ? "Core" : "User"
                            color: modelData.firstParty ? root.fgDim : root.greenSuccess
                            font.pixelSize: 10
                            font.bold: true
                          }
                        }
                      }

                      Text {
                        Layout.fillWidth: true
                        text: root.getPluginDescription(modelData)
                        color: root.fgMuted
                        font.pixelSize: 11
                        elide: Text.ElideRight
                      }
                    }

                    // Interactive Controls Row
                    RowLayout {
                      spacing: 8

                      // Bar Pin Button
                      Rectangle {
                        visible: isBarCompatible
                        Layout.preferredHeight: 32
                        Layout.preferredWidth: barBtnText.implicitWidth + 24
                        radius: 8
                        color: inBar ? root.greenGlow : root.bgElevated
                        border.color: inBar ? root.greenSuccess : root.borderSubtle
                        border.width: 1

                        RowLayout {
                          anchors.centerIn: parent
                          spacing: 6
                          Text {
                            text: inBar ? root.nf(root.ic.pin) : root.nf(root.ic.plus)
                            color: inBar ? root.greenSuccess : root.fgMuted
                            font.family: root.nfFontFamily
                            font.pixelSize: 12
                          }
                          Text {
                            id: barBtnText
                            text: inBar ? "In Top Bar" : "Pin to Bar"
                            color: inBar ? root.greenSuccess : root.fgMuted
                            font.pixelSize: 11
                            font.bold: inBar
                          }
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: root.toggleBarPlacement(modelData)
                        }
                      }

                      // Shortcut Keycap Button
                      Rectangle {
                        Layout.preferredHeight: 32
                        Layout.preferredWidth: scBtnText.implicitWidth + 24
                        radius: 8
                        color: shortcut !== "" ? root.amberGlow : root.bgElevated
                        border.color: shortcut !== "" ? root.amberWarn : root.borderSubtle
                        border.width: 1

                        RowLayout {
                          anchors.centerIn: parent
                          spacing: 6
                          Text {
                            text: root.nf(root.ic.keyboard)
                            color: shortcut !== "" ? root.amberWarn : root.fgDim
                            font.family: root.nfFontFamily
                            font.pixelSize: 13
                          }
                          Text {
                            id: scBtnText
                            text: shortcut !== "" ? shortcut : "Shortcut"
                            color: shortcut !== "" ? root.amberWarn : root.fgMuted
                            font.pixelSize: 11
                            font.bold: shortcut !== ""
                          }
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: root.openShortcutDialog(modelData)
                        }
                      }

                      // Delete User Plugin
                      Rectangle {
                        visible: !modelData.firstParty
                        Layout.preferredWidth: 32
                        Layout.preferredHeight: 32
                        radius: 8
                        color: root.redGlow
                        border.color: Qt.rgba(root.redDanger.r, root.redDanger.g, root.redDanger.b, 0.4)
                        border.width: 1

                        Text {
                          anchors.centerIn: parent
                          text: root.nf(root.ic.trash)
                          color: root.redDanger
                          font.family: root.nfFontFamily
                          font.pixelSize: 14
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: root.confirmUninstall(modelData)
                        }
                      }

                      // Active Toggle Switch
                      Rectangle {
                        Layout.preferredWidth: 48
                        Layout.preferredHeight: 28
                        radius: 14
                        color: modelData.enabled ? root.accent : root.bgElevated
                        border.color: modelData.enabled ? root.accent : root.borderSubtle
                        border.width: 1

                        Rectangle {
                          width: 22
                          height: 22
                          radius: 11
                          color: "#ffffff"
                          anchors.verticalCenter: parent.verticalCenter
                          x: modelData.enabled ? 23 : 3
                          Behavior on x { NumberAnimation { duration: 120 } }
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: root.togglePlugin(modelData)
                        }
                      }
                    }
                  }
                }
              }
            }
          }

          // -------------------------------------------------------- TAB 2: MARKETPLACE
          Item {
            ColumnLayout {
              anchors.fill: parent
              spacing: 12

              // Filter & Search Toolbar
              RowLayout {
                Layout.fillWidth: true
                spacing: 12

                // Search Box
                Rectangle {
                  Layout.fillWidth: true
                  Layout.preferredHeight: 40
                  radius: 12
                  color: root.bgSurface
                  border.color: root.borderSubtle
                  border.width: 1

                  RowLayout {
                    anchors.fill: parent
                    anchors.leftMargin: 12
                    anchors.rightMargin: 12
                    spacing: 10

                    Text {
                      text: root.nf(root.ic.globe)
                      color: root.fgDim
                      font.family: root.nfFontFamily
                      font.pixelSize: 14
                    }

                    TextInput {
                      id: marketSearchInput
                      Layout.fillWidth: true
                      text: root.marketSearch
                      color: root.fgMain
                      font.pixelSize: 13
                      selectByMouse: true
                      onTextChanged: root.marketSearch = text

                      Text {
                        text: "Search 1,000+ community extensions from OmarchyPlugins.com..."
                        color: root.fgDim
                        font.pixelSize: 13
                        visible: !marketSearchInput.text
                      }
                    }

                    Text {
                      visible: marketSearchInput.text.length > 0
                      text: root.nf(root.ic.close)
                      color: root.fgDim
                      font.family: root.nfFontFamily
                      font.pixelSize: 13
                      MouseArea {
                        anchors.fill: parent
                        cursorShape: Qt.PointingHandCursor
                        onClicked: root.marketSearch = ""
                      }
                    }
                  }
                }

                // Category Chips ScrollView
                ScrollView {
                  Layout.preferredWidth: 460
                  Layout.preferredHeight: 40
                  ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
                  ScrollBar.vertical.policy: ScrollBar.AlwaysOff

                  RowLayout {
                    spacing: 6
                    Repeater {
                      model: ["All", "Widgets", "Desktop", "System", "Productivity", "Developer Tools", "Appearance", "Utilities"]
                      delegate: Rectangle {
                        required property var modelData
                        Layout.preferredHeight: 34
                        Layout.preferredWidth: mCatText.implicitWidth + 20
                        radius: 17
                        color: root.marketCategory === modelData ? root.accentGlow : root.bgSurface
                        border.color: root.marketCategory === modelData ? root.accent : root.borderSubtle
                        border.width: 1

                        Text {
                          id: mCatText
                          anchors.centerIn: parent
                          text: modelData
                          color: root.marketCategory === modelData ? root.accent : root.fgMuted
                          font.pixelSize: 12
                          font.bold: root.marketCategory === modelData
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: root.marketCategory = modelData
                        }
                      }
                    }
                  }
                }
              }

              // Marketplace Cards List
              ListView {
                Layout.fillWidth: true
                Layout.fillHeight: true
                clip: true
                spacing: 8
                model: root.filteredMarketplace

                delegate: Rectangle {
                  required property var modelData
                  property bool installed: root.isInstalled(modelData.id)

                  width: parent ? parent.width : 0
                  height: 78
                  radius: 12
                  color: installed ? root.bgCard : root.bgSurface
                  border.color: installed ? Qt.rgba(root.greenSuccess.r, root.greenSuccess.g, root.greenSuccess.b, 0.3) : root.borderSubtle
                  border.width: 1

                  RowLayout {
                    anchors.fill: parent
                    anchors.margins: 12
                    spacing: 14

                    // Initial Badge
                    Rectangle {
                      Layout.preferredWidth: 46
                      Layout.preferredHeight: 46
                      radius: 12
                      color: root.bgElevated
                      border.color: root.borderSubtle
                      border.width: 1

                      Text {
                        anchors.centerIn: parent
                        text: modelData.initials || root.getPluginIcon(modelData.id, modelData.name)
                        color: root.accent
                        font.family: root.nfFontFamily
                        font.pixelSize: modelData.initials ? 16 : 22
                        font.bold: !!modelData.initials
                      }
                    }

                    // Metadata
                    ColumnLayout {
                      Layout.fillWidth: true
                      spacing: 3

                      RowLayout {
                        spacing: 8
                        Text {
                          text: modelData.name || modelData.id
                          color: root.fgMain
                          font.pixelSize: 14
                          font.bold: true
                        }

                        Text {
                          visible: (modelData.stars || 0) > 0
                          text: root.nf(root.ic.star) + " " + modelData.stars
                          color: "#e0af68"
                          font.family: root.nfFontFamily
                          font.pixelSize: 11
                          font.bold: true
                        }

                        Rectangle {
                          visible: modelData.category !== undefined && modelData.category !== ""
                          Layout.preferredHeight: 20
                          Layout.preferredWidth: catPill.implicitWidth + 12
                          radius: 6
                          color: root.purpleGlow
                          border.color: Qt.rgba(root.purpleTag.r, root.purpleTag.g, root.purpleTag.b, 0.3)
                          border.width: 1

                          Text {
                            id: catPill
                            anchors.centerIn: parent
                            text: modelData.category || "Misc"
                            color: root.purpleTag
                            font.pixelSize: 10
                          }
                        }

                        Text {
                          visible: modelData.author !== undefined && modelData.author !== ""
                          text: "by " + modelData.author
                          color: root.fgDim
                          font.pixelSize: 11
                        }
                      }

                      Text {
                        Layout.fillWidth: true
                        text: modelData.description || ""
                        color: root.fgMuted
                        font.pixelSize: 11
                        elide: Text.ElideRight
                      }
                    }

                    // Actions
                    RowLayout {
                      spacing: 8

                      // Repo Link
                      Rectangle {
                        visible: modelData.repo !== undefined && modelData.repo !== ""
                        Layout.preferredWidth: 34
                        Layout.preferredHeight: 34
                        radius: 8
                        color: root.bgElevated
                        border.color: root.borderSubtle
                        border.width: 1

                        Text {
                          anchors.centerIn: parent
                          text: root.nf(root.ic.externalLink)
                          color: root.fgMain
                          font.family: root.nfFontFamily
                          font.pixelSize: 14
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          onClicked: {
                            if (modelData.repo) {
                              Qt.openUrlExternally(modelData.repo)
                            }
                          }
                        }
                      }

                      // Install / Installed Status Button
                      Rectangle {
                        Layout.preferredHeight: 34
                        Layout.preferredWidth: installed ? 100 : 84
                        radius: 8
                        color: installed ? root.greenGlow : (root.installingId === modelData.id ? root.bgElevated : root.accent)
                        border.color: installed ? root.greenSuccess : "transparent"
                        border.width: installed ? 1 : 0

                        Text {
                          anchors.centerIn: parent
                          text: installed ? root.nf(root.ic.check) + " Installed" : (root.installingId === modelData.id ? "Installing..." : "Install")
                          color: installed ? root.greenSuccess : (root.installingId === modelData.id ? root.fgDim : "#11121d")
                          font.family: root.nfFontFamily
                          font.pixelSize: 11
                          font.bold: true
                        }

                        MouseArea {
                          anchors.fill: parent
                          cursorShape: Qt.PointingHandCursor
                          enabled: !installed && root.installingId === ""
                          onClicked: root.installPlugin(modelData)
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

      // ========================================================== MODALS
      // 1. Keyboard Shortcut Dialog Modal
      Rectangle {
        anchors.fill: parent
        color: Qt.rgba(0, 0, 0, 0.8)
        visible: root.shortcutDialogOpen

        MouseArea { anchors.fill: parent; onClicked: root.shortcutDialogOpen = false }

        Rectangle {
          anchors.centerIn: parent
          width: 480
          height: 290
          radius: 16
          color: root.bgSurface
          border.color: root.borderActive
          border.width: 1

          MouseArea { anchors.fill: parent }

          ColumnLayout {
            anchors.fill: parent
            anchors.margins: 22
            spacing: 14

            RowLayout {
              spacing: 10
              Text {
                text: root.nf(root.ic.keyboard)
                color: root.amberWarn
                font.family: root.nfFontFamily
                font.pixelSize: 19
              }
              Text {
                text: "Set Keyboard Shortcut"
                color: root.fgMain
                font.pixelSize: 16
                font.bold: true
              }
            }

            Text {
              text: "Configure a global Hyprland keybind for '" + (root.shortcutTargetPlugin ? (root.shortcutTargetPlugin.name || root.shortcutTargetPlugin.id) : "") + "':"
              color: root.fgMuted
              font.pixelSize: 12
            }

            // Key Input Box
            Rectangle {
              Layout.fillWidth: true
              Layout.preferredHeight: 42
              radius: 10
              color: root.bgBase
              border.color: root.amberWarn
              border.width: 1

              RowLayout {
                anchors.fill: parent
                anchors.margins: 10
                spacing: 10

                TextInput {
                  id: scInputField
                  Layout.fillWidth: true
                  text: root.shortcutInput
                  color: root.fgMain
                  font.pixelSize: 13
                  font.bold: true
                  selectByMouse: true
                  onTextChanged: root.shortcutInput = text

                  Text {
                    text: "e.g. SUPER + ALT + D"
                    color: root.fgDim
                    font.pixelSize: 13
                    visible: !scInputField.text
                  }
                }
              }
            }

            // Quick Modifiers row
            RowLayout {
              spacing: 6
              Text { text: "Add:"; color: root.fgDim; font.pixelSize: 11 }
              Repeater {
                model: ["SUPER + ", "ALT + ", "CTRL + ", "SHIFT + "]
                delegate: Rectangle {
                  required property var modelData
                  Layout.preferredHeight: 26
                  Layout.preferredWidth: qModText.implicitWidth + 14
                  radius: 6
                  color: root.bgElevated
                  border.color: root.borderSubtle
                  border.width: 1

                  Text {
                    id: qModText
                    anchors.centerIn: parent
                    text: modelData
                    color: root.fgMain
                    font.pixelSize: 11
                  }

                  MouseArea {
                    anchors.fill: parent
                    cursorShape: Qt.PointingHandCursor
                    onClicked: {
                      if (root.shortcutInput.indexOf(modelData) === -1) {
                        root.shortcutInput = modelData + root.shortcutInput
                      }
                    }
                  }
                }
              }
            }

            Item { Layout.fillHeight: true }

            RowLayout {
              Layout.fillWidth: true
              Button {
                text: "Clear Shortcut"
                onClicked: root.clearShortcut()
              }
              Item { Layout.fillWidth: true }
              Button {
                text: "Cancel"
                onClicked: root.shortcutDialogOpen = false
              }
              Button {
                text: "Save & Apply"
                highlighted: true
                onClicked: root.saveShortcut()
              }
            }
          }
        }
      }

      // 2. Bar Section Selector Modal
      Rectangle {
        anchors.fill: parent
        color: Qt.rgba(0, 0, 0, 0.8)
        visible: root.barSectionDialogOpen

        MouseArea { anchors.fill: parent; onClicked: root.barSectionDialogOpen = false }

        Rectangle {
          anchors.centerIn: parent
          width: 440
          height: 230
          radius: 16
          color: root.bgSurface
          border.color: root.borderActive
          border.width: 1

          MouseArea { anchors.fill: parent }

          ColumnLayout {
            anchors.fill: parent
            anchors.margins: 22
            spacing: 14

            RowLayout {
              spacing: 8
              Text {
                text: root.nf(root.ic.pin)
                color: root.accent
                font.family: root.nfFontFamily
                font.pixelSize: 17
              }
              Text {
                text: "Pin to Omarchy Top Bar"
                color: root.fgMain
                font.pixelSize: 16
                font.bold: true
              }
            }

            Text {
              text: "Choose which section of the top bar to place '" + (root.barTargetPlugin ? (root.barTargetPlugin.name || root.barTargetPlugin.id) : "") + "':"
              color: root.fgMuted
              font.pixelSize: 12
            }

            RowLayout {
              Layout.fillWidth: true
              spacing: 10

              Button {
                Layout.fillWidth: true
                text: root.nf(root.ic.arrowLeft) + " Left"
                font.family: root.nfFontFamily
                onClicked: root.addPluginToBar(root.barTargetPlugin, "left")
              }
              Button {
                Layout.fillWidth: true
                text: "Center"
                onClicked: root.addPluginToBar(root.barTargetPlugin, "center")
              }
              Button {
                Layout.fillWidth: true
                text: "Right " + root.nf(root.ic.arrowRight)
                font.family: root.nfFontFamily
                highlighted: true
                onClicked: root.addPluginToBar(root.barTargetPlugin, "right")
              }
            }

            Item { Layout.fillHeight: true }

            RowLayout {
              Layout.fillWidth: true
              Item { Layout.fillWidth: true }
              Button {
                text: "Cancel"
                onClicked: root.barSectionDialogOpen = false
              }
            }
          }
        }
      }

      // 3. Git URL Dialog Modal
      Rectangle {
        anchors.fill: parent
        color: Qt.rgba(0, 0, 0, 0.8)
        visible: root.urlDialogOpen

        MouseArea { anchors.fill: parent; onClicked: root.urlDialogOpen = false }

        Rectangle {
          anchors.centerIn: parent
          width: 480
          height: 210
          radius: 16
          color: root.bgSurface
          border.color: root.borderActive
          border.width: 1

          MouseArea { anchors.fill: parent }

          ColumnLayout {
            anchors.fill: parent
            anchors.margins: 22
            spacing: 14

            Text {
              text: "Install from Git Repository"
              color: root.fgMain
              font.pixelSize: 16
              font.bold: true
            }

            Rectangle {
              Layout.fillWidth: true
              Layout.preferredHeight: 40
              radius: 10
              color: root.bgBase
              border.color: root.accent
              border.width: 1

              TextInput {
                anchors.fill: parent
                anchors.margins: 10
                text: root.urlInput
                color: root.fgMain
                font.pixelSize: 13
                selectByMouse: true
                onTextChanged: root.urlInput = text
                Text {
                  text: "https://github.com/author/plugin.git"
                  color: root.fgDim
                  font.pixelSize: 13
                  visible: !parent.text
                }
              }
            }

            RowLayout {
              Layout.fillWidth: true
              Item { Layout.fillWidth: true }
              Button {
                text: "Cancel"
                onClicked: root.urlDialogOpen = false
              }
              Button {
                text: "Install & Enable"
                highlighted: true
                onClicked: root.installFromUrl(root.urlInput)
              }
            }
          }
        }
      }

      // 4. Confirm Uninstall Modal
      Rectangle {
        anchors.fill: parent
        color: Qt.rgba(0, 0, 0, 0.8)
        visible: root.confirmUninstallOpen

        MouseArea { anchors.fill: parent; onClicked: root.confirmUninstallOpen = false }

        Rectangle {
          anchors.centerIn: parent
          width: 420
          height: 180
          radius: 16
          color: root.bgSurface
          border.color: root.redDanger
          border.width: 1

          MouseArea { anchors.fill: parent }

          ColumnLayout {
            anchors.fill: parent
            anchors.margins: 22
            spacing: 12

            Text {
              text: "Uninstall Plugin"
              color: root.redDanger
              font.pixelSize: 16
              font.bold: true
            }

            Text {
              text: "Are you sure you want to completely remove '" + (root.pendingUninstallPlugin ? (root.pendingUninstallPlugin.name || root.pendingUninstallPlugin.id) : "") + "'?"
              color: root.fgMain
              font.pixelSize: 12
            }

            RowLayout {
              Layout.fillWidth: true
              Item { Layout.fillWidth: true }
              Button {
                text: "Cancel"
                onClicked: root.confirmUninstallOpen = false
              }
              Button {
                text: "Remove Plugin"
                highlighted: true
                onClicked: root.executeUninstall()
              }
            }
          }
        }
      }

      // 5. Restart Shell Modal
      Rectangle {
        anchors.fill: parent
        color: Qt.rgba(0, 0, 0, 0.8)
        visible: root.restartDialogOpen

        MouseArea { anchors.fill: parent; onClicked: root.restartDialogOpen = false }

        Rectangle {
          anchors.centerIn: parent
          width: 420
          height: 180
          radius: 16
          color: root.bgSurface
          border.color: root.borderActive
          border.width: 1

          MouseArea { anchors.fill: parent }

          ColumnLayout {
            anchors.fill: parent
            anchors.margins: 22
            spacing: 12

            RowLayout {
              spacing: 8
              Text {
                text: root.nf(root.ic.bolt)
                color: root.amberWarn
                font.family: root.nfFontFamily
                font.pixelSize: 17
              }
              Text {
                text: "Restart Quickshell"
                color: root.fgMain
                font.pixelSize: 16
                font.bold: true
              }
            }

            Text {
              text: "Restart the Omarchy desktop shell to reload all widgets and panels?"
              color: root.fgMuted
              font.pixelSize: 12
            }

            RowLayout {
              Layout.fillWidth: true
              Item { Layout.fillWidth: true }
              Button {
                text: "Cancel"
                onClicked: root.restartDialogOpen = false
              }
              Button {
                text: "Restart Shell"
                highlighted: true
                onClicked: root.restartShell()
              }
            }
          }
        }
      }
    }
  }
}