Repository navigation
Expand file tree
/
Copy pathEditKeybindDialog.qml
More file actions
1578 lines (1407 loc) · 60.7 KB
/
Copy pathEditKeybindDialog.qml
File metadata and controls
1578 lines (1407 loc) · 60.7 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
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import qs.Commons
import qs.Ui
// Modal dialog for adding or modifying a keybinding
// Features an ergonomic, polished Smart Action Builder:
// - Unified Segmented Tab Bar (Apps, Window, Workspace, System, Custom)
// - 🚀 Launch App: Searchable list of installed apps (.desktop) with text truncation & terminal toggle
// - 🪟 Window Control: Grouped window actions + interactive Directional D-Pad (Focus & Swap)
// - 📑 Workspaces: Symmetrical Number Bar (1-10) + Relative/Special chips
// - ⚡ System & Audio: Categorized sub-sections (Audio, Display, Menus)
// - 💻 Custom Script: Freeform editor with quick syntax chips & tip box
// - Visual Selection Highlights (accent glow + checkmarks on all active chips)
// - Dedicated Configured Action confirmation banner
// - Smart Suggested Free Shortcuts & live conflict detection
Item {
id: root
property bool opened: false
property bool isEditing: false
property var itemData: null
property var allBindings: []
property var catalog: []
property var apps: []
property string actionTitle: ""
property string actionCommand: ""
property string actionDispatcher: ""
property string actionCategory: "Applications"
property string actionKey: ""
property string oldKey: ""
property string actionType: "app" // "app" | "window" | "workspace" | "system" | "custom"
// Builder state & selection tracking
property string selectedActionId: ""
property bool runInTerminal: false
property string appSearchQuery: ""
property string windowNavMode: "focus" // "focus" | "swap"
property string workspaceSubAction: "switch" // "switch" | "move" | "silent"
property string workspaceTarget: ""
property color background: Color.background
property color foreground: Color.foreground
property color accent: Color.accent
property color urgent: Color.urgent
signal saved(string key, string description, string command, string action, string oldKey, bool overrideConflict)
signal canceled()
// Filtered Installed Applications
readonly property var filteredApps: {
var list = root.apps || []
var q = (root.appSearchQuery || "").trim().toLowerCase()
if (!q) return list.slice(0, 36)
var out = []
for (var i = 0; i < list.length; i++) {
var a = list[i]
if (a.name.toLowerCase().indexOf(q) !== -1 ||
(a.comment && a.comment.toLowerCase().indexOf(q) !== -1) ||
a.exec.toLowerCase().indexOf(q) !== -1) {
out.push(a)
if (out.length >= 36) break
}
}
return out
}
// Smart Suggested Free Combinations
readonly property var suggestedKeys: {
var bound = {}
if (root.allBindings) {
for (var i = 0; i < root.allBindings.length; i++) {
var b = root.allBindings[i]
if (b && b.status !== "disabled" && b.key) {
bound[b.key.toUpperCase()] = true
}
}
}
var firstLetter = ""
if (root.actionTitle && root.actionTitle.trim().length > 0) {
var cleanTitle = root.actionTitle.trim()
for (var j = 0; j < cleanTitle.length; j++) {
var ch = cleanTitle.charAt(j).toUpperCase()
if (ch >= 'A' && ch <= 'Z') {
firstLetter = ch
break
}
}
}
var candidates = []
if (firstLetter) {
candidates.push("SUPER + " + firstLetter)
candidates.push("SUPER + ALT + " + firstLetter)
candidates.push("SUPER + SHIFT + " + firstLetter)
candidates.push("SUPER + CTRL + " + firstLetter)
}
var letters = ["B", "D", "E", "H", "M", "N", "R", "T", "U", "Y", "Z", "A", "C", "F", "K", "L", "P", "Q", "S", "W"]
for (var k = 0; k < letters.length; k++) {
var l = letters[k]
if (l !== firstLetter) {
candidates.push("SUPER + " + l)
candidates.push("SUPER + ALT + " + l)
candidates.push("SUPER + SHIFT + " + l)
candidates.push("SUPER + CTRL + " + l)
}
}
var suggestions = []
for (var c = 0; c < candidates.length; c++) {
var chord = candidates[c]
if (!bound[chord.toUpperCase()] && suggestions.indexOf(chord) === -1) {
if (chord.toUpperCase() !== root.actionKey.toUpperCase()) {
suggestions.push(chord)
if (suggestions.length >= 4) break
}
}
}
return suggestions
}
function openCreate(presetItem) {
root.isEditing = false
root.itemData = presetItem || null
root.oldKey = ""
root.runInTerminal = false
root.appSearchQuery = ""
root.workspaceSubAction = "switch"
root.workspaceTarget = ""
root.windowNavMode = "focus"
if (presetItem) {
root.actionTitle = presetItem.name || presetItem.description || ""
// Show what will actually be stored: for window/workspace presets that is
// the Lua dispatcher (the pre-Lua `hyprctl dispatch ...` command string is
// display-only metadata and would be a dead binding if saved).
var presetDispatcher = presetItem.dispatcher || ""
root.actionCommand = presetDispatcher.indexOf("hl.") === 0 ? presetDispatcher : (presetItem.command || "")
root.actionDispatcher = presetDispatcher
root.actionCategory = presetItem.category || "General"
root.actionKey = presetItem.default_key || ""
root.selectedActionId = presetItem.id || presetItem.name
if (presetItem.category === "Workspaces") {
root.actionType = "workspace"
} else if (presetItem.category === "Window Management") {
root.actionType = "window"
} else if (presetItem.category === "Media & Audio" || presetItem.category === "Menus & System") {
root.actionType = "system"
} else {
root.actionType = "app"
}
} else {
root.actionTitle = ""
root.actionCommand = ""
root.actionDispatcher = ""
root.actionCategory = "Applications"
root.actionKey = ""
root.selectedActionId = ""
root.actionType = "app"
}
keyRecorder.value = root.actionKey
root.opened = true
}
function openEdit(bindingItem) {
root.isEditing = true
root.itemData = bindingItem || null
root.actionTitle = (bindingItem && bindingItem.description) || ""
root.actionCommand = (bindingItem && (bindingItem.command || bindingItem.action)) || ""
root.actionDispatcher = (bindingItem && bindingItem.action) || ""
root.actionCategory = (bindingItem && bindingItem.category) || "Custom"
root.actionKey = (bindingItem && bindingItem.key) || ""
root.oldKey = (bindingItem && bindingItem.key) || ""
root.actionType = "custom"
root.selectedActionId = "custom"
root.runInTerminal = false
root.appSearchQuery = ""
keyRecorder.value = root.actionKey
root.opened = true
}
function selectApp(app) {
if (!app) return
root.selectedActionId = "app:" + app.name
root.actionTitle = app.name
var needsTerminal = app.terminal || root.runInTerminal
root.runInTerminal = needsTerminal
var cmd = app.exec || ""
if (needsTerminal && !cmd.startsWith("ghostty -e ")) {
cmd = "ghostty -e " + cmd
}
root.actionCommand = cmd
root.actionDispatcher = "exec"
root.actionCategory = "Applications"
}
function selectWindowAction(name, cmd, dsp, defKey) {
root.selectedActionId = "win:" + name
root.actionTitle = name
root.actionCommand = cmd
root.actionDispatcher = dsp
root.actionCategory = "Window Management"
if (!keyRecorder.value && defKey) {
keyRecorder.value = defKey
root.actionKey = defKey
}
}
function selectDirectional(mode, dir, defKey) {
var dirName = dir === "l" ? "Left" : (dir === "r" ? "Right" : (dir === "u" ? "Up" : "Down"))
root.selectedActionId = "dir:" + mode + ":" + dir
if (mode === "focus") {
root.actionTitle = "Focus Window " + dirName
root.actionCommand = "hyprctl dispatch movefocus " + dir
root.actionDispatcher = 'hl.dsp.focus({ direction = "' + dir + '" })'
} else {
root.actionTitle = "Swap Window " + dirName
root.actionCommand = "hyprctl dispatch swapwindow " + dir
root.actionDispatcher = 'hl.dsp.window.swap({ direction = "' + dir + '" })'
}
root.actionCategory = "Window Management"
if (!keyRecorder.value && defKey) {
keyRecorder.value = defKey
root.actionKey = defKey
}
}
function selectWorkspace(target) {
var mode = root.workspaceSubAction
var isSpecial = (target === "Scratchpad")
root.workspaceTarget = target
root.selectedActionId = "ws:" + mode + ":" + target
if (mode === "switch") {
if (isSpecial) {
root.actionTitle = "Toggle Scratchpad"
root.actionCommand = "hyprctl dispatch togglespecialworkspace scratchpad"
root.actionDispatcher = 'hl.dsp.workspace.toggle_special("scratchpad")'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + S"; root.actionKey = "SUPER + S" }
} else if (target === "e+1") {
root.actionTitle = "Next Workspace"
root.actionCommand = "hyprctl dispatch workspace e+1"
root.actionDispatcher = 'hl.dsp.focus({ workspace = "e+1" })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + TAB"; root.actionKey = "SUPER + TAB" }
} else if (target === "e-1") {
root.actionTitle = "Previous Workspace"
root.actionCommand = "hyprctl dispatch workspace e-1"
root.actionDispatcher = 'hl.dsp.focus({ workspace = "e-1" })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + TAB"; root.actionKey = "SUPER + SHIFT + TAB" }
} else {
root.actionTitle = "Switch to Workspace " + target
root.actionCommand = "hyprctl dispatch workspace " + target
root.actionDispatcher = 'hl.dsp.focus({ workspace = "' + target + '" })'
var num = parseInt(target) % 10
if (!keyRecorder.value) { keyRecorder.value = "SUPER + " + num; root.actionKey = "SUPER + " + num }
}
} else if (mode === "move") {
if (isSpecial) {
root.actionTitle = "Move Window to Scratchpad"
root.actionCommand = "hyprctl dispatch movetoworkspace special:scratchpad"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "special:scratchpad" })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + ALT + S"; root.actionKey = "SUPER + ALT + S" }
} else if (target === "e+1") {
root.actionTitle = "Move Window to Next Workspace"
root.actionCommand = "hyprctl dispatch movetoworkspace e+1"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "e+1" })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + RIGHT"; root.actionKey = "SUPER + SHIFT + RIGHT" }
} else if (target === "e-1") {
root.actionTitle = "Move Window to Previous Workspace"
root.actionCommand = "hyprctl dispatch movetoworkspace e-1"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "e-1" })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + LEFT"; root.actionKey = "SUPER + SHIFT + LEFT" }
} else {
root.actionTitle = "Move Window to Workspace " + target
root.actionCommand = "hyprctl dispatch movetoworkspace " + target
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "' + target + '" })'
var n = parseInt(target) % 10
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + " + n; root.actionKey = "SUPER + SHIFT + " + n }
}
} else if (mode === "silent") {
if (isSpecial) {
root.actionTitle = "Move Window to Scratchpad (Silent)"
root.actionCommand = "hyprctl dispatch movetoworkspacesilent special:scratchpad"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "special:scratchpad", follow = false })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + ALT + S"; root.actionKey = "SUPER + SHIFT + ALT + S" }
} else if (target === "e+1") {
root.actionTitle = "Move Window to Next Workspace (Silent)"
root.actionCommand = "hyprctl dispatch movetoworkspacesilent e+1"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "e+1", follow = false })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + ALT + RIGHT"; root.actionKey = "SUPER + SHIFT + ALT + RIGHT" }
} else if (target === "e-1") {
root.actionTitle = "Move Window to Previous Workspace (Silent)"
root.actionCommand = "hyprctl dispatch movetoworkspacesilent e-1"
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "e-1", follow = false })'
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + ALT + LEFT"; root.actionKey = "SUPER + SHIFT + ALT + LEFT" }
} else {
root.actionTitle = "Move Window to Workspace " + target + " (Silent)"
root.actionCommand = "hyprctl dispatch movetoworkspacesilent " + target
root.actionDispatcher = 'hl.dsp.window.move({ workspace = "' + target + '", follow = false })'
var ns = parseInt(target) % 10
if (!keyRecorder.value) { keyRecorder.value = "SUPER + SHIFT + ALT + " + ns; root.actionKey = "SUPER + SHIFT + ALT + " + ns }
}
}
root.actionCategory = "Workspaces"
}
function selectSystemAction(name, cmd, defKey) {
root.selectedActionId = "sys:" + name
root.actionTitle = name
root.actionCommand = cmd
root.actionDispatcher = "exec"
root.actionCategory = "Media & Audio"
if (!keyRecorder.value && defKey) {
keyRecorder.value = defKey
root.actionKey = defKey
}
}
function appendDispatcher(snippet) {
// Dispatcher chips insert Lua dispatchers. Under a Lua config Hyprland
// evaluates a dispatch argument as Lua, so the old `hyprctl dispatch foo`
// strings come out dead; a Lua expression also replaces the field instead
// of appending, because "hl.dsp.focus(...) extra" is not a dispatcher.
if (snippet.indexOf("hl.") === 0) {
root.actionCommand = snippet
root.actionDispatcher = snippet
return
}
if (!root.actionCommand || root.actionCommand.trim().length === 0) {
root.actionCommand = snippet
} else {
root.actionCommand = root.actionCommand.trim() + " " + snippet
}
}
function close() {
root.opened = false
keyRecorder.stopRecording()
root.canceled()
}
onOpenedChanged: {
if (!opened) {
keyRecorder.stopRecording()
}
}
visible: opened
// Scrim backdrop
Rectangle {
anchors.fill: parent
color: Util.alpha(root.background, 0.88)
MouseArea {
anchors.fill: parent
onClicked: root.close()
}
// Modal Card
BorderSurface {
id: card
width: Math.min(parent.width - Style.space(32), Style.space(720))
implicitHeight: Math.min(parent.height - Style.space(32), cardLayout.implicitHeight + card.contentTopInset + card.contentBottomInset)
anchors.centerIn: parent
color: root.background
borderSpec: Border.flat(Util.alpha(root.foreground, 0.25), 1)
radius: Style.cornerRadius
padding: Style.space(24)
MouseArea {
anchors.fill: parent
onClicked: {} // Swallow clicks inside modal
}
ColumnLayout {
id: cardLayout
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: card.contentTopInset
anchors.leftMargin: card.contentLeftInset
anchors.rightMargin: card.contentRightInset
spacing: Style.space(12)
// 1. Header
RowLayout {
Layout.fillWidth: true
spacing: Style.space(14)
Text {
textFormat: Text.PlainText
text: ""
color: root.accent
font.family: Style.font.family
font.pixelSize: Style.font.title + 6
}
ColumnLayout {
Layout.fillWidth: true
spacing: Style.space(2)
Text {
textFormat: Text.PlainText
text: root.isEditing ? "Edit Keybinding" : "Create Keybinding"
color: root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.title
font.bold: true
}
Text {
textFormat: Text.PlainText
text: root.isEditing
? "Update the shortcut chord or command parameters below."
: "Select an action below — command & dispatcher are configured automatically."
color: Util.alpha(root.foreground, 0.6)
font.family: Style.font.family
font.pixelSize: Style.font.caption
}
}
}
PanelSeparator { Layout.fillWidth: true }
// 2. Unified Segmented Tab Bar (When creating new)
BorderSurface {
visible: !root.isEditing
Layout.fillWidth: true
height: Style.space(38)
radius: Style.cornerRadius
color: Util.alpha(root.foreground, 0.04)
borderSpec: Border.flat(Util.alpha(root.foreground, 0.12), 1)
RowLayout {
anchors.fill: parent
anchors.margins: Style.space(3)
spacing: Style.space(3)
Repeater {
model: [
{ id: "app", label: "🚀 Launch App" },
{ id: "window", label: "🪟 Window Control" },
{ id: "workspace", label: "📑 Workspace" },
{ id: "system", label: "⚡ System & Audio" },
{ id: "custom", label: "💻 Custom Script" }
]
BorderSurface {
id: tabBtn
required property var modelData
Layout.fillWidth: true
Layout.fillHeight: true
radius: Style.cornerRadius - 2
color: root.actionType === modelData.id
? Util.alpha(root.accent, 0.28)
: (tabMouse.containsMouse ? Util.alpha(root.foreground, 0.08) : "transparent")
borderSpec: Border.flat(
root.actionType === modelData.id ? root.accent : "transparent",
root.actionType === modelData.id ? 1 : 0
)
MouseArea {
id: tabMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.actionType = tabBtn.modelData.id
}
Text {
anchors.centerIn: parent
textFormat: Text.PlainText
text: tabBtn.modelData.label
color: root.actionType === tabBtn.modelData.id ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: root.actionType === tabBtn.modelData.id
}
}
}
}
}
// 3. Structured Selection Panels
// --- PANEL 1: Launch Application ---
ColumnLayout {
visible: !root.isEditing && root.actionType === "app"
Layout.fillWidth: true
spacing: Style.space(8)
TextField {
id: appSearchInput
Layout.fillWidth: true
placeholderText: "Search installed apps (e.g. Firefox, Spotify, Ghostty)..."
text: root.appSearchQuery
onTextChanged: root.appSearchQuery = text
Button {
visible: root.appSearchQuery.length > 0
anchors.right: parent.right
anchors.rightMargin: Style.space(6)
anchors.verticalCenter: parent.verticalCenter
iconText: "✕"
horizontalPadding: Style.space(6)
verticalPadding: Style.space(2)
onClicked: {
root.appSearchQuery = ""
appSearchInput.text = ""
}
}
}
RowLayout {
Layout.fillWidth: true
Text {
textFormat: Text.PlainText
text: root.filteredApps.length + " apps found"
color: Util.alpha(root.foreground, 0.5)
font.family: Style.font.family
font.pixelSize: Style.font.caption - 1
}
Item { Layout.fillWidth: true }
BorderSurface {
id: termToggle
height: Style.space(26)
width: termToggleRow.implicitWidth + Style.space(16)
radius: Style.cornerRadius
color: root.runInTerminal ? Util.alpha(root.accent, 0.22) : Util.alpha(root.foreground, 0.05)
borderSpec: Border.flat(root.runInTerminal ? root.accent : Util.alpha(root.foreground, 0.18), 1)
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
root.runInTerminal = !root.runInTerminal
if (root.actionCommand) {
if (root.runInTerminal && !root.actionCommand.startsWith("ghostty -e ")) {
root.actionCommand = "ghostty -e " + root.actionCommand
} else if (!root.runInTerminal && root.actionCommand.startsWith("ghostty -e ")) {
root.actionCommand = root.actionCommand.replace("ghostty -e ", "")
}
}
}
}
RowLayout {
id: termToggleRow
anchors.centerIn: parent
spacing: Style.space(6)
Text {
textFormat: Text.PlainText
text: root.runInTerminal ? "☑" : "☐"
color: root.runInTerminal ? root.accent : root.foreground
font.pixelSize: Style.font.caption
}
Text {
textFormat: Text.PlainText
text: "Run in terminal ($TERMINAL -e)"
color: root.runInTerminal ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption - 1
font.bold: root.runInTerminal
}
}
}
}
// Scrollable App Chips with clean padding and text truncation
ScrollView {
id: appScrollView
Layout.fillWidth: true
Layout.preferredHeight: Style.space(120)
clip: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
Flow {
width: appScrollView.availableWidth
spacing: Style.space(6)
bottomPadding: Style.space(8)
Repeater {
model: root.filteredApps
BorderSurface {
id: appChip
required property var modelData
readonly property bool isSelected: root.selectedActionId === ("app:" + modelData.name) || root.actionTitle === modelData.name
height: Style.space(26)
width: Math.min(Style.space(210), appChipContent.implicitWidth + Style.space(16))
radius: Style.cornerRadius
color: isSelected
? Util.alpha(root.accent, 0.28)
: (appMouse.containsMouse ? Util.alpha(root.foreground, 0.12) : Util.alpha(root.foreground, 0.05))
borderSpec: Border.flat(
isSelected ? root.accent : Util.alpha(root.foreground, 0.18),
isSelected ? 1.5 : 1
)
MouseArea {
id: appMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.selectApp(appChip.modelData)
ToolTip.visible: appMouse.containsMouse
ToolTip.delay: 500
ToolTip.text: appChip.modelData.exec ? ("Command: " + appChip.modelData.exec) : appChip.modelData.name
}
RowLayout {
id: appChipContent
anchors.fill: parent
anchors.leftMargin: Style.space(8)
anchors.rightMargin: Style.space(8)
spacing: Style.space(4)
Text {
textFormat: Text.PlainText
text: appChip.isSelected ? "✓" : "🚀"
color: appChip.isSelected ? root.accent : root.foreground
font.pixelSize: Style.font.caption - 2
}
Text {
Layout.fillWidth: true
textFormat: Text.PlainText
text: appChip.modelData.name
color: appChip.isSelected ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: appChip.isSelected
elide: Text.ElideRight
maximumLineCount: 1
}
}
}
}
}
}
}
// --- PANEL 2: Window & Layout Controls ---
ColumnLayout {
visible: !root.isEditing && root.actionType === "window"
Layout.fillWidth: true
spacing: Style.space(8)
Text {
textFormat: Text.PlainText
text: "Window Actions:"
color: Util.alpha(root.foreground, 0.75)
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: true
}
Flow {
Layout.fillWidth: true
spacing: Style.space(6)
Repeater {
model: [
{ name: "Close Window", cmd: "hyprctl dispatch killactive", dsp: "hl.dsp.window.close()", key: "SUPER + W", icon: "✕" },
{ name: "Toggle Fullscreen", cmd: "hyprctl dispatch fullscreen", dsp: "hl.dsp.window.fullscreen()", key: "SUPER + F", icon: "⛶" },
{ name: "Toggle Floating", cmd: "hyprctl dispatch togglefloating", dsp: "hl.dsp.window.float({ action = \"toggle\" })", key: "SUPER + T", icon: "🪟" },
{ name: "Toggle Split", cmd: "hyprctl dispatch layoutmsg togglesplit", dsp: "hl.dsp.layout(\"togglesplit\")", key: "SUPER + J", icon: "⇄" },
{ name: "Pop Window Out (Pin)", cmd: "omarchy-hyprland-window-pop", dsp: "exec", key: "SUPER + O", icon: "📌" },
{ name: "Close All Windows", cmd: "omarchy-hyprland-window-close-all", dsp: "exec", key: "CTRL + ALT + DELETE", icon: "🗑️" },
{ name: "Toggle Transparency", cmd: "omarchy-hyprland-window-transparency-toggle", dsp: "exec", key: "SUPER + BACKSPACE", icon: "👻" },
{ name: "Toggle Gaps", cmd: "omarchy-hyprland-window-gaps-toggle", dsp: "exec", key: "SUPER + SHIFT + BACKSPACE", icon: "↔" }
]
BorderSurface {
id: winChip
required property var modelData
readonly property bool isSelected: root.selectedActionId === ("win:" + modelData.name) || root.actionTitle === modelData.name
height: Style.space(26)
width: winChipRow.implicitWidth + Style.space(16)
radius: Style.cornerRadius
color: isSelected
? Util.alpha(root.accent, 0.28)
: (winMouse.containsMouse ? Util.alpha(root.foreground, 0.12) : Util.alpha(root.foreground, 0.05))
borderSpec: Border.flat(isSelected ? root.accent : Util.alpha(root.foreground, 0.18), isSelected ? 1.5 : 1)
MouseArea {
id: winMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.selectWindowAction(winChip.modelData.name, winChip.modelData.cmd, winChip.modelData.dsp, winChip.modelData.key)
}
RowLayout {
id: winChipRow
anchors.centerIn: parent
spacing: Style.space(4)
Text {
textFormat: Text.PlainText
text: winChip.isSelected ? "✓" : winChip.modelData.icon
color: winChip.isSelected ? root.accent : root.foreground
font.pixelSize: Style.font.caption - 1
}
Text {
textFormat: Text.PlainText
text: winChip.modelData.name
color: winChip.isSelected ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: winChip.isSelected
}
}
}
}
}
// Directional Navigation Cluster
RowLayout {
Layout.fillWidth: true
spacing: Style.space(8)
Text {
textFormat: Text.PlainText
text: "Directional Controls:"
color: Util.alpha(root.foreground, 0.75)
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: true
}
BorderSurface {
height: Style.space(26)
radius: Style.cornerRadius
color: Util.alpha(root.foreground, 0.05)
borderSpec: Border.flat(Util.alpha(root.foreground, 0.15), 1)
RowLayout {
anchors.fill: parent
anchors.margins: Style.space(2)
spacing: Style.space(2)
BorderSurface {
Layout.fillHeight: true
width: Style.space(88)
radius: Style.cornerRadius - 2
color: root.windowNavMode === "focus" ? Util.alpha(root.accent, 0.28) : "transparent"
borderSpec: Border.flat(root.windowNavMode === "focus" ? root.accent : "transparent", 1)
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.windowNavMode = "focus"
}
Text {
anchors.centerIn: parent
textFormat: Text.PlainText
text: "🎯 Move Focus"
color: root.windowNavMode === "focus" ? root.accent : root.foreground
font.pixelSize: Style.font.caption - 1
font.bold: root.windowNavMode === "focus"
}
}
BorderSurface {
Layout.fillHeight: true
width: Style.space(88)
radius: Style.cornerRadius - 2
color: root.windowNavMode === "swap" ? Util.alpha(root.accent, 0.28) : "transparent"
borderSpec: Border.flat(root.windowNavMode === "swap" ? root.accent : "transparent", 1)
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.windowNavMode = "swap"
}
Text {
anchors.centerIn: parent
textFormat: Text.PlainText
text: "⇄ Swap Window"
color: root.windowNavMode === "swap" ? root.accent : root.foreground
font.pixelSize: Style.font.caption - 1
font.bold: root.windowNavMode === "swap"
}
}
}
}
Item { Layout.fillWidth: true }
// Compact Directional D-Pad row
RowLayout {
spacing: Style.space(6)
Repeater {
model: [
{ dir: "l", label: "⬅️ Left", key: "LEFT" },
{ dir: "u", label: "⬆️ Up", key: "UP" },
{ dir: "d", label: "⬇️ Down", key: "DOWN" },
{ dir: "r", label: "➡️ Right", key: "RIGHT" }
]
BorderSurface {
id: dirBtn
required property var modelData
readonly property bool isSelected: root.selectedActionId === ("dir:" + root.windowNavMode + ":" + modelData.dir)
height: Style.space(26)
width: dirBtnText.implicitWidth + Style.space(16)
radius: Style.cornerRadius
color: isSelected
? Util.alpha(root.accent, 0.28)
: (dirMouse.containsMouse ? Util.alpha(root.foreground, 0.12) : Util.alpha(root.foreground, 0.05))
borderSpec: Border.flat(isSelected ? root.accent : Util.alpha(root.foreground, 0.18), isSelected ? 1.5 : 1)
MouseArea {
id: dirMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
var defK = (root.windowNavMode === "focus")
? "SUPER + " + dirBtn.modelData.key
: "SUPER + SHIFT + " + dirBtn.modelData.key
root.selectDirectional(root.windowNavMode, dirBtn.modelData.dir, defK)
}
}
Text {
id: dirBtnText
anchors.centerIn: parent
textFormat: Text.PlainText
text: dirBtn.isSelected ? ("✓ " + dirBtn.modelData.label) : dirBtn.modelData.label
color: dirBtn.isSelected ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: dirBtn.isSelected
}
}
}
}
}
}
// --- PANEL 3: Workspace Builder ---
ColumnLayout {
visible: !root.isEditing && root.actionType === "workspace"
Layout.fillWidth: true
spacing: Style.space(8)
// Operation Selector
RowLayout {
spacing: Style.space(8)
Text {
textFormat: Text.PlainText
text: "Operation:"
color: root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: true
}
Button {
text: "🎯 Switch Focus"
selected: root.workspaceSubAction === "switch"
horizontalPadding: Style.space(12)
verticalPadding: Style.space(4)
onClicked: {
root.workspaceSubAction = "switch"
if (root.workspaceTarget) root.selectWorkspace(root.workspaceTarget)
}
}
Button {
text: "🪟 Move Window"
selected: root.workspaceSubAction === "move"
horizontalPadding: Style.space(12)
verticalPadding: Style.space(4)
onClicked: {
root.workspaceSubAction = "move"
if (root.workspaceTarget) root.selectWorkspace(root.workspaceTarget)
}
}
Button {
text: "🤫 Move Silently"
selected: root.workspaceSubAction === "silent"
horizontalPadding: Style.space(12)
verticalPadding: Style.space(4)
onClicked: {
root.workspaceSubAction = "silent"
if (root.workspaceTarget) root.selectWorkspace(root.workspaceTarget)
}
}
}
// Row A: Workspaces 1-10 Number Bar
Text {
textFormat: Text.PlainText
text: "Workspaces 1 – 10:"
color: Util.alpha(root.foreground, 0.75)
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: true
}
RowLayout {
Layout.fillWidth: true
spacing: Style.space(4)
Repeater {
model: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
BorderSurface {
id: wsNumChip
required property string modelData
readonly property bool isSelected: root.selectedActionId === ("ws:" + root.workspaceSubAction + ":" + modelData)
Layout.fillWidth: true
height: Style.space(26)
radius: Style.cornerRadius
color: isSelected
? Util.alpha(root.accent, 0.28)
: (wsNumMouse.containsMouse ? Util.alpha(root.foreground, 0.12) : Util.alpha(root.foreground, 0.05))
borderSpec: Border.flat(isSelected ? root.accent : Util.alpha(root.foreground, 0.18), isSelected ? 1.5 : 1)
MouseArea {
id: wsNumMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.selectWorkspace(wsNumChip.modelData)
}
Text {
anchors.centerIn: parent
textFormat: Text.PlainText
text: wsNumChip.isSelected ? ("✓ " + wsNumChip.modelData) : wsNumChip.modelData
color: wsNumChip.isSelected ? root.accent : root.foreground
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: wsNumChip.isSelected
}
}
}
}
// Row B: Relative & Special Targets
Text {
textFormat: Text.PlainText
text: "Relative & Special Workspaces:"
color: Util.alpha(root.foreground, 0.75)
font.family: Style.font.family
font.pixelSize: Style.font.caption
font.bold: true
}
RowLayout {
Layout.fillWidth: true
spacing: Style.space(8)
Repeater {
model: [
{ id: "e+1", label: "⏭️ Next Workspace (e+1)" },
{ id: "e-1", label: "⏮️ Previous Workspace (e-1)" },
{ id: "Scratchpad", label: "📌 Special Scratchpad" }
]
BorderSurface {
id: wsRelChip
required property var modelData
readonly property bool isSelected: root.selectedActionId === ("ws:" + root.workspaceSubAction + ":" + modelData.id)
Layout.fillWidth: true
height: Style.space(26)
radius: Style.cornerRadius
color: isSelected
? Util.alpha(root.accent, 0.28)
: (wsRelMouse.containsMouse ? Util.alpha(root.foreground, 0.12) : Util.alpha(root.foreground, 0.05))
borderSpec: Border.flat(isSelected ? root.accent : Util.alpha(root.foreground, 0.18), isSelected ? 1.5 : 1)
MouseArea {
id: wsRelMouse
anchors.fill: parent