Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ae9bf59
I hate you
BatistaCakewalk Nov 20, 2026
637bc67
hate this
BatistaCakewalk Nov 20, 2026
66150f1
Somewhat working concept
BatistaCakewalk Nov 20, 2026
ce80950
updates
BatistaCakewalk Nov 20, 2026
2054f75
updates
BatistaCakewalk Nov 20, 2026
c417a3e
actual terminal this time
BatistaCakewalk Nov 20, 2026
6b64317
unicode
BatistaCakewalk Nov 20, 2026
eaa885c
Amending this shit
BatistaCakewalk Nov 20, 2026
b2282b4
Actual working shell?!
BatistaCakewalk Nov 21, 2026
ba6effa
yeah yeah
BatistaCakewalk Nov 21, 2026
97b6f32
feat(workspace): open-project popup + second-instance forwarding
BatistaCakewalk Nov 21, 2026
39feeab
fix(ui): window title encoding + split bottom dock into left/right pa…
BatistaCakewalk Nov 21, 2026
2857c9e
fix(ui): suppress open-project popup on welcome screen + fix bottom d…
BatistaCakewalk Nov 21, 2026
9071df7
fix(ui): block splash context menu + friendly git-not-initialized mes…
BatistaCakewalk Nov 21, 2026
3e42adf
fix(ui): hide huge git error text when not a repo
BatistaCakewalk Nov 21, 2026
9e384d7
fix(ui): remove duplicate git error text + auto-refresh git status
BatistaCakewalk Nov 21, 2026
ec41b68
hate this
BatistaCakewalk Nov 20, 2026
94b1930
Somewhat working concept
BatistaCakewalk Nov 20, 2026
a2ef648
updates
BatistaCakewalk Nov 20, 2026
3d6466f
updates
BatistaCakewalk Nov 20, 2026
d566953
actual terminal this time
BatistaCakewalk Nov 20, 2026
8dd8d6d
unicode
BatistaCakewalk Nov 20, 2026
e99873d
Amending this shit
BatistaCakewalk Nov 20, 2026
80f9f6d
Actual working shell?!
BatistaCakewalk Nov 21, 2026
93d62a9
yeah yeah
BatistaCakewalk Nov 21, 2026
a8d8b4e
feat(workspace): open-project popup + second-instance forwarding
BatistaCakewalk Nov 21, 2026
4abc95b
fix(ui): window title encoding + split bottom dock into left/right pa…
BatistaCakewalk Nov 21, 2026
b50acc8
fix(ui): suppress open-project popup on welcome screen + fix bottom d…
BatistaCakewalk Nov 21, 2026
1be07c5
fix(ui): block splash context menu + friendly git-not-initialized mes…
BatistaCakewalk Nov 21, 2026
bd60eac
fix(ui): hide huge git error text when not a repo
BatistaCakewalk Nov 21, 2026
67d9a62
fix(ui): remove duplicate git error text + auto-refresh git status
BatistaCakewalk Nov 21, 2026
17b1006
Merge remote-tracking branch 'origin/features/MoreIDEShellWork' into …
mas6y6 Nov 21, 2026
7b61056
Delete Cargo.lock
mas6y6 Nov 21, 2026
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
6,854 changes: 0 additions & 6,854 deletions Cargo.lock

This file was deleted.

1 change: 1 addition & 0 deletions luma-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ luma-diagnostics = { path = "../luma-diagnostics" }
anyhow = "1.0.104"
tauri-plugin-decorum = "1.1.1"
uuid = { version = "1.29.3", features = ["v4"] }
portable-pty = "0.8"

[target.'cfg(windows)'.dependencies]
windows = { version = "0.62", features = ["Win32_Foundation", "Win32_Graphics_Gdi"] }
Expand Down
1 change: 1 addition & 0 deletions luma-tauri/capabilities/startup.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"notification:allow-request-permission",
"notification:allow-notify",
"core:window:allow-close",
"core:window:allow-destroy",
"core:window:allow-minimize",
"core:window:allow-toggle-maximize",
"core:window:allow-start-dragging",
Expand Down
2 changes: 1 addition & 1 deletion luma-tauri/gen/schemas/capabilities.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"startup":{"identifier":"startup","description":"Permissions for Luma's startup and IDE windows.","local":true,"windows":["*"],"permissions":["core:default","dialog:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:allow-notify","core:window:allow-close","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-start-dragging","core:window:allow-set-focus"]}}
{"startup":{"identifier":"startup","description":"Permissions for Luma's startup and IDE windows.","local":true,"windows":["*"],"permissions":["core:default","dialog:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:allow-notify","core:window:allow-close","core:window:allow-destroy","core:window:allow-minimize","core:window:allow-toggle-maximize","core:window:allow-start-dragging","core:window:allow-set-focus"]}}
154 changes: 121 additions & 33 deletions luma-tauri/src/rust/base_invokes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,55 @@ use anyhow::Context;
use luma_api::projects::{Project, RecentProjects};
use serde::{Deserialize, Serialize};
use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::{OnceLock, RwLock},
time::{SystemTime, UNIX_EPOCH},
};
use tauri::{Emitter, Manager, WebviewUrl, WebviewWindowBuilder};
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
use uuid::Uuid;

static ACTIVE_WORKSPACE: OnceLock<RwLock<Option<Project>>> = OnceLock::new();
/// Workspace open in each IDE window, keyed by window label ("main", "main-2", ...).
static WINDOW_WORKSPACES: OnceLock<RwLock<HashMap<String, Project>>> = OnceLock::new();

pub fn active_workspace() -> &'static RwLock<Option<Project>> {
ACTIVE_WORKSPACE.get_or_init(|| RwLock::new(None))
fn window_workspaces() -> &'static RwLock<HashMap<String, Project>> {
WINDOW_WORKSPACES.get_or_init(|| RwLock::new(HashMap::new()))
}

/// The workspace currently open in the IDE window with this label.
pub fn workspace_for_window(label: &str) -> Option<Project> {
window_workspaces().read().ok()?.get(label).cloned()
}

fn is_ide_label(label: &str) -> bool {
label == "main" || label.starts_with("main-")
}

pub(crate) fn free_main_label(app: &tauri::AppHandle) -> String {
if app.get_webview_window("main").is_none() {
return "main".to_string();
}
let mut n = 2;
loop {
let label = format!("main-{n}");
if app.get_webview_window(&label).is_none() {
return label;
}
n += 1;
}
}

/// "This window" reuses the calling IDE window; otherwise (new window, or called
/// from the startup window) the lowest free IDE label is used.
fn target_window_label(
app: &tauri::AppHandle,
caller: &tauri::WebviewWindow,
new_window: bool,
) -> String {
if !new_window && is_ide_label(caller.label()) {
return caller.label().to_string();
}
free_main_label(app)
}

fn unix_timestamp() -> u64 {
Expand All @@ -25,7 +63,7 @@ fn unix_timestamp() -> u64 {

/// Strip the Windows verbatim prefix (`\\?\C:\...`) that `canonicalize` adds so
/// stored and displayed paths look normal. `\\?\UNC\...` paths are left alone.
fn clean_path(path: PathBuf) -> PathBuf {
pub(crate) fn clean_path(path: PathBuf) -> PathBuf {
#[cfg(windows)]
{
let text = path.to_string_lossy();
Expand Down Expand Up @@ -272,29 +310,41 @@ fn record_recent_workspace(mut project: Project) -> Result<Project, tauri::ipc::
Ok(project)
}

fn open_main_window(app: &tauri::AppHandle, project: &Project) -> anyhow::Result<()> {
fn open_main_window(app: &tauri::AppHandle, project: &Project, label: &str) -> anyhow::Result<()> {
let title = format!("Luma — {}", project.title);

let window = if let Some(window) = app.get_webview_window("main") {
let window = if let Some(window) = app.get_webview_window(label) {
window.set_title(&title)?;
window
} else {
WebviewWindowBuilder::new(app, "main", WebviewUrl::App("windows/main.html".into()))
let window = WebviewWindowBuilder::new(app, label, WebviewUrl::App("windows/main.html".into()))
.visible(false)
.decorations(!cfg!(target_os = "windows"))
.min_inner_size(1050.0, 600.0)
.title(&title)
.background_color(crate::STARTUP_COLOR)
.build()
.context("Failed to create the IDE window")?
.context("Failed to create the IDE window")?;

// Forget this window's workspace once it is gone.
let owned_label = label.to_string();
window.on_window_event(move |event| {
if matches!(event, tauri::WindowEvent::Destroyed) {
if let Ok(mut map) = window_workspaces().write() {
map.remove(&owned_label);
}
}
});
window
};

window.show().context("Failed to show the IDE window")?;
window
.set_focus()
.context("Failed to focus the IDE window")?;

app.emit("workspace-opened", project.clone())?;
// No global broadcast: each IDE window loads its own workspace via
// `get_active_workspace` (new windows) or the `open_workspace` return value.
if let Some(startup) = app.get_webview_window("startup") {
if startup.label() != window.label() {
startup
Expand Down Expand Up @@ -358,6 +408,29 @@ pub async fn get_recent_workspaces() -> Result<Vec<Project>, tauri::ipc::InvokeE
Ok(workspaces)
}

#[tauri::command]
pub async fn load_tool_window_layout(workspace_path: String) -> Result<Option<String>, tauri::ipc::InvokeError> {
let workspace = PathBuf::from(&workspace_path).canonicalize().context("Workspace folder does not exist").map_err(tauri::ipc::InvokeError::from_anyhow)?;
if !workspace.is_dir() { return Err(tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!("Workspace path is not a directory"))); }
let path = workspace.join(".luma").join("tool-windows.json");
match std::fs::read_to_string(path) {
Ok(contents) => { serde_json::from_str::<serde_json::Value>(&contents).context("Invalid tool-window layout JSON").map_err(tauri::ipc::InvokeError::from_anyhow)?; Ok(Some(contents)) },
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(None),
Err(error) => Err(tauri::ipc::InvokeError::from_anyhow(anyhow::Error::from(error).context("Failed to read tool-window layout"))),
}
}

#[tauri::command]
pub async fn save_tool_window_layout(workspace_path: String, layout: String) -> Result<(), tauri::ipc::InvokeError> {
let workspace = PathBuf::from(&workspace_path).canonicalize().context("Workspace folder does not exist").map_err(tauri::ipc::InvokeError::from_anyhow)?;
if !workspace.is_dir() { return Err(tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!("Workspace path is not a directory"))); }
let value: serde_json::Value = serde_json::from_str(&layout).context("Invalid tool-window layout JSON").map_err(tauri::ipc::InvokeError::from_anyhow)?;
if value.get("version").and_then(|v| v.as_u64()).is_none() { return Err(tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!("Unsupported tool-window layout version"))); }
let path = workspace.join(".luma").join("tool-windows.json");
let serialized = serde_json::to_string_pretty(&value)
.map_err(|error| tauri::ipc::InvokeError::from_anyhow(anyhow::Error::from(error)))?;
write_json_file(&path, &serialized)
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TemplateFile {
pub path: String,
Expand Down Expand Up @@ -547,15 +620,10 @@ pub async fn reveal_workspace(
}

#[tauri::command]
pub async fn get_active_workspace() -> Result<Option<Project>, tauri::ipc::InvokeError> {
active_workspace()
.read()
.map(|workspace| workspace.clone())
.map_err(|error| {
tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!(
"Failed to read active workspace: {error}"
))
})
pub async fn get_active_workspace(
window: tauri::WebviewWindow,
) -> Result<Option<Project>, tauri::ipc::InvokeError> {
Ok(workspace_for_window(window.label()))
}

#[tauri::command]
Expand Down Expand Up @@ -619,13 +687,13 @@ pub async fn open_devtools(window: tauri::WebviewWindow) -> Result<(), tauri::ip
Ok(())
}

#[tauri::command]
pub async fn open_workspace(
path: String,
app_handle: tauri::AppHandle,
) -> Result<(), tauri::ipc::InvokeError> {
log::info!("opening workspace {}", path);

/// Shared logic: open a workspace and show it in the IDE window with the given label.
/// Used both by the `open_workspace` command and by the single-instance callback.
pub(crate) async fn open_workspace_with_label(
app: &tauri::AppHandle,
path: &str,
label: &str,
) -> Result<Project, tauri::ipc::InvokeError> {
let workspace_path = clean_path(
PathBuf::from(path)
.canonicalize()
Expand Down Expand Up @@ -674,15 +742,35 @@ pub async fn open_workspace(
};
let project = record_recent_workspace(project)?;

*active_workspace().write().map_err(|error| {
tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!(
"Failed to update active workspace: {error}"
))
})? = Some(project.clone());
window_workspaces()
.write()
.map_err(|error| {
tauri::ipc::InvokeError::from_anyhow(anyhow::anyhow!(
"Failed to update active workspace: {error}"
))
})?
.insert(label.to_string(), project.clone());

open_main_window(&app_handle, &project)
open_main_window(app, &project, label)
.context("Failed to open IDE window")
.map_err(tauri::ipc::InvokeError::from_anyhow)?;

Ok(())
Ok(project)
}

#[tauri::command]
pub async fn open_workspace(
path: String,
new_window: Option<bool>,
app_handle: tauri::AppHandle,
window: tauri::WebviewWindow,
) -> Result<Project, tauri::ipc::InvokeError> {
log::info!("opening workspace {}", path);
let new_window = new_window.unwrap_or(false);
let label = target_window_label(&app_handle, &window, new_window);
open_workspace_with_label(&app_handle, &path, &label).await
}




50 changes: 23 additions & 27 deletions luma-tauri/src/rust/file_system.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::base_invokes::active_workspace;
use crate::base_invokes::workspace_for_window;
use anyhow::{Context, Result as AnyResult};
use serde::{Deserialize, Serialize};
use std::path::{Path, PathBuf};
Expand All @@ -19,13 +19,9 @@ pub struct DirectoryTree {
pub children: Option<Vec<DirectoryTree>>,
}

fn workspace_root() -> AnyResult<PathBuf> {
let guard = active_workspace()
.read()
.map_err(|error| anyhow::anyhow!("Failed to read active workspace lock: {error}"))?;
let project = guard
.as_ref()
.context("No active workspace")?;
/// Root of the workspace open in the IDE window with this label.
fn workspace_root(label: &str) -> AnyResult<PathBuf> {
let project = workspace_for_window(label).context("No active workspace")?;
PathBuf::from(&project.path)
.canonicalize()
.context("Active workspace path does not exist")
Expand All @@ -41,8 +37,8 @@ fn is_within(root: &Path, path: &Path) -> bool {
}
}

fn resolve_within_workspace(path: &Path) -> AnyResult<PathBuf> {
let root = workspace_root()?;
fn resolve_within_workspace(label: &str, path: &Path) -> AnyResult<PathBuf> {
let root = workspace_root(label)?;
let path = if path.is_relative() {
root.join(path)
} else {
Expand All @@ -55,8 +51,8 @@ fn resolve_within_workspace(path: &Path) -> AnyResult<PathBuf> {
Ok(canonical)
}

fn resolve_target_within_workspace(path: &Path) -> AnyResult<PathBuf> {
let root = workspace_root()?;
fn resolve_target_within_workspace(label: &str, path: &Path) -> AnyResult<PathBuf> {
let root = workspace_root(label)?;
let path = if path.is_relative() {
root.join(path)
} else {
Expand All @@ -77,9 +73,9 @@ fn resolve_target_within_workspace(path: &Path) -> AnyResult<PathBuf> {
}

#[tauri::command]
pub async fn read_file(path: String) -> Result<String, InvokeError> {
pub async fn read_file(window: tauri::WebviewWindow, path: String) -> Result<String, InvokeError> {
let target = PathBuf::from(&path);
let canonical = resolve_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let canonical = resolve_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
if !canonical.is_file() {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"Not a file: {}",
Expand All @@ -92,13 +88,13 @@ pub async fn read_file(path: String) -> Result<String, InvokeError> {
}

#[tauri::command]
pub async fn write_file(path: String, contents: String) -> Result<(), InvokeError> {
pub async fn write_file(window: tauri::WebviewWindow, path: String, contents: String) -> Result<(), InvokeError> {
let target = PathBuf::from(&path);
let parent = target
.parent()
.filter(|p| !p.as_os_str().is_empty())
.unwrap_or(target.as_path());
resolve_within_workspace(parent).map_err(InvokeError::from_anyhow)?;
resolve_within_workspace(window.label(), parent).map_err(InvokeError::from_anyhow)?;

if let Some(parent) = target.parent() {
std::fs::create_dir_all(parent)
Expand All @@ -120,9 +116,9 @@ pub async fn write_file(path: String, contents: String) -> Result<(), InvokeErro
}

#[tauri::command]
pub async fn create_file(path: String) -> Result<String, InvokeError> {
pub async fn create_file(window: tauri::WebviewWindow, path: String) -> Result<String, InvokeError> {
let target = PathBuf::from(&path);
let resolved = resolve_target_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let resolved = resolve_target_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
if resolved.exists() {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"File already exists: {}",
Expand All @@ -136,9 +132,9 @@ pub async fn create_file(path: String) -> Result<String, InvokeError> {
}

#[tauri::command]
pub async fn create_directory(path: String) -> Result<String, InvokeError> {
pub async fn create_directory(window: tauri::WebviewWindow, path: String) -> Result<String, InvokeError> {
let target = PathBuf::from(&path);
let resolved = resolve_target_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let resolved = resolve_target_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
if resolved.exists() {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"Directory already exists: {}",
Expand All @@ -152,10 +148,10 @@ pub async fn create_directory(path: String) -> Result<String, InvokeError> {
}

#[tauri::command]
pub async fn delete_entry(path: String) -> Result<(), InvokeError> {
pub async fn delete_entry(window: tauri::WebviewWindow, path: String) -> Result<(), InvokeError> {
let target = PathBuf::from(&path);
let canonical = resolve_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let root = workspace_root().map_err(InvokeError::from_anyhow)?;
let canonical = resolve_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
let root = workspace_root(window.label()).map_err(InvokeError::from_anyhow)?;
if canonical == root {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"Cannot delete the workspace root"
Expand All @@ -173,9 +169,9 @@ pub async fn delete_entry(path: String) -> Result<(), InvokeError> {
}

#[tauri::command]
pub async fn read_directory(path: String) -> Result<Vec<FileEntry>, InvokeError> {
pub async fn read_directory(window: tauri::WebviewWindow, path: String) -> Result<Vec<FileEntry>, InvokeError> {
let target = PathBuf::from(&path);
let canonical = resolve_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let canonical = resolve_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
if !canonical.is_dir() {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"Not a directory: {}",
Expand Down Expand Up @@ -217,9 +213,9 @@ pub async fn read_directory(path: String) -> Result<Vec<FileEntry>, InvokeError>
}

#[tauri::command]
pub async fn read_directory_tree(path: String) -> Result<DirectoryTree, InvokeError> {
pub async fn read_directory_tree(window: tauri::WebviewWindow, path: String) -> Result<DirectoryTree, InvokeError> {
let target = PathBuf::from(&path);
let canonical = resolve_within_workspace(&target).map_err(InvokeError::from_anyhow)?;
let canonical = resolve_within_workspace(window.label(), &target).map_err(InvokeError::from_anyhow)?;
if !canonical.is_dir() {
return Err(InvokeError::from_anyhow(anyhow::anyhow!(
"Not a directory: {}",
Expand Down
Loading
Loading