aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ts
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-11 18:21:21 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-06-11 18:21:21 +0200
commit77ad4b8b7ab93cc3d4d7f8152811d02eae453ad2 (patch)
treee3ed22bb788d660b80cca76f8c97f6855892aa23 /pkgs/by-name/ts
parentpkgs/tskm/open: Define the default tab as an empty tab (diff)
downloadnixos-config-77ad4b8b7ab93cc3d4d7f8152811d02eae453ad2.zip
pkgs/tskm/open: Make the session reading code more error tolerant
I have no idea, why qutebrowser sometimes skips writing these values. But as it does so, we must fill them in with reasonable defaults.
Diffstat (limited to 'pkgs/by-name/ts')
-rw-r--r--pkgs/by-name/ts/tskm/src/interface/open/mod.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/pkgs/by-name/ts/tskm/src/interface/open/mod.rs b/pkgs/by-name/ts/tskm/src/interface/open/mod.rs
index 40e057c1..e302c7d1 100644
--- a/pkgs/by-name/ts/tskm/src/interface/open/mod.rs
+++ b/pkgs/by-name/ts/tskm/src/interface/open/mod.rs
@@ -26,9 +26,7 @@ impl Project {
.context("Failed to get data dir")?
.join("qutebrowser")
.join(self.to_project_display())
- // NOTE(@bpeetz): We could use another real session name, but this file should
- // always exist. <2025-06-03>
- .join("data/sessions/_autosave.yml");
+ .join("data/sessions/default.yml");
let mut file = File::open(&path)
.with_context(|| format!("Failed to open path '{}'", path.display()))?;
@@ -92,7 +90,7 @@ fn qute_store_from_yaml(yaml: &[Yaml]) -> Result<SessionStore> {
Ok::<_, anyhow::Error>(TabHistory {
active: hash
.get(&Yaml::String("active".to_owned()))
- .ok_or(anyhow!("Missing tab history active"))?
+ .unwrap_or(&Yaml::Boolean(false))
.as_bool()
.ok_or(anyhow!("tab history active not bool"))?,
last_visited: NaiveDateTime::from_str(
@@ -126,7 +124,7 @@ fn qute_store_from_yaml(yaml: &[Yaml]) -> Result<SessionStore> {
.context("Failed to parse url")?,
zoom: hash
.get(&Yaml::String("zoom".to_owned()))
- .ok_or(anyhow!("Missing tab history zoom"))?
+ .unwrap_or(&Yaml::Real("1.0".to_owned()))
.as_f64()
.ok_or(anyhow!("tab history zoom not 64"))?,
})