gui: one click opens a game in Library and Unfiltered; Steam falls back to xdg-open when steam is not on PATH
This commit is contained in:
1 parent
79bae4d2a3
commit
a2f25ee217
2 files changed
+10
-7
No files matched your search
@@ -208,7 +208,13 @@ impl App {
|
||||
};
|
||||
if self.headless { return self.toast(format!("Headless render, nothing started. Would run: {}", argv.join(" "))); }
|
||||
use std::process::{Command, Stdio};
|
||||
match Command::new(&argv[0]).args(&argv[1..]).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()).spawn() {
|
||||
let spawn = |argv: &[String]| Command::new(&argv[0]).args(&argv[1..]).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::null()).spawn();
|
||||
// Flatpak and Snap installs have no `steam` on PATH; the desktop's steam:// handler reaches them.
|
||||
let started = match spawn(&argv) {
|
||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound && argv[0] == "steam" => spawn(&["xdg-open".to_string(), argv[1].clone()]),
|
||||
other => other,
|
||||
};
|
||||
match started {
|
||||
Ok(mut child) => {
|
||||
self.toast(if launch::is_install(&e) { format!("Asked Steam to install {}", e.title) } else if e.source == Source::Steam { format!("Starting {} through Steam", e.title) } else { format!("Starting {}", e.title) });
|
||||
// When it exits, pick up the session `summit run` recorded.
|
||||
|
||||
@@ -168,10 +168,7 @@ export component LibraryView inherits Rectangle {
|
||||
width: parent.width;
|
||||
idx: Lib.library[r * root.cols + c];
|
||||
focused: root.active && root.zone == 1 && root.sel == r * root.cols + c;
|
||||
clicked => {
|
||||
if (root.sel == r * root.cols + c && root.zone == 1) { Lib.open-detail(self.idx); }
|
||||
else { root.zone = 1; root.sel = r * root.cols + c; }
|
||||
}
|
||||
clicked => { root.refocus(); root.zone = 1; root.sel = r * root.cols + c; Lib.open-detail(self.idx); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,7 +194,7 @@ export component LibraryView inherits Rectangle {
|
||||
}
|
||||
for idx[i] in (root.list ? Lib.library : []): ListRow {
|
||||
idx: idx; odd: Math.mod(i, 2) == 1; focused: root.active && root.zone == 1 && root.sel == i;
|
||||
clicked => { if (root.sel == i && root.zone == 1) { Lib.open-detail(idx); } else { root.zone = 1; root.sel = i; } }
|
||||
clicked => { root.refocus(); root.zone = 1; root.sel = i; Lib.open-detail(idx); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +249,7 @@ export component UnfilteredView inherits Rectangle {
|
||||
Text { x: 28px; y: 8px; width: parent.width - 28px - 160px; text: g.title; color: Theme.p.text; font-size: Theme.t-md - 1px; font-weight: 600; overflow: elide; }
|
||||
Text { x: 28px; y: 29px; width: parent.width - 28px - 160px; text: g.reasons; color: Theme.p.dim; font-size: Theme.t-sm - 1px; overflow: elide; }
|
||||
Text { x: parent.width - 132px; width: 116px; height: parent.height; horizontal-alignment: right; vertical-alignment: center; text: g.hours-short == "" ? "Not played" : g.hours-short; color: g.hours-short == "" ? Theme.p.faint : Theme.p.text; font-size: Theme.t-sm; font-weight: 600; }
|
||||
ta := TouchArea { mouse-cursor: pointer; clicked => { if (root.sel == i) { Lib.open-detail(r.idx); } else { root.sel = i; } } }
|
||||
ta := TouchArea { mouse-cursor: pointer; clicked => { root.sel = i; Lib.open-detail(r.idx); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user