diff --git a/Cargo.lock b/Cargo.lock index a6cceac..83a0ecf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,7 +160,7 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "volt" -version = "2.2.1" +version = "2.2.2" dependencies = [ "ash", "libc", diff --git a/Cargo.toml b/Cargo.toml index c9d9c9d..6b9050e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "volt" -version = "2.2.1" +version = "2.2.2" edition = "2021" rust-version = "1.85.1" diff --git a/README.md b/README.md index 5937d09..c4d7793 100644 --- a/README.md +++ b/README.md @@ -439,7 +439,7 @@ flatpak install --user build/bundles/org.freedesktop.Platform.VulkanLayer.volt-2 flatpak uninstall --user org.freedesktop.Platform.VulkanLayer.volt ``` -The launcher detects `flatpak run` and routes through the in-sandbox wrapper: +The launcher detects `flatpak run` and routes through the in-sandbox wrapper. It also mounts `~/.config/volt-gui` into the sandbox, read-only, or read-write under `--probe`: ``` volt -- flatpak run com.example.Game @@ -451,20 +451,26 @@ There's no Flatpak build of volt-gui itself, only the layer. ### Without the launcher -Call the wrapper yourself, useful where only the extension is installed: +Call the wrapper yourself, useful where only the extension is installed. Mount the profiles yourself too. The wrapper runs inside the sandbox and can't do it from there: ``` -flatpak run --command=/usr/lib/extensions/vulkan/volt/bin/volt-flatpak com.example.Game -VOLT_CONFIG_NAME=myprofile flatpak run --command=/usr/lib/extensions/vulkan/volt/bin/volt-flatpak com.example.Game +flatpak run --filesystem=xdg-config/volt-gui:ro --command=/usr/lib/extensions/vulkan/volt/bin/volt-flatpak com.example.Game +VOLT_CONFIG_NAME=myprofile flatpak run --filesystem=xdg-config/volt-gui:ro --command=/usr/lib/extensions/vulkan/volt/bin/volt-flatpak com.example.Game ``` -Same line works as a Steam launch option for a Flatpak game: +A Steam launch option has no room for that flag, so grant it once instead: + +``` +flatpak override --user --filesystem=xdg-config/volt-gui:ro com.example.Game +``` + +Then the launch option is just the wrapper: ``` /usr/lib/extensions/vulkan/volt/bin/volt-flatpak %command% ``` -Your home directory is mounted into the sandbox, so profiles apply unchanged. +Without the grant the layer still loads, it just finds no profile and leaves every setting alone. `VOLT_LOG=info` names the path it couldn't read. ## Profiles, Presets & Options diff --git a/src/volt-gui/database.py b/src/volt-gui/database.py index c62f82d..0335092 100644 --- a/src/volt-gui/database.py +++ b/src/volt-gui/database.py @@ -15,7 +15,7 @@ from probe import shading_options -APP_VERSION: Final[str] = "2.2.1" +APP_VERSION: Final[str] = "2.2.2" APP_AUTHOR: Final[str] = "pythonlover02" APP_LICENSE: Final[str] = "GPL 3.0 License" APP_DESCRIPTION: Final[str] = "My AMD Adrenaline / NVIDIA Settings Linux Alternative" diff --git a/src/volt/config.rs b/src/volt/config.rs index a6e2fbf..629f9c9 100644 --- a/src/volt/config.rs +++ b/src/volt/config.rs @@ -303,9 +303,16 @@ pub(crate) fn config_path(name: &str) -> PathBuf { } fn read_config(path: &PathBuf) -> Settings { - fs::read_to_string(path) - .map(|t| parse_settings(&t)) - .unwrap_or_default() + match fs::read_to_string(path) { + Ok(text) => parse_settings(&text), + Err(e) => { + log_at( + LogLevel::Warn, + &format!("{}: {}, every setting left alone", path.display(), e), + ); + Settings::default() + } + } } fn load_settings() -> Settings { diff --git a/src/volt/consts.rs b/src/volt/consts.rs index d4bfcbd..175ef4d 100644 --- a/src/volt/consts.rs +++ b/src/volt/consts.rs @@ -38,6 +38,8 @@ pub(crate) const PROBE_FAIL_WARN: &str = "probe write failed, the interface keep pub(crate) const FLATPAK_CMD: &str = "flatpak"; pub(crate) const FLATPAK_RUN: &str = "run"; pub(crate) const FLATPAK_INJECT: &str = "/usr/lib/extensions/vulkan/volt/bin/volt-flatpak"; +pub(crate) const FLATPAK_CONFIG_RO: &str = "--filesystem=xdg-config/volt-gui:ro"; +pub(crate) const FLATPAK_CONFIG_RW: &str = "--filesystem=xdg-config/volt-gui"; pub(crate) const LOG_FD: i32 = 2; pub(crate) const LOG_LEVEL_OFF: i32 = 0; diff --git a/src/volt/launcher.rs b/src/volt/launcher.rs index 15aa8c3..63bbfa1 100644 --- a/src/volt/launcher.rs +++ b/src/volt/launcher.rs @@ -17,6 +17,8 @@ use crate::consts::EXIT_EXEC_FAILED; use crate::consts::EXIT_OK; use crate::consts::EXIT_USAGE; use crate::consts::FLATPAK_CMD; +use crate::consts::FLATPAK_CONFIG_RO; +use crate::consts::FLATPAK_CONFIG_RW; use crate::consts::FLATPAK_INJECT; use crate::consts::ENV_PROBE; use crate::consts::FLATPAK_RUN; @@ -120,6 +122,13 @@ fn flatpak_trailing(cmd: &[String]) -> Vec { .unwrap_or_default() } +fn config_share(probe: bool) -> &'static str { + match probe { + true => FLATPAK_CONFIG_RW, + false => FLATPAK_CONFIG_RO, + } +} + fn build_flatpak_args( profile: &str, app_id: &str, @@ -133,6 +142,7 @@ fn build_flatpak_args( format!("--command={}", FLATPAK_INJECT), format!("--env={}={}", ENV_CONFIG_NAME, profile), format!("--env={}={}", ENV_PROBE, probe_value(probe)), + config_share(probe).to_string(), ], flags.to_vec(), vec![app_id.to_string()],