DRY pass #2, batch 7, F21: the desktop's main window, clock and launcher dir (#5372)

- lib.rs MAIN_WINDOW: the "main" window label that the reminder worker,
  the capture window and the shell each wrote, 5 sites in all.
- lib.rs now_ms(): the epoch-milliseconds clock that the reminder worker
  and autosync's cycle stamp each computed. LastCycle.at_ms becomes i64,
  the same number on the wire.
- integration.rs applications_dir(): the XDG launcher directory that the
  entry path and the desktop-database refresh each built.

rustfmt --check is clean in the CI image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 15:00:03 -04:00
co-authored by Claude Opus 5.5
parent 00dc8840cc
commit 17076d6a79
5 changed files with 29 additions and 20 deletions
+7 -2
View File
@@ -42,8 +42,13 @@ fn appimage_path() -> Option<PathBuf> {
std::env::var_os("APPIMAGE").map(PathBuf::from)
}
/// Where per-user launchers live (XDG): `~/.local/share/applications`.
fn applications_dir(home: &Path) -> PathBuf {
home.join(".local/share/applications")
}
fn desktop_entry_path() -> Option<PathBuf> {
home().map(|h| h.join(".local/share/applications").join(DESKTOP_ENTRY_NAME))
home().map(|h| applications_dir(&h).join(DESKTOP_ENTRY_NAME))
}
fn icon_path() -> Option<PathBuf> {
@@ -154,7 +159,7 @@ fn set_executable(_p: &Path) -> Result<(), String> {
// Best-effort: refresh the desktop database so the entry appears promptly. The entry
// still works on next login without it, so failures are ignored.
fn refresh_desktop_database(home: &Path) {
let apps = home.join(".local/share/applications");
let apps = applications_dir(home);
let _ = std::process::Command::new("update-desktop-database")
.arg(&apps)
.output();