Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ __screenshots__/
/browser-sidebar-comment-preload.js.map
/preload.js.map
/bootstrap.js.map
/.teacode/
/.teacode-*/
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@t3tools/desktop",
"version": "0.9.3",
"version": "0.9.4",
"private": true,
"main": "dist-electron/main.js",
"scripts": {
Expand Down
17 changes: 7 additions & 10 deletions apps/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1106,12 +1106,6 @@ function configureApplicationMenu(): void {
{
label: "View",
submenu: [
{
label: "New Terminal Tab",
...acceleratorProps("CmdOrCtrl+T"),
click: () => dispatchMenuAction("new-terminal-tab"),
},
{ type: "separator" },
{
label: "Toggle Sidebar",
...acceleratorProps("CmdOrCtrl+B"),
Expand Down Expand Up @@ -2562,12 +2556,12 @@ function getIconOption(): { icon: string } | Record<string, never> {
// transparent (`#00000000`) over the vibrancy material. Windows/Linux have no vibrancy:
// a transparent window there leaves backdrop-filter surfaces bleeding through and, on
// fractional DPI, rendering blurry. So off macOS we create an opaque window and skip the
// macOS-only options. The background tracks the OS light/dark appearance purely to avoid
// a bright flash before the renderer paints — the window is shown only after first paint
// (`show: false`), so this color is not expected to match a custom in-app theme exactly.
// macOS-only options. The background is a fixed dark tone purely to avoid a flash before
// the renderer paints — the app is dark-only, and the window is shown only after first
// paint (`show: false`), so this color need not match the in-app surface exactly.
function getWindowMaterialOptions(): BrowserWindowConstructorOptions {
if (process.platform !== "darwin") {
return { backgroundColor: nativeTheme.shouldUseDarkColors ? "#181818" : "#ffffff" };
return { backgroundColor: "#181818" };
}
return {
vibrancy: "under-window",
Expand Down Expand Up @@ -2599,6 +2593,9 @@ function getTitleBarOptions(): BrowserWindowConstructorOptions {
}

function createWindow(): BrowserWindow {
// Let the renderer decide the theme via the setTheme IPC call.
// Start with system default; the renderer will override on first paint.

const window = new BrowserWindow({
width: 1100,
height: 780,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "t3",
"version": "0.9.3",
"version": "0.9.4",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
64 changes: 30 additions & 34 deletions apps/server/src/keybindings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
Effect.sync(() => {
const compiled = compileResolvedKeybindingRule({
key: "mod+d",
command: "terminal.split",
command: "chat.split",
when: "terminalOpen && !terminalFocus",
});

assert.deepEqual(compiled, {
command: "terminal.split",
command: "chat.split",
shortcut: {
key: "d",
metaKey: false,
Expand All @@ -106,7 +106,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
it.effect("encodes resolved plus-key shortcuts", () =>
Effect.gen(function* () {
const encoded = yield* Schema.encodeEffect(ResolvedKeybindingFromConfig)({
command: "terminal.toggle",
command: "sidebar.toggle",
shortcut: {
key: "+",
metaKey: false,
Expand All @@ -118,7 +118,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
});

assert.equal(encoded.key, "mod++");
assert.equal(encoded.command, "terminal.toggle");
assert.equal(encoded.command, "sidebar.toggle");
}),
);

Expand All @@ -127,22 +127,22 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
assert.isNull(
compileResolvedKeybindingRule({
key: "mod+shift+d+o",
command: "terminal.new",
command: "chat.new",
}),
);

assert.isNull(
compileResolvedKeybindingRule({
key: "mod+d",
command: "terminal.split",
command: "chat.split",
when: "terminalFocus && (",
}),
);

assert.isNull(
compileResolvedKeybindingRule({
key: "mod+d",
command: "terminal.split",
command: "chat.split",
when: `${"!".repeat(300)}terminalFocus`,
}),
);
Expand Down Expand Up @@ -258,7 +258,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* fs.writeFileString(
keybindingsConfigPath,
JSON.stringify({ keybindings: [{ key: "mod+9", command: "terminal.toggle" }] }),
JSON.stringify({ keybindings: [{ key: "mod+9", command: "sidebar.toggle" }] }),
);

const configState = yield* Effect.gen(function* () {
Expand All @@ -268,7 +268,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
assert.deepEqual(configState.issues, []);
assert.isTrue(
configState.keybindings.some(
(entry) => entry.command === "terminal.toggle" && entry.shortcut.key === "9",
(entry) => entry.command === "sidebar.toggle" && entry.shortcut.key === "9",
),
);

Expand All @@ -279,7 +279,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {

const persisted = yield* readKeybindingsConfig(keybindingsConfigPath);
assert.isTrue(
persisted.some((entry) => entry.key === "mod+9" && entry.command === "terminal.toggle"),
persisted.some((entry) => entry.key === "mod+9" && entry.command === "sidebar.toggle"),
);
}).pipe(Effect.provide(makeKeybindingsLayer())),
);
Expand All @@ -290,7 +290,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* fs.writeFileString(
keybindingsConfigPath,
'{"key":"mod+9","command":"terminal.toggle"}',
'{"key":"mod+9","command":"sidebar.toggle"}',
);

const configState = yield* Effect.gen(function* () {
Expand All @@ -300,7 +300,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
assert.deepEqual(configState.issues, []);
assert.isTrue(
configState.keybindings.some(
(entry) => entry.command === "terminal.toggle" && entry.shortcut.key === "9",
(entry) => entry.command === "sidebar.toggle" && entry.shortcut.key === "9",
),
);
}).pipe(Effect.provide(makeKeybindingsLayer())),
Expand Down Expand Up @@ -333,8 +333,8 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
yield* fs.writeFileString(
keybindingsConfigPath,
JSON.stringify([
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+shift+d+o", command: "terminal.new" },
{ key: "mod+j", command: "sidebar.toggle" },
{ key: "mod+shift+d+o", command: "chat.new" },
{ key: "mod+x", command: "invalid.command" },
]),
);
Expand All @@ -344,7 +344,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
return yield* keybindings.loadConfigState;
});

assert.isTrue(configState.keybindings.some((entry) => entry.command === "terminal.toggle"));
assert.isTrue(configState.keybindings.some((entry) => entry.command === "sidebar.toggle"));
assert.isFalse(
configState.keybindings.some((entry) => String(entry.command) === "invalid.command"),
);
Expand Down Expand Up @@ -448,7 +448,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
// including one the user rebound to a custom key, plus a non-creation command.
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+n", command: "chat.new", when: "!terminalFocus" },
{ key: "mod+shift+k", command: "chat.newTerminal", when: "!terminalFocus" },
{ key: "mod+shift+k", command: "chat.newChat", when: "!terminalFocus" },
{ key: "mod+shift+u", command: "settings.usage", when: "!terminalFocus" },
]);

Expand All @@ -471,7 +471,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
persisted.some(
(entry) =>
entry.key === "mod+shift+k" &&
entry.command === "chat.newTerminal" &&
entry.command === "chat.newChat" &&
entry.when === "!terminalFocus || isMac",
),
);
Expand Down Expand Up @@ -596,7 +596,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
Effect.gen(function* () {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+shift+t", command: "terminal.toggle" },
{ key: "mod+shift+t", command: "sidebar.toggle" },
{ key: "mod+shift+r", command: "script.run-tests.run" },
]);

Expand All @@ -608,17 +608,13 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
const persisted = yield* readKeybindingsConfig(keybindingsConfigPath);
const byCommand = new Map(persisted.map((entry) => [entry.command, entry]));

const persistedToggle = byCommand.get("terminal.toggle");
const persistedToggle = byCommand.get("sidebar.toggle");
assert.isNotNull(persistedToggle);
assert.equal(persistedToggle?.key, "mod+shift+t");
assert.isFalse(
persisted.some((entry) => entry.command === "terminal.toggle" && entry.key === "mod+j"),
persisted.some((entry) => entry.command === "sidebar.toggle" && entry.key === "mod+b"),
);

const persistedNewTerminalThread = byCommand.get("chat.newTerminal");
assert.isNotNull(persistedNewTerminalThread);
assert.equal(persistedNewTerminalThread?.key, "mod+shift+t");

for (const defaultRule of DEFAULT_KEYBINDINGS) {
assert.isTrue(byCommand.has(defaultRule.command), `expected ${defaultRule.command}`);
}
Expand All @@ -635,7 +631,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
return Effect.gen(function* () {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+j", command: "script.custom-action.run" },
{ key: "mod+b", command: "script.custom-action.run" },
]);

yield* Effect.gen(function* () {
Expand All @@ -644,7 +640,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
});

const persisted = yield* readKeybindingsConfig(keybindingsConfigPath);
assert.isFalse(persisted.some((entry) => entry.command === "terminal.toggle"));
assert.isFalse(persisted.some((entry) => entry.command === "sidebar.toggle"));
assert.isTrue(persisted.some((entry) => entry.command === "script.custom-action.run"));

assert.isTrue(
Expand All @@ -666,7 +662,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
Effect.gen(function* () {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+j", command: "sidebar.toggle" },
]);

const resolved = yield* Effect.gen(function* () {
Expand All @@ -681,7 +677,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
const persistedView = persisted.map(({ key, command }) => ({ key, command }));

assert.deepEqual(persistedView, [
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+j", command: "sidebar.toggle" },
{ key: "mod+shift+r", command: "script.run-tests.run" },
]);
assert.isTrue(resolved.some((entry) => entry.command === "script.run-tests.run"));
Expand Down Expand Up @@ -761,7 +757,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
const { keybindingsConfigPath } = yield* ServerConfig;
const { dirname } = yield* Path.Path;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+j", command: "sidebar.toggle" },
]);
yield* fs.chmod(dirname(keybindingsConfigPath), 0o500);

Expand All @@ -778,15 +774,15 @@ it.layer(NodeServices.layer)("keybindings", (it) => {

const persisted = yield* readKeybindingsConfig(keybindingsConfigPath);
const persistedView = persisted.map(({ key, command }) => ({ key, command }));
assert.deepEqual(persistedView, [{ key: "mod+j", command: "terminal.toggle" }]);
assert.deepEqual(persistedView, [{ key: "mod+j", command: "sidebar.toggle" }]);
}).pipe(Effect.provide(makeKeybindingsLayer())),
);

it.effect("caches loaded resolved config across repeated reads", () =>
Effect.gen(function* () {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+j", command: "sidebar.toggle" },
]);

const [first, second] = yield* Effect.gen(function* () {
Expand All @@ -797,15 +793,15 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
});

assert.deepEqual(first, second);
assert.isTrue(second.some((entry) => entry.command === "terminal.toggle"));
assert.isTrue(second.some((entry) => entry.command === "sidebar.toggle"));
}).pipe(Effect.provide(makeKeybindingsLayer())),
);

it.effect("updates cached resolved config after upsert", () =>
Effect.gen(function* () {
const { keybindingsConfigPath } = yield* ServerConfig;
yield* writeKeybindingsConfig(keybindingsConfigPath, [
{ key: "mod+j", command: "terminal.toggle" },
{ key: "mod+j", command: "sidebar.toggle" },
]);

const loadedAfterUpsert = yield* Effect.gen(function* () {
Expand All @@ -819,7 +815,7 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
});

assert.isTrue(loadedAfterUpsert.some((entry) => entry.command === "script.run-tests.run"));
assert.isTrue(loadedAfterUpsert.some((entry) => entry.command === "terminal.toggle"));
assert.isTrue(loadedAfterUpsert.some((entry) => entry.command === "sidebar.toggle"));
}).pipe(Effect.provide(makeKeybindingsLayer())),
);

Expand Down
Loading
Loading