Skip to content
Draft
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
27 changes: 13 additions & 14 deletions rust/limux-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,23 +1099,22 @@ async fn run_browser(
let sid = surface
.clone()
.ok_or_else(|| anyhow!("browser screenshot requires a surface"))?;
let mut payload =
browser_call(client, Some(sid), "browser.screenshot", Map::new()).await?;
let out = parse_opt(&browser_args, "--out");
let mut path = get_string(&payload, &["path"])
.unwrap_or_else(|| "/tmp/limux-browser-shot.png".to_string());
if let Some(out_path) = out {
path = out_path;
}
if !Path::new(&path).exists() {
if let Some(parent) = Path::new(&path).parent() {
fs::create_dir_all(parent).with_context(|| {
format!("failed to create screenshot directory {}", parent.display())
})?;
let mut params = Map::new();
if let Some(ref out_path) = out {
if let Some(parent) = Path::new(out_path).parent() {
if !parent.as_os_str().is_empty() {
fs::create_dir_all(parent).with_context(|| {
format!("failed to create screenshot directory {}", parent.display())
})?;
}
}
fs::write(&path, [])
.with_context(|| format!("failed to create screenshot {}", path))?;
params.insert("path".to_string(), Value::String(out_path.clone()));
}
let mut payload = browser_call(client, Some(sid), "browser.screenshot", params).await?;
let path = get_string(&payload, &["path"])
.or(out)
.unwrap_or_else(|| "/tmp/limux-browser-shot.png".to_string());
let url = format!("file://{}", path);
if let Some(obj) = payload.as_object_mut() {
obj.insert("path".to_string(), Value::String(path.clone()));
Expand Down
40 changes: 12 additions & 28 deletions rust/limux-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2689,37 +2689,21 @@ impl ControlState {
}
true
}
"down" | "ctrl+n" | "ctrl+j" => {
if palette_visible {
self.command_palette_move_selection(window_id, 1);
true
} else {
false
}
"down" | "ctrl+n" | "ctrl+j" if palette_visible => {
self.command_palette_move_selection(window_id, 1);
true
}
"up" | "ctrl+p" | "ctrl+k" => {
if palette_visible {
self.command_palette_move_selection(window_id, -1);
true
} else {
false
}
"up" | "ctrl+p" | "ctrl+k" if palette_visible => {
self.command_palette_move_selection(window_id, -1);
true
}
"cmd+a" => {
if palette_visible {
self.command_palette_select_all(window_id);
true
} else {
false
}
"cmd+a" if palette_visible => {
self.command_palette_select_all(window_id);
true
}
"enter" => {
if palette_visible {
self.command_palette_enter(window_id);
true
} else {
false
}
"enter" if palette_visible => {
self.command_palette_enter(window_id);
true
}
_ => false,
}
Expand Down
Loading
Loading