parent
a73ec58594
commit
8fbc568f14
1 changed files with 7 additions and 13 deletions
|
@ -1,19 +1,16 @@
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
pub mod size;
|
pub mod size;
|
||||||
|
|
||||||
pub mod framerate;
|
pub mod framerate;
|
||||||
|
|
||||||
pub mod window_type;
|
pub mod window_type;
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use super::Gamescope;
|
pub use super::Gamescope;
|
||||||
pub use super::size::Size;
|
pub use super::size::Size;
|
||||||
pub use super::framerate::Framerate;
|
pub use super::framerate::Framerate;
|
||||||
|
|
||||||
pub use super::window_type::WindowType;
|
pub use super::window_type::WindowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,18 +95,15 @@ impl From<&JsonValue> for Gamescope {
|
||||||
impl Gamescope {
|
impl Gamescope {
|
||||||
fn is_legacy_version() -> bool {
|
fn is_legacy_version() -> bool {
|
||||||
// gamescope doesn't have --version, so parsing --help instead
|
// gamescope doesn't have --version, so parsing --help instead
|
||||||
match Command::new("/usr/bin/gamescope").arg("--help").output() {
|
Command::new("gamescope").arg("--help").output()
|
||||||
Err(_) => true,
|
// if no --filter, then it's legacy version
|
||||||
Ok(output) => String::from_utf8(output.stderr)
|
.map(|help| !String::from_utf8_lossy(&help.stderr).contains("-F, --filter"))
|
||||||
.unwrap_or_default()
|
.unwrap_or(true)
|
||||||
.lines()
|
|
||||||
.find(|s| s.contains("-F, --filter"))
|
|
||||||
.is_none() // if no --filter, then it's legacy version
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_command(&self) -> Option<String> {
|
pub fn get_command(&self) -> Option<String> {
|
||||||
// https://github.com/bottlesdevs/Bottles/blob/b908311348ed1184ead23dd76f9d8af41ff24082/src/backend/wine/winecommand.py#L478
|
// https://github.com/bottlesdevs/Bottles/blob/b908311348ed1184ead23dd76f9d8af41ff24082/src/backend/wine/winecommand.py#L478
|
||||||
|
// https://github.com/ValveSoftware/gamescope#options
|
||||||
if self.enabled {
|
if self.enabled {
|
||||||
let mut gamescope = String::from("gamescope");
|
let mut gamescope = String::from("gamescope");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue