diff --git a/extension/src/sites/manage.html b/extension/src/sites/manage.html index b1f9cf22..07a1309e 100644 --- a/extension/src/sites/manage.html +++ b/extension/src/sites/manage.html @@ -235,6 +235,27 @@ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+ + + +
+
+
diff --git a/extension/src/sites/manage.js b/extension/src/sites/manage.js index 180afe37..aad802d4 100644 --- a/extension/src/sites/manage.js +++ b/extension/src/sites/manage.js @@ -1048,6 +1048,8 @@ async function handleSettings (hasChanged = false) { document.getElementById('settings-enable-wayland-container').classList.remove('d-none') document.getElementById('settings-use-xinput2-container').classList.remove('d-none') document.getElementById('settings-use-portals-container').classList.remove('d-none') + document.getElementById('settings-use-linked-rt').classList.remove('d-none') + document.getElementById('settings-settings-linked-rt-path').classList.remove('d-none') } // Hide patching setting on macOS @@ -1063,6 +1065,8 @@ async function handleSettings (hasChanged = false) { document.getElementById('settings-use-xinput2').checked = config.runtime_use_xinput2 document.getElementById('settings-use-portals').checked = config.runtime_use_portals document.getElementById('settings-always-patch').checked = config.always_patch + document.getElementById('settings-use-linked-rt').checked = config.use_linked_runtime + document.getElementById('settings-settings-linked-rt-path').checked = config.linked_runtime_path // Enable settings inputs document.getElementById('settings-enable-wayland-container').title = '' @@ -1098,6 +1102,12 @@ async function handleSettings (hasChanged = false) { config.always_patch = this.checked await setConfig(config) }) + + // Listen for use linked Runtime + document.getElementById('settings-use-linked-rt').addEventListener('change', async function () { + config.always_patch = this.checked + await setConfig(config) + }) }) // Hide runtime reinstallation button on unsupported platforms diff --git a/native/src/components/runtime.rs b/native/src/components/runtime.rs index dc0e6868..85789ffb 100644 --- a/native/src/components/runtime.rs +++ b/native/src/components/runtime.rs @@ -365,11 +365,12 @@ impl Runtime { self.uninstall()?; storage.config.use_linked_runtime = true; + storage.config.linked_runtime_path = FFOX.to_string(); info!("Linking the runtime"); - if Path::new(FFOX).exists() { - for entry in read_dir(FFOX)?.flatten() { + if Path::new(&storage.config.linked_runtime_path).exists() { + for entry in read_dir(&storage.config.linked_runtime_path)?.flatten() { let entry = entry.path(); match entry.file_name().expect("Couldn't retrieve a file name").to_str() { // Use a different branch for the "defaults" folder due to the patches to apply afterwhile diff --git a/native/src/connector/process.rs b/native/src/connector/process.rs index 11a14d43..5532e656 100644 --- a/native/src/connector/process.rs +++ b/native/src/connector/process.rs @@ -89,6 +89,8 @@ impl Process for InstallRuntime { let command = RuntimeInstallCommand { #[cfg(platform_linux)] link: options.link, + #[cfg(platform_linux)] + path: options.path, }; command.run()?; diff --git a/native/src/connector/request.rs b/native/src/connector/request.rs index 7360a03f..a84ce192 100644 --- a/native/src/connector/request.rs +++ b/native/src/connector/request.rs @@ -158,6 +158,9 @@ pub struct InstallRuntimeOptions { /// Whether to use a linked runtime instead of downloading from Mozilla (experimental, default: `false`). #[serde(default)] pub link: bool, + /// Experimental: Use a linked runtime instead of downloading from Mozilla. + /// Optional: Path of my firefox runtime + pub path: String, } pub type InstallRuntime = Option; diff --git a/native/src/console/app.rs b/native/src/console/app.rs index 83a6b67b..2bbb1dd0 100644 --- a/native/src/console/app.rs +++ b/native/src/console/app.rs @@ -6,6 +6,8 @@ use clap::{ArgAction, Parser}; use ulid::Ulid; use url::Url; +const FFOX: &str = "/usr/lib/firefox/"; + #[derive(Parser, Debug, Eq, PartialEq, Clone)] #[clap(propagate_version = true)] #[clap(version)] @@ -278,8 +280,13 @@ pub enum RuntimeCommand { pub struct RuntimeInstallCommand { /// Experimental: Use a linked runtime instead of downloading from Mozilla #[cfg(target_os = "linux")] - #[clap(long)] + #[clap(long, short)] pub link: bool, + /// Experimental: Use a linked runtime instead of downloading from Mozilla. + /// Optional: Path of my firefox runtime + #[cfg(target_os = "linux")] + #[clap(long, value_name = FFOX)] + pub path: String, } #[derive(Parser, Debug, Eq, PartialEq, Clone)] diff --git a/native/src/storage.rs b/native/src/storage.rs index dcd53043..4597824b 100644 --- a/native/src/storage.rs +++ b/native/src/storage.rs @@ -53,6 +53,11 @@ pub struct Config { /// Experimental: Using the system runtime to save some disk space. /// This might not work on your system. pub use_linked_runtime: bool, + + #[cfg(platform_linux)] + /// Experimental: Using the system runtime to save some disk space. + /// Change the path of Firefox in linked runtime mode. + pub linked_runtime_path: String, } #[non_exhaustive]