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
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@
</p>

<p align="center">
<img src="https://img.shields.io/github/v/release/Origin-AI-IDE/origin" alt="Version" />
<img src="https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey" alt="Platform" />
<img src="https://img.shields.io/badge/built%20with-Tauri%202-orange" alt="Tauri" />
<img src="https://img.shields.io/badge/license-Apache%202.0-green" alt="License" />
<img src="https://github.com/Origin-AI-IDE/origin/actions/workflows/ci.yml/badge.svg" alt="CI" />
<a href="https://github.com/Origin-AI-IDE/origin/releases">
<img src="https://img.shields.io/github/v/release/Origin-AI-IDE/origin" alt="Version" />
</a>
<a href="https://github.com/Origin-AI-IDE/origin/releases">
<img src="https://img.shields.io/github/downloads/Origin-AI-IDE/origin/total?color=2ea043" alt="Downloads" />
</a>
<a href="https://github.com/Origin-AI-IDE/origin">
<img src="https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey" alt="Platform" />
</a>
<a href="https://tauri.app/">
<img src="https://img.shields.io/badge/built%20with-Tauri%202-orange" alt="Tauri" />
</a>
<a href="https://github.com/Origin-AI-IDE/origin/blob/main/LICENSE">
<img src="https://img.shields.io/badge/license-Apache%202.0-green" alt="License" />
</a>
<a href="https://github.com/Origin-AI-IDE/origin/actions/workflows/ci.yml">
<img src="https://img.shields.io/github/actions/workflow/status/Origin-AI-IDE/origin/ci.yml?branch=main&label=build" alt="CI" />
</a>
</p>


## Screenshots

<img src="media/origin-1-ss.png" alt="Origin IDE - Welcome screen with AI panel" width="100%" />
Expand Down
2 changes: 2 additions & 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: 3 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] }

[dependencies]
tauri = { version = "2", features = [] }
tauri = { version = "2", features = ["unstable"] }
url = "2"
dpi = "0.1"
tauri-plugin-opener = "2"
tauri-plugin-store = "2"
tauri-plugin-dialog = "2"
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"sql:default",
"sql:allow-execute",
"updater:default",
"process:allow-restart"
"process:allow-restart",
"core:webview:allow-create-webview",
"core:webview:allow-set-webview-position",
"core:webview:allow-set-webview-size",
"core:webview:allow-webview-close"
]
}
62 changes: 62 additions & 0 deletions src-tauri/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,68 @@ pub fn create_dir_cmd(path: String) -> Result<(), String> {
std::fs::create_dir_all(&path).map_err(|e| e.to_string())
}

/// Returns the config base directory for a known editor on the current OS.
/// e.g. editor_config_dir("Code") → C:\Users\<user>\AppData\Roaming\Code
fn editor_config_dir(folder_name: &str) -> Result<std::path::PathBuf, String> {
#[cfg(windows)]
{
let appdata = std::env::var("APPDATA").map_err(|_| "APPDATA not set".to_string())?;
Ok(std::path::PathBuf::from(appdata).join(folder_name))
}
#[cfg(target_os = "macos")]
{
let home = std::env::var("HOME").map_err(|_| "HOME not set".to_string())?;
Ok(std::path::PathBuf::from(home)
.join("Library")
.join("Application Support")
.join(folder_name))
}
#[cfg(target_os = "linux")]
{
let config = std::env::var("XDG_CONFIG_HOME").unwrap_or_else(|_| {
let home = std::env::var("HOME").unwrap_or_default();
format!("{home}/.config")
});
Ok(std::path::PathBuf::from(config).join(folder_name))
}
}

fn editor_folder(id: &str) -> Option<&'static str> {
match id {
"vscode" => Some("Code"),
"cursor" => Some("Cursor"),
"windsurf" => Some("Windsurf"),
_ => None,
}
}

/// Read the keybindings.json for a given editor (vscode | cursor | windsurf).
#[tauri::command]
pub fn read_editor_keybindings(editor: String) -> Result<String, String> {
let folder = editor_folder(&editor)
.ok_or_else(|| format!("Unknown editor: {editor}"))?;
let path = editor_config_dir(folder)?
.join("User")
.join("keybindings.json");
std::fs::read_to_string(&path)
.map_err(|e| format!("Could not read {}: {e}", path.display()))
}

/// Returns which of vscode / cursor / windsurf have a keybindings.json on disk.
#[tauri::command]
pub fn detect_installed_editors() -> Vec<String> {
["vscode", "cursor", "windsurf"]
.iter()
.filter(|&&id| {
editor_folder(id)
.and_then(|f| editor_config_dir(f).ok())
.map(|p| p.join("User").join("keybindings.json").exists())
.unwrap_or(false)
})
.map(|s| s.to_string())
.collect()
}

#[tauri::command]
pub fn reveal_in_explorer(path: String) -> Result<(), String> {
#[cfg(windows)]
Expand Down
88 changes: 88 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,88 @@ mod system;
mod terminal;
mod tree;

use tauri::{AppHandle, Manager, WebviewBuilder, WebviewUrl};
use dpi::{LogicalPosition, LogicalSize};

// IMPORTANT: these commands MUST be `async fn`.
//
// `Window::add_child` (Tauri 2.11.2) dispatches the webview build onto the main
// thread via `run_on_main_thread` and then *blocks* on `rx.recv()` waiting for
// the result. A synchronous `#[tauri::command]` runs on the main thread itself,
// so the command would dispatch work to the main thread and then block that same
// thread waiting for it — a self-deadlock. The spinner would spin forever.
//
// Declaring the command `async` makes Tauri run it on its async runtime thread
// pool instead of the main thread, so the dispatch-and-wait completes normally.
#[tauri::command]
async fn embed_ide_panel(
app: AppHandle,
panel_id: String,
url: String,
x: f64,
y: f64,
width: f64,
height: f64,
) -> Result<(), String> {
// Destroy any existing embedded webview with this label first
if let Some(existing) = app.get_webview(&panel_id) {
let _ = existing.close();
}
let host = app
.get_webview_window("main")
.ok_or_else(|| "Host window not found".to_string())?;
let window = host.as_ref().window();
let parsed_url = url::Url::parse(&url).map_err(|e| e.to_string())?;
window
.add_child(
WebviewBuilder::new(&panel_id, WebviewUrl::External(parsed_url)),
LogicalPosition::new(x, y),
LogicalSize::new(width, height),
)
.map_err(|e| e.to_string())?;
Ok(())
}

#[tauri::command]
async fn resize_ide_panel(
app: AppHandle,
panel_id: String,
x: f64,
y: f64,
width: f64,
height: f64,
) -> Result<(), String> {
if let Some(webview) = app.get_webview(&panel_id) {
webview
.set_position(LogicalPosition::new(x, y))
.map_err(|e| e.to_string())?;
webview
.set_size(LogicalSize::new(width, height))
.map_err(|e| e.to_string())?;
}
Ok(())
}

#[tauri::command]
async fn destroy_ide_panel(
app: AppHandle,
panel_id: String,
) -> Result<(), String> {
if let Some(webview) = app.get_webview(&panel_id) {
webview.close().map_err(|e| e.to_string())?;
}
Ok(())
}

#[tauri::command]
async fn get_ide_panel_url(app: AppHandle, panel_id: String) -> Result<String, String> {
if let Some(webview) = app.get_webview(&panel_id) {
webview.url().map(|u| u.to_string()).map_err(|e| e.to_string())
} else {
Err("panel not found".to_string())
}
}

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
Expand All @@ -32,6 +114,8 @@ pub fn run() {
fs::delete_path,
fs::create_dir_cmd,
fs::reveal_in_explorer,
fs::read_editor_keybindings,
fs::detect_installed_editors,
git::git_branch,
git::git_changes,
git::git_status_files,
Expand All @@ -58,6 +142,10 @@ pub fn run() {
dap::dap_start,
dap::dap_request,
dap::dap_stop,
embed_ide_panel,
resize_ide_panel,
destroy_ide_panel,
get_ide_panel_url,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
Expand Down
20 changes: 16 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,22 @@
}, [activeTab, debugCtx.session.breakpoints, debugCtx.session.stackFrames]);

const { isFullscreen, toggleFullscreen } = useGlobalKeybindings({
saveActive: () => { if (activeTab) handleSave(activeTab); },
toggleTerminal: () => setTerminalOpen(v => !v),
togglePalette: () => setPaletteOpen(v => !v),
toggleSettings: () => setSettingsOpen(v => !v),
saveActive: () => { if (activeTab) handleSave(activeTab); },
toggleTerminal: () => setTerminalOpen(v => !v),
togglePalette: () => setPaletteOpen(v => !v),
toggleSettings: () => setSettingsOpen(v => !v),
newFile: () => handleNewFile(),
openFile: () => handleOpenFile(),
closeTab: () => { if (activeTab) closeTab(activeTab); },
toggleSidebar: () => setSidebarOpen(v => !v),
zoomIn: () => handleZoomIn(),
zoomOut: () => handleZoomOut(),
zoomReset: () => handleZoomReset(),
startDebug: () => { setSidebarOpen(true); debugCtx.startSession?.(); },

Check failure on line 226 in src/App.tsx

View workflow job for this annotation

GitHub Actions / Frontend

Expected 1 arguments, but got 0.
stopDebug: () => debugCtx.stopSession(),
stepOver: () => debugCtx.stepOver?.(),
stepInto: () => debugCtx.stepIn?.(),
stepOut: () => debugCtx.stepOut?.(),
});

async function completeOnboarding() {
Expand Down
Loading
Loading