Merge pull request #10 from gfiroozeh/main

feat: add gamescope force-grab-cursor flag
This commit is contained in:
Observer KRypt0n_ 2024-03-24 11:16:39 +02:00 committed by GitHub
commit 4ea1a6a320
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,8 @@ pub struct Gamescope {
pub integer_scaling: bool, pub integer_scaling: bool,
pub fsr: bool, pub fsr: bool,
pub nis: bool, pub nis: bool,
pub window_type: WindowType pub window_type: WindowType,
pub force_grab_cursor: bool,
} }
impl Default for Gamescope { impl Default for Gamescope {
@ -39,7 +40,8 @@ impl Default for Gamescope {
integer_scaling: true, integer_scaling: true,
fsr: false, fsr: false,
nis: false, nis: false,
window_type: WindowType::default() window_type: WindowType::default(),
force_grab_cursor: false
} }
} }
} }
@ -79,7 +81,11 @@ impl From<&JsonValue> for Gamescope {
window_type: value.get("window_type") window_type: value.get("window_type")
.map(WindowType::from) .map(WindowType::from)
.unwrap_or(default.window_type) .unwrap_or(default.window_type),
force_grab_cursor: value.get("force_grab_cursor")
.and_then(JsonValue::as_bool)
.unwrap_or(default.force_grab_cursor),
} }
} }
} }
@ -173,6 +179,10 @@ impl Gamescope {
} }
} }
if self.force_grab_cursor {
gamescope += " --force-grab-cursor"
}
Some(gamescope) Some(gamescope)
} }