Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "volt"
version = "2.2.1"
version = "2.2.2"
edition = "2021"
rust-version = "1.85.1"

Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/volt-gui/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 10 additions & 3 deletions src/volt/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/volt/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions src/volt/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,6 +122,13 @@ fn flatpak_trailing(cmd: &[String]) -> Vec<String> {
.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,
Expand All @@ -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()],
Expand Down
Loading