native-shortcuts-herd 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 +212 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +219 -0
- package/dist/cli.js.map +1 -0
- package/dist/format.d.ts +5 -0
- package/dist/format.js +39 -0
- package/dist/format.js.map +1 -0
- package/dist/fs-utils.d.ts +22 -0
- package/dist/fs-utils.js +81 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/ghostty.d.ts +9 -0
- package/dist/ghostty.js +145 -0
- package/dist/ghostty.js.map +1 -0
- package/dist/herdr.d.ts +20 -0
- package/dist/herdr.js +197 -0
- package/dist/herdr.js.map +1 -0
- package/dist/installer.d.ts +6 -0
- package/dist/installer.js +121 -0
- package/dist/installer.js.map +1 -0
- package/dist/profiles.d.ts +15 -0
- package/dist/profiles.js +140 -0
- package/dist/profiles.js.map +1 -0
- package/dist/state.d.ts +3 -0
- package/dist/state.js +20 -0
- package/dist/state.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
package/dist/profiles.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export const profiles = [
|
|
2
|
+
{
|
|
3
|
+
id: "chrome-spaces",
|
|
4
|
+
name: "chrome spaces",
|
|
5
|
+
description: "cmd+1..9 jumps herdr spaces; ctrl+tab cycles spaces; ctrl+option+tab cycles tabs.",
|
|
6
|
+
cmdNumbers: "workspaces",
|
|
7
|
+
ctrlTab: "workspaces",
|
|
8
|
+
ctrlOptTab: "tabs",
|
|
9
|
+
includePrefixActions: true,
|
|
10
|
+
promptNewTabName: false
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "chrome-tabs",
|
|
14
|
+
name: "chrome tabs",
|
|
15
|
+
description: "cmd+1..9 jumps tabs like chrome; ctrl+tab cycles tabs; ctrl+option+tab cycles spaces.",
|
|
16
|
+
cmdNumbers: "tabs",
|
|
17
|
+
ctrlTab: "tabs",
|
|
18
|
+
ctrlOptTab: "workspaces",
|
|
19
|
+
includePrefixActions: true,
|
|
20
|
+
promptNewTabName: false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "minimal",
|
|
24
|
+
name: "minimal",
|
|
25
|
+
description: "only patch the core macos actions and leave indexed jumps off.",
|
|
26
|
+
cmdNumbers: "off",
|
|
27
|
+
ctrlTab: "workspaces",
|
|
28
|
+
ctrlOptTab: "tabs",
|
|
29
|
+
includePrefixActions: true,
|
|
30
|
+
promptNewTabName: false
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
export function getProfile(id) {
|
|
34
|
+
const profile = profiles.find((candidate) => candidate.id === id);
|
|
35
|
+
if (profile)
|
|
36
|
+
return profile;
|
|
37
|
+
return profiles[0];
|
|
38
|
+
}
|
|
39
|
+
export function targetFrom(value, fallback) {
|
|
40
|
+
if (value === "workspaces" || value === "spaces")
|
|
41
|
+
return "workspaces";
|
|
42
|
+
if (value === "tabs")
|
|
43
|
+
return "tabs";
|
|
44
|
+
if (value === "off" || value === "none" || value === "disabled")
|
|
45
|
+
return "off";
|
|
46
|
+
return fallback;
|
|
47
|
+
}
|
|
48
|
+
export function choicesFromOptions(options) {
|
|
49
|
+
const profile = getProfile(options.profile);
|
|
50
|
+
return {
|
|
51
|
+
profile: profile.id,
|
|
52
|
+
cmdNumbers: targetFrom(options.cmdNumbers, profile.cmdNumbers),
|
|
53
|
+
ctrlTab: targetFrom(options.ctrlTab, profile.ctrlTab),
|
|
54
|
+
ctrlOptTab: targetFrom(options.ctrlOptTab, profile.ctrlOptTab),
|
|
55
|
+
promptNewTabName: options.promptNewTabName ?? profile.promptNewTabName,
|
|
56
|
+
extraGhosttyBindings: parseKeyValues(options.ghosttyKey ?? []),
|
|
57
|
+
extraHerdrKeys: parseKeyValues(options.herdrKey ?? [])
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function parseKeyValues(values) {
|
|
61
|
+
return values.map((entry) => {
|
|
62
|
+
const separator = entry.indexOf("=");
|
|
63
|
+
if (separator < 1) {
|
|
64
|
+
throw new Error(`expected key=value, got ${entry}`);
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
key: entry.slice(0, separator).trim(),
|
|
68
|
+
value: entry.slice(separator + 1).trim()
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export function generateConfig(choices) {
|
|
73
|
+
const ghosttyLines = [
|
|
74
|
+
"# native-shortcuts-herd: managed ghostty key routing",
|
|
75
|
+
"# edit with: native-shortcuts-herd install",
|
|
76
|
+
""
|
|
77
|
+
];
|
|
78
|
+
addPrefixActionBindings(ghosttyLines);
|
|
79
|
+
const herdrValues = {
|
|
80
|
+
"keys.prefix": "ctrl+b",
|
|
81
|
+
"keys.new_workspace": "n",
|
|
82
|
+
"keys.rename_workspace": "shift+n",
|
|
83
|
+
"keys.close_workspace": "shift+d",
|
|
84
|
+
"keys.new_tab": "t",
|
|
85
|
+
"keys.rename_tab": "shift+t",
|
|
86
|
+
"keys.close_tab": "shift+w",
|
|
87
|
+
"ui.prompt_new_tab_name": choices.promptNewTabName
|
|
88
|
+
};
|
|
89
|
+
addCycleBindings("ctrl", choices.ctrlTab, ghosttyLines, herdrValues);
|
|
90
|
+
addCycleBindings("ctrl+alt", choices.ctrlOptTab, ghosttyLines, herdrValues);
|
|
91
|
+
addIndexedBindings(choices.cmdNumbers, ghosttyLines, herdrValues);
|
|
92
|
+
for (const binding of choices.extraGhosttyBindings) {
|
|
93
|
+
ghosttyLines.push(`keybind = ${binding.key}=${binding.value}`);
|
|
94
|
+
}
|
|
95
|
+
for (const binding of choices.extraHerdrKeys) {
|
|
96
|
+
herdrValues[`keys.${binding.key}`] = binding.value;
|
|
97
|
+
}
|
|
98
|
+
ghosttyLines.push("");
|
|
99
|
+
return { choices, ghosttyLines, herdrValues };
|
|
100
|
+
}
|
|
101
|
+
function addPrefixActionBindings(lines) {
|
|
102
|
+
lines.push("# macos/chrome-style herdr actions", "keybind = cmd+KeyT=text:\\x02t", "keybind = cmd+t=unbind", "keybind = cmd+KeyN=text:\\x02n", "keybind = cmd+n=unbind", "keybind = cmd+KeyW=text:\\x02W", "keybind = cmd+w=unbind", "keybind = cmd+KeyK=text:\\x02N", "keybind = cmd+k=unbind", "keybind = cmd+KeyL=text:\\x02T", "keybind = cmd+l=unbind", "keybind = alt+t=text:\\x02t", "");
|
|
103
|
+
}
|
|
104
|
+
function addCycleBindings(chord, target, lines, herdrValues) {
|
|
105
|
+
if (target === "off")
|
|
106
|
+
return;
|
|
107
|
+
const next = chord === "ctrl" ? "\\x1b[9;5u" : "\\x1b[9;7u";
|
|
108
|
+
const previous = chord === "ctrl" ? "\\x1b[9;6u" : "\\x1b[9;8u";
|
|
109
|
+
const keyNext = chord === "ctrl" ? "ctrl+tab" : "ctrl+alt+tab";
|
|
110
|
+
const keyPrevious = chord === "ctrl" ? "ctrl+shift+tab" : "ctrl+alt+shift+tab";
|
|
111
|
+
const herdrPrefix = target === "tabs" ? "tab" : "workspace";
|
|
112
|
+
lines.push(`# ${keyNext} / ${keyPrevious} -> herdr ${target}`, `keybind = ${keyNext}=text:${next}`, `keybind = ${keyPrevious}=text:${previous}`, "");
|
|
113
|
+
herdrValues[`keys.next_${herdrPrefix}`] = keyNext;
|
|
114
|
+
herdrValues[`keys.previous_${herdrPrefix}`] = keyPrevious;
|
|
115
|
+
}
|
|
116
|
+
function addIndexedBindings(target, lines, herdrValues) {
|
|
117
|
+
if (target === "off") {
|
|
118
|
+
herdrValues["keys.indexed.workspaces"] = "";
|
|
119
|
+
herdrValues["keys.indexed.tabs"] = "";
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const modifier = target === "tabs" ? "alt" : "ctrl+shift";
|
|
123
|
+
const csiModifier = target === "tabs" ? 3 : 6;
|
|
124
|
+
const indexedKey = target === "tabs" ? "keys.indexed.tabs" : "keys.indexed.workspaces";
|
|
125
|
+
lines.push(`# cmd+1..9 -> herdr ${target}`);
|
|
126
|
+
for (let index = 1; index <= 9; index += 1) {
|
|
127
|
+
const codepoint = 48 + index;
|
|
128
|
+
lines.push(`keybind = cmd+digit_${index}=text:\\x1b[${codepoint};${csiModifier}u`);
|
|
129
|
+
lines.push(`keybind = cmd+${index}=text:\\x1b[${codepoint};${csiModifier}u`);
|
|
130
|
+
}
|
|
131
|
+
lines.push("");
|
|
132
|
+
herdrValues[indexedKey] = modifier;
|
|
133
|
+
if (target === "tabs") {
|
|
134
|
+
herdrValues["keys.indexed.workspaces"] = "ctrl+shift";
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
herdrValues["keys.indexed.tabs"] = "alt";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../src/profiles.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,QAAQ,GAAsB;IACzC;QACE,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,mFAAmF;QAChG,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,MAAM;QAClB,oBAAoB,EAAE,IAAI;QAC1B,gBAAgB,EAAE,KAAK;KACxB;IACD;QACE,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,uFAAuF;QACpG,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,YAAY;QACxB,oBAAoB,EAAE,IAAI;QAC1B,gBAAgB,EAAE,KAAK;KACxB;IACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,gEAAgE;QAC7E,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,YAAY;QACrB,UAAU,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AiB,KAAK,eAAe,SAAS,IAAI,WAAW,GAAG,CAAC,CAAC;IAC/E,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,WAAW,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;IACnC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,WAAW,CAAC,yBAAyB,CAAC,GAAG,YAAY,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,mBAAmB,CAAC,GAAG,KAAK,CAAC;IAC3C,CAAC;AACH,CAAC"}
|
package/dist/state.d.ts
ADDED
package/dist/state.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { statePath, readText, writeText } from "./fs-utils.js";
|
|
3
|
+
export function readState() {
|
|
4
|
+
const path = statePath();
|
|
5
|
+
if (!existsSync(path))
|
|
6
|
+
return null;
|
|
7
|
+
try {
|
|
8
|
+
const parsed = JSON.parse(readText(path));
|
|
9
|
+
if (parsed.schemaVersion === 1)
|
|
10
|
+
return parsed;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
export function writeState(state) {
|
|
18
|
+
writeText(statePath(), `${JSON.stringify(state, null, 2)}\n`);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/D,MAAM,UAAU,SAAS;IACvB,MAAM,IAAI,GAAG,SAAS,EAAE,CAAC;IACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAiB,CAAC;QAC1D,IAAI,MAAM,CAAC,aAAa,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAmB;IAC5C,SAAS,CAAC,SAAS,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type ShortcutTarget = "workspaces" | "tabs" | "off";
|
|
2
|
+
export type ProfileId = "chrome-spaces" | "chrome-tabs" | "minimal";
|
|
3
|
+
export interface ShortcutProfile {
|
|
4
|
+
id: ProfileId;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
cmdNumbers: ShortcutTarget;
|
|
8
|
+
ctrlTab: ShortcutTarget;
|
|
9
|
+
ctrlOptTab: ShortcutTarget;
|
|
10
|
+
includePrefixActions: boolean;
|
|
11
|
+
promptNewTabName: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ShortcutChoices {
|
|
14
|
+
profile: ProfileId;
|
|
15
|
+
cmdNumbers: ShortcutTarget;
|
|
16
|
+
ctrlTab: ShortcutTarget;
|
|
17
|
+
ctrlOptTab: ShortcutTarget;
|
|
18
|
+
promptNewTabName: boolean;
|
|
19
|
+
extraGhosttyBindings: KeyValue[];
|
|
20
|
+
extraHerdrKeys: KeyValue[];
|
|
21
|
+
}
|
|
22
|
+
export interface KeyValue {
|
|
23
|
+
key: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}
|
|
26
|
+
export interface GeneratedConfig {
|
|
27
|
+
choices: ShortcutChoices;
|
|
28
|
+
ghosttyLines: string[];
|
|
29
|
+
herdrValues: Record<string, string | boolean>;
|
|
30
|
+
}
|
|
31
|
+
export interface Change {
|
|
32
|
+
path: string;
|
|
33
|
+
kind: "create" | "update" | "delete" | "noop" | "warn";
|
|
34
|
+
message: string;
|
|
35
|
+
before?: string;
|
|
36
|
+
after?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ManagedState {
|
|
39
|
+
schemaVersion: 1;
|
|
40
|
+
packageVersion: string;
|
|
41
|
+
installedAt: string;
|
|
42
|
+
choices: ShortcutChoices;
|
|
43
|
+
ghostty: {
|
|
44
|
+
sidecarPath: string;
|
|
45
|
+
configPaths: string[];
|
|
46
|
+
};
|
|
47
|
+
herdr: {
|
|
48
|
+
configPath: string;
|
|
49
|
+
previousValues: Record<string, string | null>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface ApplyRequest {
|
|
53
|
+
choices: ShortcutChoices;
|
|
54
|
+
dryRun: boolean;
|
|
55
|
+
yes: boolean;
|
|
56
|
+
ghosttyConfigPaths?: string[];
|
|
57
|
+
skipGhostty?: boolean;
|
|
58
|
+
skipHerdr?: boolean;
|
|
59
|
+
skipHerdrInstall?: boolean;
|
|
60
|
+
noReload?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface CommandResult {
|
|
63
|
+
changes: Change[];
|
|
64
|
+
warnings: string[];
|
|
65
|
+
state?: ManagedState;
|
|
66
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "native-shortcuts-herd",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "make ghostty + herdr navigation feel native to macos and chrome-style tab workflows",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"native-shortcuts-herd": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"postbuild": "node -e \"require('fs').chmodSync('dist/cli.js', 0o755)\"",
|
|
17
|
+
"dev": "tsx src/cli.ts",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
20
|
+
"prepack": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/yigitkonur/native-shortcuts-herd.git"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"ghostty",
|
|
28
|
+
"herdr",
|
|
29
|
+
"macos",
|
|
30
|
+
"terminal",
|
|
31
|
+
"cli",
|
|
32
|
+
"keybindings",
|
|
33
|
+
"shortcuts"
|
|
34
|
+
],
|
|
35
|
+
"author": "yigitkonur",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/yigitkonur/native-shortcuts-herd/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/yigitkonur/native-shortcuts-herd#readme",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.11"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"commander": "^14.0.2",
|
|
49
|
+
"picocolors": "^1.1.1",
|
|
50
|
+
"prompts": "^2.4.2"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^24.10.0",
|
|
54
|
+
"@types/prompts": "^2.4.9",
|
|
55
|
+
"tsx": "^4.20.6",
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^4.0.13"
|
|
58
|
+
}
|
|
59
|
+
}
|