- Double-clicking a file or choosing the new 'Öppna' context-menu item asks TUI-WM to open it via $TUI_WM_SOCKET (open_file), inheriting the user's file associations and default editor - Outside TUI-WM the configured text_editor is used instead: the TUI suspends, runs the editor on the same terminal and resumes - Directories keep navigating as before Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
44 lines
948 B
Rust
44 lines
948 B
Rust
mod app;
|
|
mod config;
|
|
mod file_ops;
|
|
mod theme;
|
|
mod tui_wm;
|
|
mod ui;
|
|
mod events;
|
|
|
|
use std::io;
|
|
use crossterm::{
|
|
event::{DisableMouseCapture, EnableMouseCapture},
|
|
execute,
|
|
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
|
};
|
|
use ratatui::{backend::CrosstermBackend, Terminal};
|
|
|
|
use app::App;
|
|
use events::run_app;
|
|
|
|
fn main() -> io::Result<()> {
|
|
enable_raw_mode()?;
|
|
let mut stdout = io::stdout();
|
|
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
|
|
let backend = CrosstermBackend::new(stdout);
|
|
let mut terminal = Terminal::new(backend)?;
|
|
|
|
let mut app = App::new();
|
|
let res = run_app(&mut terminal, &mut app);
|
|
|
|
disable_raw_mode()?;
|
|
execute!(
|
|
terminal.backend_mut(),
|
|
LeaveAlternateScreen,
|
|
DisableMouseCapture
|
|
)?;
|
|
terminal.show_cursor()?;
|
|
|
|
if let Err(err) = res {
|
|
eprintln!("Error: {:?}", err);
|
|
}
|
|
|
|
Ok(())
|
|
}
|