Skip to content

Commit d0834df

Browse files
author
rbenzing
committed
feat: open localhost in browser from Apache row
1 parent 685141a commit d0834df

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/ui.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,20 @@ fn service_row(
292292
open_in_editor(config_path);
293293
}
294294

295+
// Open in browser — Apache only
296+
if svc == Service::Apache {
297+
let port = status.effective_port.unwrap_or(configured_port);
298+
let is_running = status.state == ServiceState::Running;
299+
let open_resp = ui.add_enabled(is_running, egui::Button::new("↗ Open"));
300+
let clicked = open_resp.clicked();
301+
if !is_running {
302+
open_resp.on_disabled_hover_text("Apache must be Running");
303+
}
304+
if clicked {
305+
open_in_browser(&format!("http://localhost:{port}"));
306+
}
307+
}
308+
295309
// Admin controls — only on the MySQL row when show_admin is true
296310
if show_admin {
297311
let all_up = mysql_running && php_running && apache_running;
@@ -374,3 +388,9 @@ fn open_in_editor(path: &std::path::Path) {
374388
.args(["/c", "start", "", &path.to_string_lossy()])
375389
.spawn();
376390
}
391+
392+
fn open_in_browser(url: &str) {
393+
let _ = std::process::Command::new("cmd")
394+
.args(["/c", "start", "", url])
395+
.spawn();
396+
}

0 commit comments

Comments
 (0)