-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCommandRunnerSettings.qml
More file actions
246 lines (212 loc) · 6.58 KB
/
CommandRunnerSettings.qml
File metadata and controls
246 lines (212 loc) · 6.58 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
import QtQuick
import qs.Common
import qs.Widgets
import qs.Modules.Plugins
import qs.Services
PluginSettings {
id: root
pluginId: "commandRunner"
Component.onCompleted: {
const currentTrigger = root.loadValue("trigger", ">");
if (!currentTrigger || currentTrigger.trim().length === 0)
root.saveValue("trigger", ">");
}
StyledText {
width: parent.width
text: "Command Runner"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Bold
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Execute shell commands directly from the launcher with history tracking."
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.3
}
StringSetting {
id: triggerSetting
settingKey: "trigger"
label: "Trigger"
description: "Prefix character(s) to activate command runner (e.g., >, $, !, run). Avoid triggers reserved by DMS or other plugins (e.g., / for file search)."
placeholder: ">"
defaultValue: ">"
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.3
}
StyledText {
width: parent.width
text: "Terminal Configuration"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
width: parent.width
text: "Configure which terminal emulator to use for commands"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
}
Row {
width: parent.width
spacing: Theme.spacingM
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Terminal"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: terminalField
width: parent.width
text: root.loadValue("terminal", "kitty")
placeholderText: "kitty"
onTextEdited: root.saveValue("terminal", text.trim())
}
}
Column {
width: (parent.width - Theme.spacingM) / 2
spacing: Theme.spacingXS
StyledText {
text: "Exec Flag"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
DankTextField {
id: execFlagField
width: parent.width
text: root.loadValue("execFlag", "-e")
placeholderText: "-e"
onTextEdited: root.saveValue("execFlag", text.trim())
}
}
}
StyledText {
width: parent.width
text: "Common: kitty (-e), alacritty (-e), foot (-e), wezterm (start), gnome-terminal (--), konsole (-e)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
leftPadding: Theme.spacingM
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.3
}
StyledText {
width: parent.width
text: "History Settings"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Row {
width: parent.width
spacing: Theme.spacingM
StyledText {
text: "Max history items:"
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
DankTextField {
id: historyField
width: 80
text: root.loadValue("maxHistoryItems", "20").toString()
placeholderText: "20"
onTextEdited: {
const num = parseInt(text);
if (!isNaN(num) && num > 0 && num <= 100) {
root.saveValue("maxHistoryItems", num);
}
}
}
StyledText {
text: "(1-100)"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter
}
}
DankButton {
text: "Clear Command History"
iconName: "delete"
backgroundColor: Theme.error
textColor: Theme.surface
onClicked: {
root.saveValue("history", []);
ToastService?.showInfo("Command history cleared");
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.3
}
StyledText {
width: parent.width
text: "Features"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
width: parent.width
spacing: Theme.spacingXS
leftPadding: Theme.spacingM
Repeater {
model: ["Run commands in terminal or background", "Command history with recent commands", "Copy commands to clipboard", "Configurable terminal emulator"]
StyledText {
required property string modelData
text: "• " + modelData
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
Rectangle {
width: parent.width
height: 1
color: Theme.outline
opacity: 0.3
}
StyledText {
width: parent.width
text: "Usage"
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
}
Column {
width: parent.width
spacing: Theme.spacingXS
leftPadding: Theme.spacingM
bottomPadding: Theme.spacingL
Repeater {
model: ["1. Open Launcher (Ctrl+Space or click launcher button)", "2. Type your trigger (default: >) followed by command", "3. Example: '> htop' or '> ls -la'", "4. Select 'Run' for terminal, 'Run in background' for silent execution", "5. Browse recent commands from history"]
StyledText {
required property string modelData
text: modelData
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
}
}
}
}