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
|
pragma Singleton
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Wayland
import qs.Common
Singleton {
id: root
property var controlCenterPopout: null
property var controlCenterLoader: null
property var notificationCenterPopout: null
property var notificationCenterLoader: null
property var appDrawerPopout: null
property var appDrawerLoader: null
property var processListPopout: null
property var processListPopoutLoader: null
property var dankDashPopout: null
property var dankDashPopoutLoader: null
property var batteryPopout: null
property var batteryPopoutLoader: null
property var vpnPopout: null
property var vpnPopoutLoader: null
property var systemUpdatePopout: null
property var systemUpdateLoader: null
property var layoutPopout: null
property var layoutPopoutLoader: null
property var clipboardHistoryPopout: null
property var clipboardHistoryPopoutLoader: null
property var settingsModal: null
property var settingsModalLoader: null
property var clipboardHistoryModal: null
property var dankLauncherV2Modal: null
property var dankLauncherV2ModalLoader: null
property var powerMenuModal: null
property var processListModal: null
property var processListModalLoader: null
property var colorPickerModal: null
property var notificationModal: null
property var wifiPasswordModal: null
property var wifiPasswordModalLoader: null
property var wifiQRCodeModal: null
property var wifiQRCodeModalLoader: null
property var polkitAuthModal: null
property var polkitAuthModalLoader: null
property var bluetoothPairingModal: null
property var networkInfoModal: null
property var windowRuleModalLoader: null
property var notepadSlideouts: []
property string pendingThemeInstall: ""
property string pendingPluginInstall: ""
function setPosition(popout, x, y, width, section, screen) {
if (popout && popout.setTriggerPosition && arguments.length >= 6) {
popout.setTriggerPosition(x, y, width, section, screen);
}
}
function openControlCenter(x, y, width, section, screen) {
if (controlCenterPopout) {
setPosition(controlCenterPopout, x, y, width, section, screen);
controlCenterPopout.open();
}
}
function closeControlCenter() {
controlCenterPopout?.close();
}
function unloadControlCenter() {
if (!controlCenterLoader)
return;
controlCenterPopout = null;
controlCenterLoader.active = false;
}
function toggleControlCenter(x, y, width, section, screen) {
if (controlCenterPopout) {
setPosition(controlCenterPopout, x, y, width, section, screen);
controlCenterPopout.toggle();
}
}
function openNotificationCenter(x, y, width, section, screen) {
if (notificationCenterPopout) {
setPosition(notificationCenterPopout, x, y, width, section, screen);
notificationCenterPopout.open();
}
}
function closeNotificationCenter() {
notificationCenterPopout?.close();
}
function unloadNotificationCenter() {
if (!notificationCenterLoader)
return;
notificationCenterPopout = null;
notificationCenterLoader.active = false;
}
function toggleNotificationCenter(x, y, width, section, screen) {
if (notificationCenterPopout) {
setPosition(notificationCenterPopout, x, y, width, section, screen);
notificationCenterPopout.toggle();
}
}
function openAppDrawer(x, y, width, section, screen) {
if (appDrawerPopout) {
setPosition(appDrawerPopout, x, y, width, section, screen);
appDrawerPopout.open();
}
}
function closeAppDrawer() {
appDrawerPopout?.close();
}
function unloadAppDrawer() {
if (!appDrawerLoader)
return;
appDrawerPopout = null;
appDrawerLoader.active = false;
}
function toggleAppDrawer(x, y, width, section, screen) {
if (appDrawerPopout) {
setPosition(appDrawerPopout, x, y, width, section, screen);
appDrawerPopout.toggle();
}
}
function openProcessList(x, y, width, section, screen) {
if (processListPopout) {
setPosition(processListPopout, x, y, width, section, screen);
processListPopout.open();
}
}
function closeProcessList() {
processListPopout?.close();
}
function unloadProcessListPopout() {
if (!processListPopoutLoader)
return;
processListPopout = null;
processListPopoutLoader.active = false;
}
function toggleProcessList(x, y, width, section, screen) {
if (processListPopout) {
setPosition(processListPopout, x, y, width, section, screen);
processListPopout.toggle();
}
}
property bool _dankDashWantsOpen: false
property bool _dankDashWantsToggle: false
property int _dankDashPendingTab: 0
property real _dankDashPendingX: 0
property real _dankDashPendingY: 0
property real _dankDashPendingWidth: 0
property string _dankDashPendingSection: ""
property var _dankDashPendingScreen: null
property bool _dankDashHasPosition: false
function _storeDankDashPosition(x, y, width, section, screen, hasPos) {
_dankDashPendingX = x;
_dankDashPendingY = y;
_dankDashPendingWidth = width;
_dankDashPendingSection = section;
_dankDashPendingScreen = screen;
_dankDashHasPosition = hasPos;
}
function openDankDash(tabIndex, x, y, width, section, screen) {
_dankDashPendingTab = tabIndex || 0;
if (dankDashPopout) {
if (arguments.length >= 6)
setPosition(dankDashPopout, x, y, width, section, screen);
dankDashPopout.currentTabIndex = _dankDashPendingTab;
dankDashPopout.dashVisible = true;
return;
}
if (!dankDashPopoutLoader)
return;
_storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6);
_dankDashWantsOpen = true;
_dankDashWantsToggle = false;
dankDashPopoutLoader.active = true;
}
function closeDankDash() {
if (dankDashPopout)
dankDashPopout.dashVisible = false;
}
function unloadDankDash() {
if (!dankDashPopoutLoader)
return;
dankDashPopout = null;
dankDashPopoutLoader.active = false;
}
function toggleDankDash(tabIndex, x, y, width, section, screen) {
_dankDashPendingTab = tabIndex || 0;
if (dankDashPopout) {
if (arguments.length >= 6)
setPosition(dankDashPopout, x, y, width, section, screen);
if (dankDashPopout.dashVisible) {
dankDashPopout.dashVisible = false;
} else {
dankDashPopout.currentTabIndex = _dankDashPendingTab;
dankDashPopout.dashVisible = true;
}
return;
}
if (!dankDashPopoutLoader)
return;
_storeDankDashPosition(x, y, width, section, screen, arguments.length >= 6);
_dankDashWantsToggle = true;
_dankDashWantsOpen = false;
dankDashPopoutLoader.active = true;
}
function _onDankDashPopoutLoaded() {
if (!dankDashPopout)
return;
if (_dankDashHasPosition)
setPosition(dankDashPopout, _dankDashPendingX, _dankDashPendingY, _dankDashPendingWidth, _dankDashPendingSection, _dankDashPendingScreen);
if (_dankDashWantsOpen) {
_dankDashWantsOpen = false;
dankDashPopout.currentTabIndex = _dankDashPendingTab;
dankDashPopout.dashVisible = true;
return;
}
if (_dankDashWantsToggle) {
_dankDashWantsToggle = false;
if (dankDashPopout.dashVisible) {
dankDashPopout.dashVisible = false;
} else {
dankDashPopout.currentTabIndex = _dankDashPendingTab;
dankDashPopout.dashVisible = true;
}
}
}
function openBattery(x, y, width, section, screen) {
if (batteryPopout) {
setPosition(batteryPopout, x, y, width, section, screen);
batteryPopout.open();
}
}
function closeBattery() {
batteryPopout?.close();
}
function unloadBattery() {
if (!batteryPopoutLoader)
return;
batteryPopout = null;
batteryPopoutLoader.active = false;
}
function toggleBattery(x, y, width, section, screen) {
if (batteryPopout) {
setPosition(batteryPopout, x, y, width, section, screen);
batteryPopout.toggle();
}
}
function openVpn(x, y, width, section, screen) {
if (vpnPopout) {
setPosition(vpnPopout, x, y, width, section, screen);
vpnPopout.open();
}
}
function closeVpn() {
vpnPopout?.close();
}
function unloadVpn() {
if (!vpnPopoutLoader)
return;
vpnPopout = null;
vpnPopoutLoader.active = false;
}
function toggleVpn(x, y, width, section, screen) {
if (vpnPopout) {
setPosition(vpnPopout, x, y, width, section, screen);
vpnPopout.toggle();
}
}
function openSystemUpdate(x, y, width, section, screen) {
if (systemUpdatePopout) {
setPosition(systemUpdatePopout, x, y, width, section, screen);
systemUpdatePopout.open();
}
}
function closeSystemUpdate() {
systemUpdatePopout?.close();
}
function unloadSystemUpdate() {
if (!systemUpdateLoader)
return;
systemUpdatePopout = null;
systemUpdateLoader.active = false;
}
function toggleSystemUpdate(x, y, width, section, screen) {
if (systemUpdatePopout) {
setPosition(systemUpdatePopout, x, y, width, section, screen);
systemUpdatePopout.toggle();
}
}
property bool _settingsWantsOpen: false
property bool _settingsWantsToggle: false
property string _settingsPendingTab: ""
property int _settingsPendingTabIndex: -1
function openSettings() {
if (settingsModal) {
settingsModal.show();
} else if (settingsModalLoader) {
_settingsWantsOpen = true;
_settingsWantsToggle = false;
settingsModalLoader.activeAsync = true;
}
}
function openSettingsWithTab(tabName: string) {
if (settingsModal) {
settingsModal.showWithTabName(tabName);
return;
}
if (settingsModalLoader) {
_settingsPendingTab = tabName;
_settingsWantsOpen = true;
_settingsWantsToggle = false;
settingsModalLoader.activeAsync = true;
}
}
function openSettingsWithTabIndex(tabIndex: int) {
if (settingsModal) {
settingsModal.showWithTab(tabIndex);
return;
}
if (settingsModalLoader) {
_settingsPendingTabIndex = tabIndex;
_settingsWantsOpen = true;
_settingsWantsToggle = false;
settingsModalLoader.activeAsync = true;
}
}
function closeSettings() {
settingsModal?.close();
}
function toggleSettings() {
if (settingsModal) {
settingsModal.toggle();
} else if (settingsModalLoader) {
_settingsWantsToggle = true;
_settingsWantsOpen = false;
settingsModalLoader.activeAsync = true;
}
}
function toggleSettingsWithTab(tabName: string) {
if (settingsModal) {
var idx = settingsModal.resolveTabIndex(tabName);
if (idx >= 0)
settingsModal.currentTabIndex = idx;
settingsModal.toggle();
return;
}
if (settingsModalLoader) {
_settingsPendingTab = tabName;
_settingsWantsToggle = true;
_settingsWantsOpen = false;
settingsModalLoader.activeAsync = true;
}
}
function focusOrToggleSettings() {
if (settingsModal?.visible) {
const settingsTitle = I18n.tr("Settings", "settings window title");
for (const toplevel of ToplevelManager.toplevels.values) {
if (toplevel.title !== "Settings" && toplevel.title !== settingsTitle)
continue;
if (toplevel.activated) {
settingsModal.hide();
return;
}
toplevel.activate();
return;
}
}
openSettings();
}
function focusOrToggleSettingsWithTab(tabName: string) {
if (settingsModal?.visible) {
const settingsTitle = I18n.tr("Settings", "settings window title");
for (const toplevel of ToplevelManager.toplevels.values) {
if (toplevel.title !== "Settings" && toplevel.title !== settingsTitle)
continue;
if (toplevel.activated) {
settingsModal.hide();
return;
}
var idx = settingsModal.resolveTabIndex(tabName);
if (idx >= 0)
settingsModal.currentTabIndex = idx;
toplevel.activate();
return;
}
}
openSettingsWithTab(tabName);
}
function unloadSettings() {
if (settingsModalLoader) {
settingsModal = null;
settingsModalLoader.active = false;
}
}
function _onSettingsModalLoaded() {
if (_settingsWantsOpen) {
_settingsWantsOpen = false;
if (_settingsPendingTabIndex >= 0) {
settingsModal?.showWithTab(_settingsPendingTabIndex);
_settingsPendingTabIndex = -1;
} else if (_settingsPendingTab) {
settingsModal?.showWithTabName(_settingsPendingTab);
_settingsPendingTab = "";
} else {
settingsModal?.show();
}
return;
}
if (_settingsWantsToggle) {
_settingsWantsToggle = false;
if (_settingsPendingTabIndex >= 0) {
settingsModal.currentTabIndex = _settingsPendingTabIndex;
_settingsPendingTabIndex = -1;
} else if (_settingsPendingTab) {
var idx = settingsModal?.resolveTabIndex(_settingsPendingTab) ?? -1;
if (idx >= 0)
settingsModal.currentTabIndex = idx;
_settingsPendingTab = "";
}
settingsModal?.toggle();
}
}
function openClipboardHistory() {
clipboardHistoryModal?.show();
}
function closeClipboardHistory() {
clipboardHistoryModal?.close();
}
function unloadClipboardHistoryPopout() {
if (!clipboardHistoryPopoutLoader)
return;
clipboardHistoryPopout = null;
clipboardHistoryPopoutLoader.active = false;
}
function unloadLayoutPopout() {
if (!layoutPopoutLoader)
return;
layoutPopout = null;
layoutPopoutLoader.active = false;
}
property bool _dankLauncherV2WantsOpen: false
property bool _dankLauncherV2WantsToggle: false
property string _dankLauncherV2PendingQuery: ""
property string _dankLauncherV2PendingMode: ""
function openDankLauncherV2() {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.show();
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2WantsOpen = true;
_dankLauncherV2WantsToggle = false;
dankLauncherV2ModalLoader.active = true;
}
}
function openDankLauncherV2WithQuery(query: string) {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.showWithQuery(query);
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2PendingQuery = query;
_dankLauncherV2WantsOpen = true;
_dankLauncherV2WantsToggle = false;
dankLauncherV2ModalLoader.active = true;
}
}
function openDankLauncherV2WithMode(mode: string) {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.showWithMode(mode);
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2PendingMode = mode;
_dankLauncherV2WantsOpen = true;
_dankLauncherV2WantsToggle = false;
dankLauncherV2ModalLoader.active = true;
}
}
function closeDankLauncherV2() {
dankLauncherV2Modal?.hide();
}
function unloadDankLauncherV2() {
if (dankLauncherV2ModalLoader) {
dankLauncherV2Modal = null;
dankLauncherV2ModalLoader.active = false;
}
}
function toggleDankLauncherV2() {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.toggle();
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2WantsToggle = true;
_dankLauncherV2WantsOpen = false;
dankLauncherV2ModalLoader.active = true;
}
}
function toggleDankLauncherV2WithMode(mode: string) {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.toggleWithMode(mode);
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2PendingMode = mode;
_dankLauncherV2WantsToggle = true;
_dankLauncherV2WantsOpen = false;
dankLauncherV2ModalLoader.active = true;
}
}
function toggleDankLauncherV2WithQuery(query: string) {
if (dankLauncherV2Modal) {
dankLauncherV2Modal.toggleWithQuery(query);
} else if (dankLauncherV2ModalLoader) {
_dankLauncherV2PendingQuery = query;
_dankLauncherV2WantsOpen = true;
_dankLauncherV2WantsToggle = false;
dankLauncherV2ModalLoader.active = true;
}
}
function _onDankLauncherV2ModalLoaded() {
if (_dankLauncherV2WantsOpen) {
_dankLauncherV2WantsOpen = false;
if (_dankLauncherV2PendingQuery) {
dankLauncherV2Modal?.showWithQuery(_dankLauncherV2PendingQuery);
_dankLauncherV2PendingQuery = "";
} else if (_dankLauncherV2PendingMode) {
dankLauncherV2Modal?.showWithMode(_dankLauncherV2PendingMode);
_dankLauncherV2PendingMode = "";
} else {
dankLauncherV2Modal?.show();
}
return;
}
if (_dankLauncherV2WantsToggle) {
_dankLauncherV2WantsToggle = false;
if (_dankLauncherV2PendingMode) {
dankLauncherV2Modal?.toggleWithMode(_dankLauncherV2PendingMode);
_dankLauncherV2PendingMode = "";
} else {
dankLauncherV2Modal?.toggle();
}
}
}
function openPowerMenu() {
powerMenuModal?.openCentered();
}
function closePowerMenu() {
powerMenuModal?.close();
}
function togglePowerMenu() {
if (powerMenuModal) {
if (powerMenuModal.shouldBeVisible) {
powerMenuModal.close();
} else {
powerMenuModal.openCentered();
}
}
}
function showProcessListModal() {
if (processListModal) {
processListModal.show();
} else if (processListModalLoader) {
processListModalLoader.active = true;
Qt.callLater(() => processListModal?.show());
}
}
function hideProcessListModal() {
processListModal?.hide();
}
function toggleProcessListModal() {
if (processListModal) {
processListModal.toggle();
} else if (processListModalLoader) {
processListModalLoader.active = true;
Qt.callLater(() => processListModal?.show());
}
}
function showColorPicker() {
colorPickerModal?.show();
}
function hideColorPicker() {
colorPickerModal?.close();
}
function showNotificationModal() {
notificationModal?.show();
}
function hideNotificationModal() {
notificationModal?.close();
}
function showWifiPasswordModal(ssid) {
if (wifiPasswordModalLoader)
wifiPasswordModalLoader.active = true;
if (wifiPasswordModal)
wifiPasswordModal.show(ssid);
}
function showWifiQRCodeModal(ssid) {
if (wifiQRCodeModalLoader)
wifiQRCodeModalLoader.active = true;
if (wifiQRCodeModal)
wifiQRCodeModal.show(ssid);
}
function showHiddenNetworkModal() {
if (wifiPasswordModalLoader)
wifiPasswordModalLoader.active = true;
if (wifiPasswordModal)
wifiPasswordModal.showHidden();
}
function hideWifiPasswordModal() {
wifiPasswordModal?.hide();
}
function showNetworkInfoModal() {
networkInfoModal?.show();
}
function hideNetworkInfoModal() {
networkInfoModal?.close();
}
function openNotepad() {
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.show();
}
}
function closeNotepad() {
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.hide();
}
}
function toggleNotepad() {
if (notepadSlideouts.length > 0) {
notepadSlideouts[0]?.toggle();
}
}
}
|