Skip to content

Commit

Permalink
fix: Populate Application Title On Startup (#19)
Browse files Browse the repository at this point in the history
Enabling `multi-window` feature in `libcosmic`.
Builtin function `set_window_title` correctly sets application title on
startup.

This may be a temporary workaround. cosmicding may not benefit from
mutli winodw capability.

Resolves #10.
  • Loading branch information
vkhitrin authored Dec 8, 2024
1 parent 88df760 commit dfd06ae
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,18 @@ features = ["fluent-system", "desktop-requester"]
[dependencies.libcosmic]
git = "https://github.com/pop-os/libcosmic"
default-features = false
features = ["dbus-config", "tokio", "winit", "wgpu"]
# features = ["dbus-config", "tokio", "winit", "wgpu"]
features = [
"a11y",
"dbus-config",
# NOTE: (vkhitrin) this is a temporary workaround to set initial
# application title.
"multi-window",
"single-instance",
"tokio",
"winit",
"wgpu",
]
rev = "953685a88267894ea3fa40f2b99139c3c4e784d6"
version = "0.1.0"

Expand Down
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ sudo just install

## Roadmap

### Known isuses

- [Application] After updating to [libcosmic#953685a88267894ea3fa40f2b99139c3c4e784d6](https://github.com/pop-os/libcosmic/tree/953685a88267894ea3fa40f2b99139c3c4e784d6),
application title is not updated until navigrating manually to a page.

### Future

Potential improvements:
Expand Down
8 changes: 5 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,14 +1028,16 @@ impl Cosmicding {
cosmic::app::command::set_theme(theme)
}

// FIXME: (vkhitrin) title is not set on application startup
// it is updated when navigating between pages.
pub fn update_title(&mut self) -> Task<Message> {
let window_title = match self.nav.text(self.nav.active()) {
Some(page) => format!("{page} — {}", fl!("cosmicding")),
_ => fl!("cosmicding"),
};
self.set_window_title(window_title)
if let Some(id) = self.core.main_window_id() {
self.set_window_title(window_title, id)
} else {
Task::none()
}
}
}

Expand Down

0 comments on commit dfd06ae

Please sign in to comment.