blob: c111a7efb616a7d11dd3c29d3b374f0f99069f75 (
plain) (
blame)
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
|
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import Qt5Compat.GraphicalEffects
import "../"
import "root:/"
BarBlock {
id: root
Layout.preferredWidth: 20
content: BarText {
text: ""
pointSize: 24
anchors.horizontalCenterOffset: 4
anchors.verticalCenterOffset: 3
}
color: "transparent"
Process {
id: appListProc
command: ["sh", "-c", "for f in /usr/share/applications/*.desktop; do if ! grep -qi 'terminal=true' \"$f\"; then name=$(grep -i '^Name=' \"$f\" | head -n1 | cut -d= -f2); basename=$(basename \"$f\" .desktop); echo \"$name|$basename|$f\"; fi; done"]
running: false
stdout: SplitParser {
onRead: data => {
const [appName, launchName, desktopFile] = data.trim().split("|")
if (appName && launchName && desktopFile) {
appListModel.append({ name: appName, launchName: launchName, path: desktopFile })
}
}
}
}
Process {
id: appLauncher
running: false
command: ["gtk-launch"]
}
ListModel {
id: appListModel
}
PopupWindow {
id: menuWindow
width: 300
height: 400
visible: false
anchor {
window: root.QsWindow?.window
edges: Edges.Bottom
gravity: Edges.Top
}
FocusScope {
anchors.fill: parent
focus: true
MouseArea {
anchors.fill: parent
hoverEnabled: true
onExited: {
if (!containsMouse) {
closeTimer.start()
}
}
onEntered: closeTimer.stop()
Timer {
id: closeTimer
interval: 500
onTriggered: menuWindow.visible = false
}
Rectangle {
anchors.fill: parent
color: "#2E3440" // Using Nord theme color
border.color: "#4C566A"
border.width: 1
radius: 4
ColumnLayout {
anchors.fill: parent
anchors.margins: 10
spacing: 5
ListView {
id: appListView
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
model: appListModel
delegate: Rectangle {
width: parent.width
height: 35
color: mouseArea.containsMouse ? "#4C566A" : "transparent"
radius: 4
Text {
anchors.fill: parent
anchors.leftMargin: 10
text: model.name
color: "white"
font.pixelSize: 12
verticalAlignment: Text.AlignVCenter
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
console.log("Launching:", model.launchName, "from", model.path)
appLauncher.command = ["gtk-launch", model.launchName]
appLauncher.running = true
menuWindow.visible = false
}
}
}
}
}
}
}
}
}
function filterApps() {
const searchText = searchField.text.toLowerCase()
for (let i = 0; i < appListModel.count; i++) {
const item = appListModel.get(i)
item.visible = item.name.toLowerCase().includes(searchText)
}
}
onClicked: function() {
if (!menuWindow.visible) {
appListModel.clear()
appListProc.running = true
}
menuWindow.visible = !menuWindow.visible
}
}
|