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
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:
steps:
- uses: actions/checkout@v7

# Cached because the runner's apt mirror is sometimes slow enough to add 20 minutes.
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libayatana-appindicator3-dev patchelf
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libayatana-appindicator3-dev patchelf
version: 1.0

- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ jobs:

# The GStreamer plugins get bundled into the AppImage (bundleMediaFramework):
# it can't load the host's, so without them WebKit crashes on the bell sound.
# Cached because the runner's apt mirror is sometimes slow enough to add 20 minutes.
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libayatana-appindicator3-dev patchelf gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libayatana-appindicator3-dev patchelf gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio
version: 1.0

- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"zustand": "^5.0.16"
},
"devDependencies": {
"@babel/core": "^7",
"@babel/core": "^8",
"@eslint/js": "^10.0.1",
"@rolldown/plugin-babel": "^0.2.4",
"@tauri-apps/cli": "^2.12.4",
Expand All @@ -47,7 +47,7 @@
"eslint-plugin-import-x": "^4.17.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-unicorn": "^77.0.0",
"eslint-plugin-unicorn": "^79.0.0",
"globals": "^17.13.0",
"prettier": "^3.9.10",
"prettier-plugin-astro": "^1.1.2",
Expand Down
571 changes: 505 additions & 66 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getCurrentWebview } from "@tauri-apps/api/webview";
import { getCurrentWindow } from "@tauri-apps/api/window";

import { activeTerm, applyConfigToTerms, newTab } from "./actions";
import { COMMAND_IDS, commandAllowedInInput, inInput, runCommand } from "./commands";
import { COMMAND_IDS, commandAllowedInInput, isInInput, runCommand } from "./commands";
import { eventKey, platform } from "./config/keymaps";
import { ensureConfigFiles, loadConfig } from "./config/load";
import { once, orElse, serial } from "./helpers";
Expand Down Expand Up @@ -70,7 +70,7 @@ function onKeyDown(event: KeyboardEvent) {
if (!key) return;
const command = getState().keymap.get(key);
if (!command) return;
if (inInput() && !commandAllowedInInput(command)) return;
if (isInInput() && !commandAllowedInInput(command)) return;
if (!runCommand(command)) return;
event.preventDefault();
event.stopPropagation();
Expand Down
10 changes: 5 additions & 5 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Command = (argument?: string) => void | boolean | Promise<unknown>;
const send = (data: string) => () => activeTerm()?.write(data);

/** Is focus in one of our own text inputs (not a terminal)? */
const inInput = () => {
const isInInput = () => {
const element = document.activeElement;
return (
element instanceof HTMLInputElement ||
Expand Down Expand Up @@ -118,18 +118,18 @@ export const COMMANDS: Record<string, Command> = {
"editor:redo": () => {},
"editor:cut": () => COMMANDS["editor:copy"](),
"editor:copy": () => {
if (inInput()) return document.execCommand("copy");
if (isInInput()) return document.execCommand("copy");
const term = activeTerm()?.term;
if (term?.hasSelection()) void writeText(term.getSelection());
},
"editor:paste": async () => {
const text = await orElse(readText(), "");
if (!text) return;
if (inInput()) document.execCommand("insertText", false, text);
if (isInInput()) document.execCommand("insertText", false, text);
else activeTerm()?.paste(text);
},
"editor:selectAll": () => {
if (inInput()) return document.execCommand("selectAll");
if (isInInput()) return document.execCommand("selectAll");
activeTerm()?.term.selectAll();
},
"editor:clearBuffer": () => activeTerm()?.term.clear(),
Expand Down Expand Up @@ -185,6 +185,6 @@ export function commandAllowedInInput(id: string) {
);
}

export { inInput };
export { isInInput };

export { focusActive } from "./actions";
7 changes: 3 additions & 4 deletions src/sandbox/require.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ export function lockdown() {
}
}

// A CommonJS module can export anything.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Module = { exports: any };

function dirname(p: string) {
const index = p.lastIndexOf("/");
return index === -1 ? "" : p.slice(0, index);
Expand All @@ -45,6 +41,9 @@ function join(...parts: string[]) {
}

export function makeRequire(sources: Record<string, string>, platform: string) {
// A CommonJS module can export anything.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Module = { exports: any };
const cache = new Map<string, Module>();
const builtins: Record<string, unknown> = {
path: {
Expand Down
Loading