Skip to content
Open
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
10 changes: 10 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ README doesn't: conventions, environment and pitfalls.
header, adds drag and drop, live reload on
`folder-changed` (keeps tab, sheet and selection) and
`index.html#folder=<path>[&project=…][&commit=<sha>]`.
- Integrated terminal (`src/desktop/terminal.js` panel + `vt.js` DOM-free
emulator, `src-tauri/src/terminal.rs`): header button `#term-toggle`
(added by `initHeader`, so on all three pages) or Ctrl+`. The user's
`$SHELL` on a pty (posix_openpt via `libc`, no pty crate; Unix only, the
commands refuse on Windows), started in the page's `folder=`/`local=` or
home, with the AppImage env removed (`outside_appimage`). `term_open/write/
resize/attach/close`, output as `term-data` {id, data, end}; Rust keeps a
256 KB backlog so the next page reattaches (sessionStorage `kivi.terminal`).
Hide keeps the shell; × ends it. Ctrl+C copies when text is selected,
Ctrl+V / Ctrl+Shift+V paste (bracketed when asked).
- Folder chooser (`pickFolder`, tauri.js → `pick_folder` in
`src-tauri/src/picker.rs`): on Linux GTK's `FileChooserNative` with
`GTK_USE_PORTAL=1` (set at start-up, removed for children by
Expand Down
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ git2 = { version = "0.20", default-features = false, features = ["vendored-libgi
notify = "6"
notify-debouncer-mini = "0.4"

# The integrated terminal's pseudo-terminal (terminal.rs). Already in the tree through Tauri.
[target.'cfg(unix)'.dependencies]
libc = "0.2"

# The folder chooser through the desktop portal (picker.rs). The same GTK as Tauri's.
[target.'cfg(target_os = "linux")'.dependencies]
gtk = "0.18"
Expand Down
3 changes: 2 additions & 1 deletion src-tauri/src/kicad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ pub fn kicad_open(program: String, project: String) -> Result<(), String> {
/// The AppImage's launcher points GTK, GIO and XDG_DATA_DIRS into the image
/// (`$APPDIR/usr/…`). KiCad must start with the system's own, so those entries
/// are dropped from what the child inherits (and KiVi's own GTK_USE_PORTAL, picker.rs).
fn outside_appimage(cmd: &mut Command) {
/// Also used for the terminal's shell (terminal.rs).
pub(crate) fn outside_appimage(cmd: &mut Command) {
crate::picker::clean_child_env(cmd);
let Some(appdir) = std::env::var("APPDIR").ok().filter(|d| !d.is_empty()) else { return };
for (k, v) in appimage_env_fixes(&appdir, std::env::vars()) {
Expand Down
7 changes: 7 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ mod git;
mod git_http;
mod kicad;
mod picker;
mod terminal;

use std::path::{Path, PathBuf};
use std::sync::Mutex;
Expand Down Expand Up @@ -263,8 +264,14 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.manage(Workspace::default())
.manage(terminal::imp::Terminals::default())
.invoke_handler(tauri::generate_handler![
picker::pick_folder,
terminal::imp::term_open,
terminal::imp::term_write,
terminal::imp::term_resize,
terminal::imp::term_attach,
terminal::imp::term_close,
open_folder,
list_folder,
read_file,
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn use_portal() {
}
}

/// Undo `use_portal` for a program KiVi starts (KiCad).
/// Undo `use_portal` for a program KiVi starts (KiCad, the terminal's shell).
pub fn clean_child_env(cmd: &mut std::process::Command) {
if std::env::var_os("KIVI_SET_GTK_USE_PORTAL").is_some() {
cmd.env_remove("GTK_USE_PORTAL").env_remove("KIVI_SET_GTK_USE_PORTAL");
Expand Down
Loading
Loading