tabby-quick-buttons 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -2
- package/dist/index.js +48 -0
- package/dist/quickButtons.component.js +197 -0
- package/dist/quickButtons.view.js +210 -0
- package/package.json +27 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vzpd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tabby Quick Buttons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Hover over the floating button in the lower-right corner of a Tabby terminal to open the command panel. Click an alias to send its saved command to the focused terminal pane.
|
|
4
|
+
|
|
5
|
+
- **Shared** groups are available in every terminal. Add commands directly or organize them in nested groups.
|
|
6
|
+
- **Current profile** groups are available only in the matching Tabby profile. Renaming the profile keeps the association. Temporary connections without a profile ID can use shared groups.
|
|
7
|
+
- Select **Manage** to add, edit, or delete commands and groups in the panel. Select **Done** to return to hover mode.
|
|
8
|
+
- Each command has a display alias and a single line of terminal text. **Press Enter after inserting** is enabled by default. Turn it off to insert the command for review or editing.
|
|
9
|
+
|
|
10
|
+
Use shortcuts at an empty shell prompt. The plugin stores commands in Tabby's configuration. Keep passwords and tokens out of command text.
|
|
11
|
+
|
|
12
|
+
## Install locally
|
|
13
|
+
|
|
14
|
+
Build the package in the project directory:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm ci
|
|
18
|
+
npm pack
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
In Tabby, go to **Settings → Plugins** and open the plugin directory. Install the package from that directory using the path to the generated archive:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install /absolute/path/to/tabby-quick-buttons-0.1.0.tgz
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Quit and reopen Tabby, then open a terminal. The plugin uses the Angular and terminal APIs bundled with Tabby.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const common_1 = require("@angular/common");
|
|
10
|
+
const core_1 = require("@angular/core");
|
|
11
|
+
const tabby_core_1 = require("tabby-core");
|
|
12
|
+
const quickButtons_component_1 = require("./quickButtons.component");
|
|
13
|
+
class QuickButtonsConfigProvider extends tabby_core_1.ConfigProvider {
|
|
14
|
+
defaults = {
|
|
15
|
+
quickButtons: { scopes: [] },
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function mountQuickButtons(app, injector, document) {
|
|
19
|
+
let component;
|
|
20
|
+
return () => {
|
|
21
|
+
if (component) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const host = document.createElement('tabby-quick-buttons');
|
|
25
|
+
document.body.append(host);
|
|
26
|
+
component = (0, core_1.createComponent)(quickButtons_component_1.QuickButtonsComponent, { environmentInjector: injector, hostElement: host });
|
|
27
|
+
app.attachView(component.hostView);
|
|
28
|
+
component.onDestroy(() => host.remove());
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
let QuickButtonsPlugin = class QuickButtonsPlugin {
|
|
32
|
+
};
|
|
33
|
+
QuickButtonsPlugin = __decorate([
|
|
34
|
+
(0, core_1.NgModule)({
|
|
35
|
+
imports: [common_1.CommonModule],
|
|
36
|
+
declarations: [quickButtons_component_1.QuickButtonsComponent],
|
|
37
|
+
providers: [
|
|
38
|
+
{ provide: tabby_core_1.ConfigProvider, useClass: QuickButtonsConfigProvider, multi: true },
|
|
39
|
+
{
|
|
40
|
+
provide: core_1.APP_BOOTSTRAP_LISTENER,
|
|
41
|
+
useFactory: mountQuickButtons,
|
|
42
|
+
deps: [core_1.ApplicationRef, core_1.EnvironmentInjector, common_1.DOCUMENT],
|
|
43
|
+
multi: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
], QuickButtonsPlugin);
|
|
48
|
+
exports.default = QuickButtonsPlugin;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.QuickButtonsComponent = void 0;
|
|
13
|
+
const core_1 = require("@angular/core");
|
|
14
|
+
const tabby_core_1 = require("tabby-core");
|
|
15
|
+
const tabby_terminal_1 = require("tabby-terminal");
|
|
16
|
+
const quickButtons_view_1 = require("./quickButtons.view");
|
|
17
|
+
const invalidCommandCharacters = /[\x00-\x1f\x7f-\x9f]/;
|
|
18
|
+
let QuickButtonsComponent = class QuickButtonsComponent {
|
|
19
|
+
app;
|
|
20
|
+
config;
|
|
21
|
+
target = null;
|
|
22
|
+
scopes = [];
|
|
23
|
+
managing = false;
|
|
24
|
+
editor = null;
|
|
25
|
+
busy = false;
|
|
26
|
+
error = '';
|
|
27
|
+
panelContext;
|
|
28
|
+
constructor(app, config) {
|
|
29
|
+
this.app = app;
|
|
30
|
+
this.config = config;
|
|
31
|
+
}
|
|
32
|
+
get activeTerminal() {
|
|
33
|
+
const tab = this.app.activeTab;
|
|
34
|
+
const pane = tab instanceof tabby_core_1.SplitTabComponent ? tab.getFocusedTab() : tab;
|
|
35
|
+
return pane instanceof tabby_terminal_1.BaseTerminalTabComponent ? pane : null;
|
|
36
|
+
}
|
|
37
|
+
get expanded() {
|
|
38
|
+
return this.target !== null && this.target === this.activeTerminal;
|
|
39
|
+
}
|
|
40
|
+
get settings() {
|
|
41
|
+
return this.config.store.quickButtons;
|
|
42
|
+
}
|
|
43
|
+
open() {
|
|
44
|
+
const terminal = this.activeTerminal;
|
|
45
|
+
if (!terminal || this.expanded || this.busy) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.target = terminal;
|
|
49
|
+
this.managing = false;
|
|
50
|
+
this.editor = null;
|
|
51
|
+
this.error = '';
|
|
52
|
+
this.refreshScopes();
|
|
53
|
+
const tab = this.app.activeTab;
|
|
54
|
+
this.panelContext?.unsubscribe();
|
|
55
|
+
this.panelContext = this.app.activeTabChange$.subscribe(() => this.close());
|
|
56
|
+
if (tab instanceof tabby_core_1.SplitTabComponent) {
|
|
57
|
+
this.panelContext.add(tab.focusChanged$.subscribe(pane => {
|
|
58
|
+
if (pane !== terminal) {
|
|
59
|
+
this.close();
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
close() {
|
|
65
|
+
this.panelContext?.unsubscribe();
|
|
66
|
+
this.target = null;
|
|
67
|
+
this.managing = false;
|
|
68
|
+
this.editor = null;
|
|
69
|
+
this.error = '';
|
|
70
|
+
}
|
|
71
|
+
ngOnDestroy() {
|
|
72
|
+
this.panelContext?.unsubscribe();
|
|
73
|
+
}
|
|
74
|
+
leave() {
|
|
75
|
+
if (!this.managing) {
|
|
76
|
+
this.close();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
execute(command, scope) {
|
|
80
|
+
const terminal = this.target;
|
|
81
|
+
const session = terminal?.session;
|
|
82
|
+
if (!terminal || terminal !== this.activeTerminal || !session?.open ||
|
|
83
|
+
(scope.profileId !== null && terminal.profile?.id !== scope.profileId)) {
|
|
84
|
+
this.error = 'Switch to the matching connected terminal and try again.';
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!command.text.trim() || invalidCommandCharacters.test(command.text)) {
|
|
88
|
+
this.error = 'Enter a single line of terminal text for this command.';
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
terminal.sendInput(`${command.text}${command.sendEnter !== false ? '\r' : ''}`);
|
|
92
|
+
this.close();
|
|
93
|
+
terminal.emitFocused();
|
|
94
|
+
}
|
|
95
|
+
add(scope, parentPath, kind) {
|
|
96
|
+
const entry = kind === 'group'
|
|
97
|
+
? { kind, title: '', entries: [] }
|
|
98
|
+
: { kind, title: '', text: '', sendEnter: true };
|
|
99
|
+
this.setEditor({ scope, parentPath, entry, deleting: false });
|
|
100
|
+
}
|
|
101
|
+
edit(scope, parentPath, index, entry, deleting = false) {
|
|
102
|
+
this.setEditor({ scope, parentPath, index, entry: { ...entry }, deleting });
|
|
103
|
+
}
|
|
104
|
+
setEditor(editor) {
|
|
105
|
+
this.error = '';
|
|
106
|
+
this.editor = editor;
|
|
107
|
+
}
|
|
108
|
+
cancelEdit() {
|
|
109
|
+
this.editor = null;
|
|
110
|
+
this.error = '';
|
|
111
|
+
}
|
|
112
|
+
async save() {
|
|
113
|
+
const editor = this.editor;
|
|
114
|
+
if (!editor || this.busy) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const { scope, parentPath, index, entry, deleting } = editor;
|
|
118
|
+
if (!deleting && (!entry.title.trim() || (entry.kind === 'command' &&
|
|
119
|
+
(!entry.text.trim() || invalidCommandCharacters.test(entry.text))))) {
|
|
120
|
+
this.error = entry.kind === 'group' ? 'Enter a group name.' : 'Enter an alias and a single line of terminal text.';
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const settings = this.settings;
|
|
124
|
+
const previous = settings.scopes;
|
|
125
|
+
const existing = previous.find(item => item.profileId === scope.profileId);
|
|
126
|
+
if (existing !== scope.saved) {
|
|
127
|
+
this.refreshScopes();
|
|
128
|
+
this.editor = null;
|
|
129
|
+
this.error = 'Shortcuts changed elsewhere. Start the edit again.';
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const updated = { profileId: scope.profileId, entries: structuredClone(scope.entries) };
|
|
133
|
+
let entries = updated.entries;
|
|
134
|
+
for (const groupIndex of parentPath) {
|
|
135
|
+
const group = entries[groupIndex];
|
|
136
|
+
if (group?.kind !== 'group') {
|
|
137
|
+
this.error = 'The original group is missing. Start the edit again.';
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
entries = group.entries;
|
|
141
|
+
}
|
|
142
|
+
if (deleting && index !== undefined) {
|
|
143
|
+
entries.splice(index, 1);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const savedEntry = { ...structuredClone(entry), title: entry.title.trim() };
|
|
147
|
+
if (index === undefined) {
|
|
148
|
+
entries.push(savedEntry);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
entries[index] = savedEntry;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const next = previous.filter(item => item.profileId !== scope.profileId);
|
|
155
|
+
if (updated.entries.length) {
|
|
156
|
+
next.push(updated);
|
|
157
|
+
}
|
|
158
|
+
this.busy = true;
|
|
159
|
+
this.error = '';
|
|
160
|
+
settings.scopes = next;
|
|
161
|
+
try {
|
|
162
|
+
await this.config.save();
|
|
163
|
+
this.editor = null;
|
|
164
|
+
this.refreshScopes();
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
if (this.settings === settings && (settings.scopes === next || (!next.length && !settings.scopes.length))) {
|
|
168
|
+
settings.scopes = previous;
|
|
169
|
+
}
|
|
170
|
+
this.error = 'Could not save the Tabby configuration. Try again.';
|
|
171
|
+
}
|
|
172
|
+
finally {
|
|
173
|
+
this.busy = false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
refreshScopes() {
|
|
177
|
+
const profile = this.target?.profile;
|
|
178
|
+
const scopes = [{ profileId: null, title: 'Shared' }];
|
|
179
|
+
if (profile?.id) {
|
|
180
|
+
scopes.push({ profileId: profile.id, title: profile.name || profile.id });
|
|
181
|
+
}
|
|
182
|
+
this.scopes = scopes.map(scope => {
|
|
183
|
+
const saved = this.settings.scopes.find(item => item.profileId === scope.profileId);
|
|
184
|
+
return { ...scope, saved, entries: saved?.entries ?? [] };
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
QuickButtonsComponent = __decorate([
|
|
189
|
+
(0, core_1.Component)({
|
|
190
|
+
selector: 'tabby-quick-buttons',
|
|
191
|
+
template: quickButtons_view_1.template,
|
|
192
|
+
styles: [quickButtons_view_1.styles],
|
|
193
|
+
}),
|
|
194
|
+
__param(0, (0, core_1.Inject)(tabby_core_1.AppService)),
|
|
195
|
+
__param(1, (0, core_1.Inject)(tabby_core_1.ConfigService))
|
|
196
|
+
], QuickButtonsComponent);
|
|
197
|
+
exports.QuickButtonsComponent = QuickButtonsComponent;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.styles = exports.template = void 0;
|
|
4
|
+
exports.template = `
|
|
5
|
+
<div class="dock" *ngIf="activeTerminal"
|
|
6
|
+
(pointerenter)="open()" (pointerleave)="leave()"
|
|
7
|
+
(keydown.escape)="$event.stopPropagation(); close()">
|
|
8
|
+
<button type="button" class="ball btn btn-secondary" aria-label="Quick commands"
|
|
9
|
+
title="Quick commands" [attr.aria-expanded]="expanded" (click)="open()">
|
|
10
|
+
<span aria-hidden="true">›_</span>
|
|
11
|
+
</button>
|
|
12
|
+
|
|
13
|
+
<div class="panel-position" *ngIf="expanded">
|
|
14
|
+
<section class="panel" aria-label="Quick commands panel">
|
|
15
|
+
<header class="panel-header">
|
|
16
|
+
<strong>Quick commands</strong>
|
|
17
|
+
<button *ngIf="!managing" type="button" class="btn btn-sm btn-outline-secondary"
|
|
18
|
+
(click)="managing = true">Manage</button>
|
|
19
|
+
<button *ngIf="managing" type="button" class="btn btn-sm btn-outline-secondary"
|
|
20
|
+
[disabled]="busy" (click)="close()">Done</button>
|
|
21
|
+
</header>
|
|
22
|
+
|
|
23
|
+
<form *ngIf="editor as draft" class="editor" (submit)="$event.preventDefault(); save()">
|
|
24
|
+
<ng-container *ngIf="!draft.deleting; else deletePrompt">
|
|
25
|
+
<label>
|
|
26
|
+
{{ draft.entry.kind === 'group' ? 'Group name' : 'Command alias' }}
|
|
27
|
+
<input class="form-control form-control-sm" required [disabled]="busy"
|
|
28
|
+
[value]="draft.entry.title" (input)="draft.entry.title = $any($event.target).value">
|
|
29
|
+
</label>
|
|
30
|
+
<label *ngIf="draft.entry.kind === 'command'">
|
|
31
|
+
Command text
|
|
32
|
+
<input class="form-control form-control-sm command-input" required autocomplete="off"
|
|
33
|
+
spellcheck="false" [disabled]="busy" [value]="draft.entry.text"
|
|
34
|
+
(input)="draft.entry.text = $any($event.target).value">
|
|
35
|
+
</label>
|
|
36
|
+
<label *ngIf="draft.entry.kind === 'command'" class="enter-option">
|
|
37
|
+
<input type="checkbox" [disabled]="busy" [checked]="draft.entry.sendEnter !== false"
|
|
38
|
+
(change)="draft.entry.sendEnter = $any($event.target).checked">
|
|
39
|
+
Press Enter after inserting
|
|
40
|
+
</label>
|
|
41
|
+
</ng-container>
|
|
42
|
+
<ng-template #deletePrompt>
|
|
43
|
+
<div>Delete “{{ draft.entry.title }}”?</div>
|
|
44
|
+
<div *ngIf="draft.entry.kind === 'group' && draft.entry.entries.length">
|
|
45
|
+
This also deletes its commands and subgroups.
|
|
46
|
+
</div>
|
|
47
|
+
</ng-template>
|
|
48
|
+
<div class="actions">
|
|
49
|
+
<button type="button" class="btn btn-sm btn-outline-secondary" [disabled]="busy"
|
|
50
|
+
(click)="cancelEdit()">Cancel</button>
|
|
51
|
+
<button type="submit" class="btn btn-sm" [disabled]="busy"
|
|
52
|
+
[class.btn-danger]="draft.deleting" [class.btn-primary]="!draft.deleting">
|
|
53
|
+
{{ draft.deleting ? 'Confirm deletion' : 'Save' }}
|
|
54
|
+
</button>
|
|
55
|
+
</div>
|
|
56
|
+
</form>
|
|
57
|
+
<p class="error text-danger" *ngIf="error" role="alert">{{ error }}</p>
|
|
58
|
+
|
|
59
|
+
<div class="scope-list">
|
|
60
|
+
<section class="scope" *ngFor="let scope of scopes">
|
|
61
|
+
<div class="row-heading">
|
|
62
|
+
<strong class="scope-title">{{ scope.title }}</strong>
|
|
63
|
+
<span class="scope-tag" *ngIf="scope.profileId !== null">Current profile</span>
|
|
64
|
+
</div>
|
|
65
|
+
<ng-container *ngTemplateOutlet="entryList; context: {
|
|
66
|
+
$implicit: scope.entries, scope: scope, path: []
|
|
67
|
+
}"></ng-container>
|
|
68
|
+
</section>
|
|
69
|
+
<p *ngIf="managing && scopes.length === 1" class="empty profile-hint">
|
|
70
|
+
Open a saved Tabby profile to create profile-specific groups.
|
|
71
|
+
</p>
|
|
72
|
+
</div>
|
|
73
|
+
</section>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<ng-template #entryList let-entries let-scope="scope" let-path="path">
|
|
78
|
+
<div *ngIf="managing" class="actions group-actions">
|
|
79
|
+
<button type="button" class="btn btn-sm btn-outline-secondary"
|
|
80
|
+
[disabled]="editor || busy" (click)="add(scope, path, 'command')">Add command</button>
|
|
81
|
+
<button type="button" class="btn btn-sm btn-outline-secondary"
|
|
82
|
+
[disabled]="editor || busy" (click)="add(scope, path, 'group')">Add group</button>
|
|
83
|
+
</div>
|
|
84
|
+
<p *ngIf="!entries.length && !managing" class="empty">No commands yet</p>
|
|
85
|
+
<div *ngFor="let entry of entries; let index = index" class="entry">
|
|
86
|
+
<ng-container *ngIf="entry.kind === 'group'; else command">
|
|
87
|
+
<details open>
|
|
88
|
+
<summary>{{ entry.title }}</summary>
|
|
89
|
+
<div class="nested">
|
|
90
|
+
<div class="actions group-actions" *ngIf="managing">
|
|
91
|
+
<ng-container *ngTemplateOutlet="editActions"></ng-container>
|
|
92
|
+
</div>
|
|
93
|
+
<ng-container *ngTemplateOutlet="entryList; context: {
|
|
94
|
+
$implicit: entry.entries, scope: scope, path: path.concat(index)
|
|
95
|
+
}"></ng-container>
|
|
96
|
+
</div>
|
|
97
|
+
</details>
|
|
98
|
+
</ng-container>
|
|
99
|
+
<ng-template #command>
|
|
100
|
+
<div class="command-row">
|
|
101
|
+
<span class="command-alias" *ngIf="managing">{{ entry.title }}</span>
|
|
102
|
+
<button *ngIf="!managing" type="button" class="command-run"
|
|
103
|
+
[disabled]="!target?.session?.open" (click)="execute(entry, scope)">
|
|
104
|
+
<span aria-hidden="true" class="prompt">›</span>
|
|
105
|
+
<span class="command-alias">{{ entry.title }}</span>
|
|
106
|
+
</button>
|
|
107
|
+
<div class="actions" *ngIf="managing">
|
|
108
|
+
<ng-container *ngTemplateOutlet="editActions"></ng-container>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</ng-template>
|
|
112
|
+
<ng-template #editActions>
|
|
113
|
+
<button type="button" class="btn btn-sm btn-outline-secondary"
|
|
114
|
+
[disabled]="editor || busy" [attr.aria-label]="'Edit ' + entry.title"
|
|
115
|
+
(click)="edit(scope, path, index, entry)">Edit</button>
|
|
116
|
+
<button type="button" class="btn btn-sm btn-outline-danger"
|
|
117
|
+
[disabled]="editor || busy" [attr.aria-label]="'Delete ' + entry.title"
|
|
118
|
+
(click)="edit(scope, path, index, entry, true)">Delete</button>
|
|
119
|
+
</ng-template>
|
|
120
|
+
</div>
|
|
121
|
+
</ng-template>
|
|
122
|
+
`;
|
|
123
|
+
exports.styles = `
|
|
124
|
+
.dock {
|
|
125
|
+
position: fixed;
|
|
126
|
+
right: 24px;
|
|
127
|
+
bottom: 16px;
|
|
128
|
+
z-index: 1020;
|
|
129
|
+
}
|
|
130
|
+
.ball {
|
|
131
|
+
display: grid;
|
|
132
|
+
place-items: center;
|
|
133
|
+
width: 36px;
|
|
134
|
+
height: 36px;
|
|
135
|
+
border-radius: 50%;
|
|
136
|
+
padding: 0;
|
|
137
|
+
font: 600 16px ui-monospace, monospace;
|
|
138
|
+
opacity: .75;
|
|
139
|
+
}
|
|
140
|
+
.ball:hover, .ball:focus-visible, .ball[aria-expanded="true"] { opacity: 1; }
|
|
141
|
+
.panel-position {
|
|
142
|
+
position: absolute;
|
|
143
|
+
right: 0;
|
|
144
|
+
bottom: 100%;
|
|
145
|
+
padding-bottom: 8px;
|
|
146
|
+
width: min(360px, calc(100vw - 40px));
|
|
147
|
+
}
|
|
148
|
+
.panel {
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
max-height: min(570px, calc(100vh - 78px));
|
|
152
|
+
border: 1px solid var(--bs-border-color, #555);
|
|
153
|
+
border-radius: 8px;
|
|
154
|
+
color: var(--bs-body-color);
|
|
155
|
+
background: var(--bs-body-bg, #252525);
|
|
156
|
+
box-shadow: 0 6px 24px #0004;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
}
|
|
159
|
+
.panel-header, .row-heading, .command-row, .actions {
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: 8px;
|
|
163
|
+
}
|
|
164
|
+
.panel-header { justify-content: space-between; padding: 10px 12px; }
|
|
165
|
+
.panel-header, .editor { border-bottom: 1px solid var(--bs-border-color, #555); }
|
|
166
|
+
.scope-list { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 12px 10px; }
|
|
167
|
+
.scope { padding: 8px 0; }
|
|
168
|
+
.scope + .scope { border-top: 1px solid var(--bs-border-color, #555); }
|
|
169
|
+
.row-heading { margin-bottom: 5px; }
|
|
170
|
+
.scope-title, summary, .command-alias { overflow-wrap: anywhere; }
|
|
171
|
+
.scope-tag { flex: none; opacity: .72; font-size: .8em; }
|
|
172
|
+
.empty { margin: 3px 0; opacity: .75; font-size: .9em; }
|
|
173
|
+
.profile-hint { padding-bottom: 4px; }
|
|
174
|
+
.entry { margin-top: 3px; }
|
|
175
|
+
summary { cursor: pointer; padding: 4px 0; }
|
|
176
|
+
.nested {
|
|
177
|
+
border-left: 1px solid var(--bs-border-color, #555);
|
|
178
|
+
margin-left: 5px;
|
|
179
|
+
padding-left: 9px;
|
|
180
|
+
}
|
|
181
|
+
.command-row { justify-content: space-between; min-height: 30px; }
|
|
182
|
+
.command-run {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: flex-start;
|
|
185
|
+
gap: 8px;
|
|
186
|
+
width: 100%;
|
|
187
|
+
padding: 4px 6px;
|
|
188
|
+
text-align: left;
|
|
189
|
+
color: inherit;
|
|
190
|
+
background: transparent;
|
|
191
|
+
border: 0;
|
|
192
|
+
border-radius: 4px;
|
|
193
|
+
}
|
|
194
|
+
.command-run:hover:not(:disabled) { background: #80808030; }
|
|
195
|
+
.command-run:disabled { opacity: .5; }
|
|
196
|
+
.prompt { font-family: ui-monospace, monospace; opacity: .7; }
|
|
197
|
+
.actions { flex-wrap: wrap; }
|
|
198
|
+
.command-row > .actions { flex: none; }
|
|
199
|
+
.group-actions { margin: 4px 0; }
|
|
200
|
+
.editor { display: grid; gap: 7px; padding: 8px 12px; }
|
|
201
|
+
.editor label { display: grid; gap: 3px; margin: 0; }
|
|
202
|
+
.editor .enter-option { display: flex; align-items: center; gap: 6px; }
|
|
203
|
+
.editor .actions { justify-content: flex-end; }
|
|
204
|
+
.command-input { font-family: ui-monospace, monospace; }
|
|
205
|
+
.error { margin: 6px 12px; }
|
|
206
|
+
@media (max-height: 420px) {
|
|
207
|
+
.panel { display: block; overflow: auto; overscroll-behavior: contain; }
|
|
208
|
+
.scope-list { overflow: visible; }
|
|
209
|
+
}
|
|
210
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tabby-quick-buttons",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Floating command shortcuts with shared and per-profile groups for Tabby.",
|
|
5
|
+
"author": "zp",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"tabby-plugin"
|
|
9
|
+
],
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"prepack": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@angular/common": "15.2.10",
|
|
21
|
+
"@angular/core": "15.2.10",
|
|
22
|
+
"@types/node": "^18.0.0",
|
|
23
|
+
"rxjs": "^7.8.0",
|
|
24
|
+
"tabby-core": "1.0.231-nightly.0",
|
|
25
|
+
"tabby-terminal": "1.0.231-nightly.0",
|
|
26
|
+
"typescript": "4.9.5",
|
|
27
|
+
"zone.js": "~0.13.0"
|
|
28
|
+
}
|
|
29
|
+
}
|