diff --git a/assets/locales/en/gamescope.ftl b/assets/locales/en/gamescope.ftl index 6fbb639..b0b51f9 100644 --- a/assets/locales/en/gamescope.ftl +++ b/assets/locales/en/gamescope.ftl @@ -11,3 +11,6 @@ nis-description = An open source upscaling technique developed by Nvidia as a cr other-settings = Other settings framerate-limit = Framerate limit unfocused-framerate-limit = Unfocused framerate limit + +force-grab-cursor = Force grab cursor +force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game. \ No newline at end of file diff --git a/src/ui/preferences/gamescope.rs b/src/ui/preferences/gamescope.rs index 207ae06..4acbd97 100644 --- a/src/ui/preferences/gamescope.rs +++ b/src/ui/preferences/gamescope.rs @@ -250,6 +250,26 @@ impl SimpleAsyncComponent for GamescopeApp { } } } + }, + + adw::ActionRow { + set_title: &tr!("force-grab-cursor"), + set_subtitle: &tr!("force-grab-cursor-description"), + + add_suffix = >k::Switch { + set_valign: gtk::Align::Center, + set_state: CONFIG.game.enhancements.gamescope.force_grab_cursor, + + connect_state_notify => |switch| { + if is_ready() { + if let Ok(mut config) = Config::get() { + config.game.enhancements.gamescope.force_grab_cursor = switch.state(); + + Config::update(config); + } + } + } + } } } }