Skip to content

Commit

Permalink
set window title based on the repository path
Browse files Browse the repository at this point in the history
  • Loading branch information
gulbanana committed Mar 19, 2024
1 parent 04c1008 commit 9e2ce1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Git remotes in the status bar, with push & fetch commands.
- "Create branch" command on revisions.
- Display edges to commits that aren't in the queried revset, by drawing a line to nowhere.
- Window title includes the repository path.
- New config option gg.queries.log-page-size.
- Miscellaneous design improvements.

Expand Down
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ These changes may or may not be implemented in the future.
* feat: view commit ids in log (configurable?)
* feat: view repo at different ops (slider? entire pane?)
* feat: progress display (probably in statusbar); useful for git & snapshot
* feat: repo in title
* feat: finish branch management
* feat: structured op descs - want to be able to present them more nicely, extracting ids etc. tags?
- there's a request for this to be part of jj
Expand Down
10 changes: 10 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,20 @@ fn try_open_repository(window: &Window, cwd: Option<PathBuf>) -> Result<()> {
match call_rx.recv()? {
Ok(config) => {
log::debug!("load workspace succeeded");
match &config {
messages::RepoConfig::Workspace { absolute_path, .. } => {
window
.set_title((String::from("GG - ") + absolute_path.0.as_str()).as_str())?;
}
_ => {
window.set_title("GG - Gui for JJ")?;
}
}
window.emit("gg://repo/config", config)?;
}
Err(err) => {
log::warn!("load workspace failed: {err}");
window.set_title("GG - Gui for JJ")?;
window.emit(
"gg://repo/config",
messages::RepoConfig::LoadError {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ where
derive(TS),
ts(export, export_to = "../src/messages/")
)]
pub struct DisplayPath(String);
pub struct DisplayPath(pub String);

impl<T: AsRef<Path>> From<T> for DisplayPath {
fn from(value: T) -> Self {
Expand Down

0 comments on commit 9e2ce1b

Please sign in to comment.