Skip to content

Commit d0e86ee

Browse files
committed
fix(gui): open config in system editor on Linux/Windows (#125)
The Advanced page's config-path link hardcoded macOS `open`, so the intended workaround for users wanting YAML highlighting silently failed on Linux and Windows. Route through the existing `opener` dependency (xdg-open / ShellExecuteW), surface launcher errors via send_log, and update the help text to point users at the link for larger edits. Also tighten the Advanced config row layout: cap the path TouchArea at 60% of row width and add a trailing spacer so "Config:", path, and "(Change)" stay visually grouped on the left and elide cleanly when narrow.
1 parent f9d4f07 commit d0e86ee

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

crates/vykar-gui/src/worker/config_cmds.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ use super::shared::select_repo_or_log;
1313
use super::WorkerContext;
1414

1515
pub(super) fn handle_open_config_file(ctx: &WorkerContext) {
16-
let path = ctx.runtime.source.path().display().to_string();
17-
send_log(&ctx.ui_tx, format!("Opening config file: {path}"));
18-
let _ = std::process::Command::new("open").arg(&path).spawn();
16+
let path = ctx.runtime.source.path();
17+
send_log(
18+
&ctx.ui_tx,
19+
format!("Opening config file: {}", path.display()),
20+
);
21+
if let Err(e) = opener::open(path) {
22+
send_log(
23+
&ctx.ui_tx,
24+
format!(
25+
"Failed to open config file in system editor ({}): {e}",
26+
path.display()
27+
),
28+
);
29+
}
1930
}
2031

2132
pub(super) fn handle_reload_config(ctx: &mut WorkerContext) {

crates/vykar-gui/ui/pages/advanced.slint

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export component AdvancedPage inherits Rectangle {
5656
spacing: 8px;
5757
Text { text: "Config:"; vertical-alignment: center; font-weight: 700; }
5858
TouchArea {
59-
horizontal-stretch: 1;
59+
max-width: parent.width * 0.6;
6060
mouse-cursor: pointer;
6161
clicked => { root.open_config_clicked(); }
6262
Text { text: root.config_path; color: #4a90d9; vertical-alignment: center; overflow: elide; }
@@ -66,10 +66,11 @@ export component AdvancedPage inherits Rectangle {
6666
clicked => { root.switch_config_clicked(); }
6767
Text { text: "(Change)"; color: #4a90d9; vertical-alignment: center; font-size: 12px; }
6868
}
69+
Rectangle { horizontal-stretch: 1; }
6970
}
7071

7172
Text {
72-
text: "You can edit Vykar's YAML config below. This will be saved to disk and can also be used by the command line client. We plan on adding a prettier interface for editing the configuration in the future.";
73+
text: "Edit Vykar's YAML config below for quick changes, or click the path above to open it in your system editor (recommended for larger edits — gives you syntax highlighting and search).";
7374
wrap: word-wrap;
7475
color: #888888;
7576
font-size: 12px;

0 commit comments

Comments
 (0)