diff --git a/src/cmd_runner.rs b/src/cmd_runner.rs index a3a8219..87b5a7a 100644 --- a/src/cmd_runner.rs +++ b/src/cmd_runner.rs @@ -4,8 +4,8 @@ use crate::{ }; use nix::{ sys::signal::{ - kill, Signal::{SIGKILL, SIGTERM}, + kill, }, unistd::Pid, }; @@ -15,10 +15,10 @@ use std::{ path::Path, process::{Child, Command, Stdio}, sync::{ - mpsc::{sync_channel, Receiver, SyncSender}, Arc, Mutex, + mpsc::{Receiver, SyncSender, sync_channel}, }, - thread::{self, sleep, JoinHandle}, + thread::{self, JoinHandle, sleep}, time::Duration, }; diff --git a/src/config.rs b/src/config.rs index 80cf0f5..c3905ec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,7 +10,7 @@ use crate::{ ui::plugins::Plugin, util::file_utils::get_writer, }; -use serde::{de::Error, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error}; use std::{ collections::HashMap, fs::File, diff --git a/src/depcheck/basalt_deps.rs b/src/depcheck/basalt_deps.rs index 00a29b6..73c1517 100644 --- a/src/depcheck/basalt_deps.rs +++ b/src/depcheck/basalt_deps.rs @@ -1,7 +1,7 @@ use super::{ + DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, boost_deps::boost_deps, common::{dep_cmake, dep_eigen, dep_gpp, dep_libgl, dep_ninja, dep_opencv}, - DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, }; use crate::linux_distro::LinuxDistro; use std::collections::HashMap; diff --git a/src/depcheck/libsurvive_deps.rs b/src/depcheck/libsurvive_deps.rs index 46eec55..18d1b4c 100644 --- a/src/depcheck/libsurvive_deps.rs +++ b/src/depcheck/libsurvive_deps.rs @@ -1,6 +1,6 @@ use super::{ - common::{dep_cmake, dep_eigen, dep_gcc, dep_git, dep_gpp, dep_ninja}, DepcheckResultGetMissing, Dependency, DependencyCheckResult, + common::{dep_cmake, dep_eigen, dep_gcc, dep_git, dep_gpp, dep_ninja}, }; fn libsurvive_deps() -> Vec { diff --git a/src/depcheck/mercury_deps.rs b/src/depcheck/mercury_deps.rs index d8c61b5..73f5e76 100644 --- a/src/depcheck/mercury_deps.rs +++ b/src/depcheck/mercury_deps.rs @@ -1,5 +1,5 @@ use super::{ - common::dep_opencv, DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, + DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, common::dep_opencv, }; use crate::linux_distro::LinuxDistro; use std::collections::HashMap; diff --git a/src/depcheck/monado_deps.rs b/src/depcheck/monado_deps.rs index ee72956..71b86cf 100644 --- a/src/depcheck/monado_deps.rs +++ b/src/depcheck/monado_deps.rs @@ -1,10 +1,10 @@ use super::{ + DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, common::{ dep_cmake, dep_eigen, dep_gcc, dep_git, dep_glslang_validator, dep_gpp, dep_libdrm, dep_libgl, dep_libudev, dep_libx11, dep_libxcb, dep_ninja, dep_openxr, dep_vulkan_headers, dep_vulkan_icd_loader, }, - DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, }; use crate::{ depcheck::common::{dep_glslc, dep_libc, dep_libxrandr}, diff --git a/src/depcheck/openhmd_deps.rs b/src/depcheck/openhmd_deps.rs index d31d013..1980424 100644 --- a/src/depcheck/openhmd_deps.rs +++ b/src/depcheck/openhmd_deps.rs @@ -1,6 +1,6 @@ use super::{ - common::{dep_gcc, dep_git, dep_gpp, dep_ninja}, DepcheckResultGetMissing, Dependency, DependencyCheckResult, + common::{dep_gcc, dep_git, dep_gpp, dep_ninja}, }; use crate::linux_distro::LinuxDistro; use std::collections::HashMap; diff --git a/src/depcheck/wivrn_deps.rs b/src/depcheck/wivrn_deps.rs index 746eb8c..db758f0 100644 --- a/src/depcheck/wivrn_deps.rs +++ b/src/depcheck/wivrn_deps.rs @@ -1,10 +1,10 @@ use super::{ + DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, common::{ dep_cmake, dep_eigen, dep_gcc, dep_git, dep_glslang_validator, dep_gpp, dep_libdrm, dep_libudev, dep_libx11, dep_libxcb, dep_ninja, dep_openxr, dep_vulkan_headers, dep_vulkan_icd_loader, }, - DepType, DepcheckResultGetMissing, Dependency, DependencyCheckResult, }; use crate::{ depcheck::common::{dep_libc, dep_libgl, dep_libxrandr}, diff --git a/src/downloader.rs b/src/downloader.rs index 3b1b16b..347603d 100644 --- a/src/downloader.rs +++ b/src/downloader.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_ID, paths::get_cache_dir, util::file_utils::get_writer, util::hash::sha256, }; use reqwest::{ - header::{HeaderMap, USER_AGENT}, Method, + header::{HeaderMap, USER_AGENT}, }; use std::{io::prelude::*, path::Path}; use std::{path::PathBuf, time::Duration}; diff --git a/src/env_var_descriptions.rs b/src/env_var_descriptions.rs index 84a404b..bfd9cb9 100644 --- a/src/env_var_descriptions.rs +++ b/src/env_var_descriptions.rs @@ -4,60 +4,57 @@ fn env_var_descriptions() -> Vec<(&'static str, &'static str)> { vec![ ( "XRT_COMPOSITOR_SCALE_PERCENTAGE", - "Render resolution percentage. A percentage higher than the native resolution (>100) will help with antialiasing and image clarity." + "Render resolution percentage. A percentage higher than the native resolution (>100) will help with antialiasing and image clarity.", ), ( "XRT_COMPOSITOR_COMPUTE", - "Set to 1 to use GPU compute for the OpenXR compositor." + "Set to 1 to use GPU compute for the OpenXR compositor.", ), ( "U_PACING_APP_USE_MIN_FRAME_PERIOD", - "Set to 1 to unlimit the compositor refresh from a power of two of your HMD refresh, typically provides a large performance boost." + "Set to 1 to unlimit the compositor refresh from a power of two of your HMD refresh, typically provides a large performance boost.", ), ( "SURVIVE_GLOBALSCENESOLVER", - "Continuously recalibrate lighthouse tracking during use. In the current state it's recommended to disable this feature by setting this value to 0." + "Continuously recalibrate lighthouse tracking during use. In the current state it's recommended to disable this feature by setting this value to 0.", ), // ("SURVIVE_TIMECODE_OFFSET_MS", ""), ( "LD_LIBRARY_PATH", - "Colon-separated list of directories where the dynamic linker will search for shared object libraries." - ), - ( - "XRT_DEBUG_GUI", - "Set to 1 to enable the Monado debug UI." + "Colon-separated list of directories where the dynamic linker will search for shared object libraries.", ), + ("XRT_DEBUG_GUI", "Set to 1 to enable the Monado debug UI."), ( "XRT_CURATED_GUI", - "Set to 1 to enable the Monado preview UI. Requires XRT_DEBUG_GUI=1 to work." + "Set to 1 to enable the Monado preview UI. Requires XRT_DEBUG_GUI=1 to work.", ), ( "XRT_JSON_LOG", - "Set to 1 to enable JSON logging for Monado. This enables better log visualization and log level filtering." + "Set to 1 to enable JSON logging for Monado. This enables better log visualization and log level filtering.", ), ( "QWERTY_ENABLE", - "Set to 1 to enable QWERTY Simulation driver. This enables simulated driver that allows you to use Monado without HMD and controllers. It's also possible to mix and match different profiles with this." + "Set to 1 to enable QWERTY Simulation driver. This enables simulated driver that allows you to use Monado without HMD and controllers. It's also possible to mix and match different profiles with this.", ), ( "LH_DRIVER", - "Lighthouse driver, this overrides the \"Lighthouse driver\" option in the profile; Valid options are:\n\"vive\" for the default built-in driver;\n\"survive\" for Libsurvive;\n\"steamvr\" for the SteamVR based implementation." + "Lighthouse driver, this overrides the \"Lighthouse driver\" option in the profile; Valid options are:\n\"vive\" for the default built-in driver;\n\"survive\" for Libsurvive;\n\"steamvr\" for the SteamVR based implementation.", ), ( "LH_LOG", - "Lighthouse log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"." + "Lighthouse log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\".", ), ( "LIGHTHOUSE_LOG", - "Lighthouse driver log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\"." + "Lighthouse driver log level. Can be one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\".", ), ( "LH_HANDTRACKING", - "Controls when to enable mercury optical hand tracking. Valid options are:\n\"0\" (off) to disable hand tracking;\n\"1\" (auto) to only enable hand tracking if no controllers are found;\n\"2\" (on) to enable hand tracking even if controllers are found." + "Controls when to enable mercury optical hand tracking. Valid options are:\n\"0\" (off) to disable hand tracking;\n\"1\" (auto) to only enable hand tracking if no controllers are found;\n\"2\" (on) to enable hand tracking even if controllers are found.", ), ( "WMR_HANDTRACKING", - "Controls whether to enable hand tracking for WMR contorllers. Valid options are:\n\"0\" (off) to disable hand tracking;\n\"1\" (on) to enable hand tracking." + "Controls whether to enable hand tracking for WMR contorllers. Valid options are:\n\"0\" (off) to disable hand tracking;\n\"1\" (on) to enable hand tracking.", ), ] } diff --git a/src/file_builders/active_runtime_json.rs b/src/file_builders/active_runtime_json.rs index 15c3908..384b644 100644 --- a/src/file_builders/active_runtime_json.rs +++ b/src/file_builders/active_runtime_json.rs @@ -163,8 +163,8 @@ mod tests { use std::path::{Path, PathBuf}; use super::{ - dump_active_runtime_to_path, get_active_runtime_from_path, - relativize_active_runtime_lib_path, ActiveRuntime, ActiveRuntimeInnerRuntime, + ActiveRuntime, ActiveRuntimeInnerRuntime, dump_active_runtime_to_path, + get_active_runtime_from_path, relativize_active_runtime_lib_path, }; #[test] diff --git a/src/file_builders/openvrpaths_vrpath.rs b/src/file_builders/openvrpaths_vrpath.rs index 3b8c692..40a13d9 100644 --- a/src/file_builders/openvrpaths_vrpath.rs +++ b/src/file_builders/openvrpaths_vrpath.rs @@ -4,7 +4,7 @@ use crate::{ util::file_utils::{copy_file, deserialize_file, get_writer, set_file_readonly}, xdg::XDG, }; -use serde::{ser::Error, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, ser::Error}; use std::path::{Path, PathBuf}; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] @@ -114,7 +114,7 @@ pub fn set_current_openvrpaths_to_profile(profile: &Profile) -> anyhow::Result<( #[cfg(test)] mod tests { - use super::{dump_openvrpaths_to_path, get_openvrpaths_from_path, OpenVrPaths}; + use super::{OpenVrPaths, dump_openvrpaths_to_path, get_openvrpaths_from_path}; use std::path::Path; #[test] diff --git a/src/file_builders/wivrn_config.rs b/src/file_builders/wivrn_config.rs index af28a2a..8ae9359 100644 --- a/src/file_builders/wivrn_config.rs +++ b/src/file_builders/wivrn_config.rs @@ -215,9 +215,11 @@ mod tests { Some(WivrnConfigApplication::Str("foobar".into())) ); assert!(!conf.tcp_only); - assert!(serde_json::to_string(&conf) - .unwrap() - .contains("\"extraneous\":\"field\",\"other\":{\"weird\":[\"stuff\"]}")); + assert!( + serde_json::to_string(&conf) + .unwrap() + .contains("\"extraneous\":\"field\",\"other\":{\"weird\":[\"stuff\"]}") + ); let conf = get_wivrn_config_from_path(Path::new("./test/files/wivrn_config2.json")) .expect("Couln't find wivrn config 2"); assert_eq!( diff --git a/src/linux_distro.rs b/src/linux_distro.rs index 2fcd76a..df31c10 100644 --- a/src/linux_distro.rs +++ b/src/linux_distro.rs @@ -189,8 +189,8 @@ impl LinuxDistro { let rpmfusion_free_path = Path::new("/etc/yum.repos.d/rpmfusion-free.repo"); if !rpmfusion_free_path.is_file() { install_rpmfusion_cmd = Some(String::from( - "sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - )); + "sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm", + )); } let ffmpeg_free_path = Path::new("/usr/share/doc/ffmpeg-free"); diff --git a/src/log_parser.rs b/src/log_parser.rs index 9d0129f..df62abd 100644 --- a/src/log_parser.rs +++ b/src/log_parser.rs @@ -1,5 +1,5 @@ use crate::termcolor::TermColor; -use serde::{de::Visitor, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Visitor}; use std::{fmt::Display, slice::Iter, str::FromStr}; #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize)] diff --git a/src/main.rs b/src/main.rs index b9d3e66..bfd84cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use constants::{resources, APP_ID, APP_NAME, GETTEXT_PACKAGE, LOCALE_DIR, RESOURCES_BASE_PATH}; +use constants::{APP_ID, APP_NAME, GETTEXT_PACKAGE, LOCALE_DIR, RESOURCES_BASE_PATH, resources}; use file_builders::{ active_runtime_json::restore_active_runtime_backup, openvrpaths_vrpath::{get_current_openvrpaths, set_current_openvrpaths_to_steam}, @@ -7,9 +7,8 @@ use file_builders::{ use gettextrs::LocaleCategory; use paths::get_logs_dir; use relm4::{ - adw, + MessageBroker, RelmApp, adw, gtk::{self, gdk, gio, glib, prelude::*}, - MessageBroker, RelmApp, }; use std::{ env, @@ -22,7 +21,7 @@ use steam_linux_runtime_injector::{ }; use tracing::{error, warn}; use tracing_subscriber::{ - filter::LevelFilter, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter, Layer, + EnvFilter, Layer, filter::LevelFilter, layer::SubscriberExt, util::SubscriberInitExt, }; use ui::{ app::{App, AppInit, Msg}, diff --git a/src/profile.rs b/src/profile.rs index bd3f616..aeba3b5 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -1,13 +1,13 @@ use crate::{ build_tools::git::Git, depcheck::{ - basalt_deps::get_missing_basalt_deps, libsurvive_deps::get_missing_libsurvive_deps, - mercury_deps::get_missing_mercury_deps, monado_deps::get_missing_monado_deps, - openhmd_deps::get_missing_openhmd_deps, wivrn_deps::get_missing_wivrn_deps, - xrizer_deps::get_missing_xrizer_deps, Dependency, + Dependency, basalt_deps::get_missing_basalt_deps, + libsurvive_deps::get_missing_libsurvive_deps, mercury_deps::get_missing_mercury_deps, + monado_deps::get_missing_monado_deps, openhmd_deps::get_missing_openhmd_deps, + wivrn_deps::get_missing_wivrn_deps, xrizer_deps::get_missing_xrizer_deps, }, file_builders::active_runtime_json::ActiveRuntime, - paths::{get_data_dir, BWRAP_SYSTEM_PREFIX, SYSTEM_PREFIX}, + paths::{BWRAP_SYSTEM_PREFIX, SYSTEM_PREFIX, get_data_dir}, util::{ file_utils::{deserialize_file, get_writer}, git_repos::{ @@ -25,7 +25,7 @@ use serde::{Deserialize, Serialize}; use std::{ collections::HashMap, fmt::Display, - fs::{remove_dir_all, File}, + fs::{File, remove_dir_all}, io::BufReader, path::{Path, PathBuf}, slice::Iter, @@ -939,13 +939,17 @@ mod tests { assert!(profile.features.libsurvive.enabled); assert!(!profile.features.basalt.enabled); assert!(!profile.features.mercury_enabled); - assert!(profile - .environment - .contains_key("XRT_COMPOSITOR_SCALE_PERCENTAGE")); + assert!( + profile + .environment + .contains_key("XRT_COMPOSITOR_SCALE_PERCENTAGE") + ); assert!(profile.environment.contains_key("XRT_COMPOSITOR_COMPUTE")); - assert!(profile - .environment - .contains_key("SURVIVE_GLOBALSCENESOLVER")); + assert!( + profile + .environment + .contains_key("SURVIVE_GLOBALSCENESOLVER") + ); } #[test] diff --git a/src/profiles/lighthouse.rs b/src/profiles/lighthouse.rs index 7243e92..f066531 100644 --- a/src/profiles/lighthouse.rs +++ b/src/profiles/lighthouse.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_monado_path, data_ovr_comp_path, get_data_dir}, profile::{ - prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeatures, - ProfileOvrCompatibilityModule, XRServiceType, + LighthouseDriver, Profile, ProfileFeatures, ProfileOvrCompatibilityModule, XRServiceType, + prepare_ld_library_path, }, }; use std::collections::HashMap; diff --git a/src/profiles/openhmd.rs b/src/profiles/openhmd.rs index 25b2bdb..08ef73b 100644 --- a/src/profiles/openhmd.rs +++ b/src/profiles/openhmd.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_monado_path, data_openhmd_path, data_ovr_comp_path, get_data_dir}, profile::{ - prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, - ProfileFeatures, ProfileOvrCompatibilityModule, XRServiceType, + LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, + ProfileOvrCompatibilityModule, XRServiceType, prepare_ld_library_path, }, }; use std::collections::HashMap; diff --git a/src/profiles/survive.rs b/src/profiles/survive.rs index 68ec6d3..db5bf95 100644 --- a/src/profiles/survive.rs +++ b/src/profiles/survive.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_libsurvive_path, data_monado_path, data_ovr_comp_path, get_data_dir}, profile::{ - prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, - ProfileFeatures, ProfileOvrCompatibilityModule, XRServiceType, + LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, + ProfileOvrCompatibilityModule, XRServiceType, prepare_ld_library_path, }, }; use std::collections::HashMap; diff --git a/src/profiles/wivrn.rs b/src/profiles/wivrn.rs index aed02e5..c73c5ca 100644 --- a/src/profiles/wivrn.rs +++ b/src/profiles/wivrn.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_ovr_comp_path, data_wivrn_path, get_data_dir}, profile::{ - prepare_ld_library_path, Profile, ProfileFeatures, ProfileOvrCompatibilityModule, - XRServiceType, + Profile, ProfileFeatures, ProfileOvrCompatibilityModule, XRServiceType, + prepare_ld_library_path, }, ui::job_worker::internal_worker::LAUNCH_OPTS_CMD_PLACEHOLDER, }; diff --git a/src/profiles/wmr.rs b/src/profiles/wmr.rs index c96d62f..1c244ab 100644 --- a/src/profiles/wmr.rs +++ b/src/profiles/wmr.rs @@ -2,8 +2,8 @@ use crate::{ constants::APP_NAME, paths::{data_basalt_path, data_monado_path, data_ovr_comp_path, get_data_dir}, profile::{ - prepare_ld_library_path, LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, - ProfileFeatures, ProfileOvrCompatibilityModule, XRServiceType, + LighthouseDriver, Profile, ProfileFeature, ProfileFeatureType, ProfileFeatures, + ProfileOvrCompatibilityModule, XRServiceType, prepare_ld_library_path, }, }; use std::collections::HashMap; diff --git a/src/termcolor.rs b/src/termcolor.rs index c93a461..ee478c8 100644 --- a/src/termcolor.rs +++ b/src/termcolor.rs @@ -44,6 +44,9 @@ impl TermColor { } pub fn colorize(&self, s: &str) -> String { - format!("{ANSI_ESCAPE_BEGIN}{code}{ANSI_ESCAPE_END}{s}{ANSI_ESCAPE_BEGIN}{ANSI_RESET}{ANSI_ESCAPE_END}", code = self.code()) + format!( + "{ANSI_ESCAPE_BEGIN}{code}{ANSI_ESCAPE_END}{s}{ANSI_ESCAPE_BEGIN}{ANSI_RESET}{ANSI_ESCAPE_END}", + code = self.code() + ) } } diff --git a/src/ui/about_dialog.rs b/src/ui/about_dialog.rs index 0e28534..146cf34 100644 --- a/src/ui/about_dialog.rs +++ b/src/ui/about_dialog.rs @@ -1,7 +1,7 @@ use crate::{ constants::{ - get_artists, APP_ID, APP_NAME, BUILD_DATETIME, ISSUES_URL, REPO_URL, SINGLE_DEVELOPER, - VERSION, + APP_ID, APP_NAME, BUILD_DATETIME, ISSUES_URL, REPO_URL, SINGLE_DEVELOPER, VERSION, + get_artists, }, device_prober::PhysicalXRDevice, linux_distro::LinuxDistro, diff --git a/src/ui/app.rs b/src/ui/app.rs index 8396370..be67b7b 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -5,9 +5,9 @@ use super::{ cmdline_opts::CmdLineOpts, debug_view::{DebugView, DebugViewInit, DebugViewMsg, DebugViewOutMsg}, job_worker::{ + JobWorker, internal_worker::JobWorkerOut, job::{FuncWorkerOut, WorkerJob}, - JobWorker, }, libsurvive_setup_window::{LibsurviveSetupMsg, LibsurviveSetupWindow}, main_view::{MainView, MainViewInit, MainViewMsg, MainViewOutMsg}, @@ -54,8 +54,8 @@ use crate::{ wivrn_dbus, xr_devices::XRDevice, }; -use adw::{prelude::*, ResponseAppearance}; -use delicious_adwaita::{theme::Theme, ThemeEngine}; +use adw::{ResponseAppearance, prelude::*}; +use delicious_adwaita::{ThemeEngine, theme::Theme}; use gtk::glib::{self, clone}; use notify_rust::NotificationHandle; use relm4::{ @@ -281,12 +281,13 @@ impl App { None } else { Some({ - let mut cmd_parts = vec![cp - .plugin - .executable() - .unwrap() - .to_string_lossy() - .to_string()]; + let mut cmd_parts = vec![ + cp.plugin + .executable() + .unwrap() + .to_string_lossy() + .to_string(), + ]; cmd_parts.extend(cp.plugin.args.clone().unwrap_or_default()); cmd_parts .iter() @@ -814,17 +815,20 @@ impl AsyncComponent for App { } else { self.build_window .sender() - .emit(BuildWindowMsg::UpdateContent(vec![TermColor::Red - .colorize("pkexec not found, cannot set capabilities\n")])); + .emit(BuildWindowMsg::UpdateContent(vec![ + TermColor::Red + .colorize("pkexec not found, cannot set capabilities\n"), + ])); alert_w_widget( "pkexec not found", Some(&format!( "The build is complete, but we need to set certain capabilities (CAP_SYS_NICE=eip) on the OpenXR server executable.\n\n{APP_NAME} can do that using pkexec, but it doesn't seem to be installed on your system.\n\nYou can do this step on your own by running the following command:" )), - Some(&copiable_code_snippet( - &format!("sudo {}", setcap_cap_sys_nice_eip_cmd(&profile).join(" ")) - )), - Some(&self.app_win.clone().upcast()) + Some(&copiable_code_snippet(&format!( + "sudo {}", + setcap_cap_sys_nice_eip_cmd(&profile).join(" ") + ))), + Some(&self.app_win.clone().upcast()), ); } self.build_window @@ -904,12 +908,14 @@ impl AsyncComponent for App { let setcap_failed_dialog = || { alert_w_widget( "Setcap failed to run", - Some("Setting the capabilities automatically failed, you can still try manually using the command below." + Some( + "Setting the capabilities automatically failed, you can still try manually using the command below.", ), - Some(&copiable_code_snippet( - &format!("sudo {}", setcap_cap_sys_nice_eip_cmd(&profile).join(" ")) - )), - Some(&self.app_win.clone().upcast()) + Some(&copiable_code_snippet(&format!( + "sudo {}", + setcap_cap_sys_nice_eip_cmd(&profile).join(" ") + ))), + Some(&self.app_win.clone().upcast()), ); }; if let Err(e) = setcap_cap_sys_nice_eip(&profile).await { @@ -918,7 +924,7 @@ impl AsyncComponent for App { self.build_window .sender() .emit(BuildWindowMsg::UpdateContent(vec![ - TermColor::Red.colorize("Setting capabilities failed\n") + TermColor::Red.colorize("Setting capabilities failed\n"), ])); } else if !verify_cap_sys_nice_eip(&profile).await { setcap_failed_dialog(); @@ -933,7 +939,7 @@ impl AsyncComponent for App { self.build_window .sender() .emit(BuildWindowMsg::UpdateContent(vec![ - TermColor::Green.colorize("Capabilities set correctly\n") + TermColor::Green.colorize("Capabilities set correctly\n"), ])); } } diff --git a/src/ui/build_window.rs b/src/ui/build_window.rs index 1bc966b..bf5eb3d 100644 --- a/src/ui/build_window.rs +++ b/src/ui/build_window.rs @@ -1,6 +1,6 @@ use crate::termcolor::TermColor; -use super::{term_widget::TermWidget, SENDER_IO_ERR_MSG}; +use super::{SENDER_IO_ERR_MSG, term_widget::TermWidget}; use adw::prelude::*; use relm4::prelude::*; @@ -169,13 +169,13 @@ impl SimpleComponent for BuildWindow { BuildStatus::Done => { label.add_css_class("success"); sender.input(BuildWindowMsg::UpdateContent(vec![ - TermColor::Blue.colorize("Build completed!\n") + TermColor::Blue.colorize("Build completed!\n"), ])); } BuildStatus::Error(_) => { label.add_css_class("error"); sender.input(BuildWindowMsg::UpdateContent(vec![ - TermColor::Blue.colorize("Build failed!\n") + TermColor::Blue.colorize("Build failed!\n"), ])); } _ => {} diff --git a/src/ui/cmdline_opts.rs b/src/ui/cmdline_opts.rs index 087ee74..433b127 100644 --- a/src/ui/cmdline_opts.rs +++ b/src/ui/cmdline_opts.rs @@ -4,8 +4,8 @@ use crate::{ }; use gtk::{ gio::{ - prelude::{ApplicationCommandLineExt, ApplicationExt}, Application, ApplicationCommandLine, + prelude::{ApplicationCommandLineExt, ApplicationExt}, }, glib::{self, prelude::IsA}, }; diff --git a/src/ui/debug_view.rs b/src/ui/debug_view.rs index b45556a..6a886b7 100644 --- a/src/ui/debug_view.rs +++ b/src/ui/debug_view.rs @@ -8,7 +8,7 @@ use crate::{ profile::Profile, }; use gtk::{glib::clone, prelude::*}; -use relm4::{prelude::*, ComponentSender, SimpleComponent}; +use relm4::{ComponentSender, SimpleComponent, prelude::*}; #[derive(Debug)] pub enum SearchDirection { diff --git a/src/ui/factories/device_row_factory.rs b/src/ui/factories/device_row_factory.rs index 24e920a..1d151c8 100644 --- a/src/ui/factories/device_row_factory.rs +++ b/src/ui/factories/device_row_factory.rs @@ -3,7 +3,7 @@ use crate::{ xr_devices::{XRDevice, XRDeviceRole}, }; use adw::prelude::*; -use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender}; +use relm4::{AsyncFactorySender, factory::AsyncFactoryComponent, prelude::*}; #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] pub enum DeviceRowState { diff --git a/src/ui/factories/env_var_row_factory.rs b/src/ui/factories/env_var_row_factory.rs index 0676a30..5d2b167 100644 --- a/src/ui/factories/env_var_row_factory.rs +++ b/src/ui/factories/env_var_row_factory.rs @@ -1,5 +1,5 @@ use adw::prelude::*; -use relm4::{factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender}; +use relm4::{AsyncFactorySender, factory::AsyncFactoryComponent, prelude::*}; #[derive(Debug)] pub struct EnvVarModel { diff --git a/src/ui/factories/wivrn_encoder_group_factory.rs b/src/ui/factories/wivrn_encoder_group_factory.rs index 22f942c..5b6b961 100644 --- a/src/ui/factories/wivrn_encoder_group_factory.rs +++ b/src/ui/factories/wivrn_encoder_group_factory.rs @@ -1,11 +1,11 @@ use crate::{ file_builders::wivrn_config::{Codec, Encoder, WivrnConfEncoder}, ui::{ - preference_rows::{combo_row, spin_row}, SENDER_IO_ERR_MSG, + preference_rows::{combo_row, spin_row}, }, }; -use relm4::{adw::prelude::*, factory::AsyncFactoryComponent, prelude::*, AsyncFactorySender}; +use relm4::{AsyncFactorySender, adw::prelude::*, factory::AsyncFactoryComponent, prelude::*}; use uuid::Uuid; #[derive(Debug)] diff --git a/src/ui/install_wivrn_box.rs b/src/ui/install_wivrn_box.rs index d4f827c..bb7901d 100644 --- a/src/ui/install_wivrn_box.rs +++ b/src/ui/install_wivrn_box.rs @@ -1,4 +1,4 @@ -use super::{alert::alert, ADB_ERR_NO_DEV}; +use super::{ADB_ERR_NO_DEV, alert::alert}; use crate::{ async_process::async_process, depcheck::common::dep_adb, @@ -166,7 +166,13 @@ impl AsyncComponent for InstallWivrnBox { match message { Self::Input::InstallWivrnApk => { if !dep_adb().check() { - alert("ADB is not installed", Some("Please install ADB on your computer to install WiVRn on your Android headset"), Some(&self.root_win)); + alert( + "ADB is not installed", + Some( + "Please install ADB on your computer to install WiVRn on your Android headset", + ), + Some(&self.root_win), + ); return; } self.set_install_wivrn_status(InstallWivrnStatus::InProgress); @@ -181,7 +187,9 @@ impl AsyncComponent for InstallWivrnBox { ))); } Err(GetWivrnApkRefErr::RepoManipulationFailed(giterr)) => { - error!("failed to manipulate WiVRn repo: {giterr}, falling back to latest release APK"); + error!( + "failed to manipulate WiVRn repo: {giterr}, falling back to latest release APK" + ); let existing = cache_file_path(WIVRN_LATEST_RELEASE_APK_URL, Some("apk")); if existing.is_file() && let Err(e) = remove_file(&existing) diff --git a/src/ui/job_worker/internal_worker.rs b/src/ui/job_worker/internal_worker.rs index 437e6a9..3616652 100644 --- a/src/ui/job_worker/internal_worker.rs +++ b/src/ui/job_worker/internal_worker.rs @@ -7,7 +7,7 @@ use crate::{ ui::SENDER_IO_ERR_MSG, }; use nix::unistd::Pid; -use relm4::{prelude::*, Worker}; +use relm4::{Worker, prelude::*}; use std::{ collections::VecDeque, io::{BufRead, BufReader}, diff --git a/src/ui/job_worker/mod.rs b/src/ui/job_worker/mod.rs index 96f0c82..b4d4f82 100644 --- a/src/ui/job_worker/mod.rs +++ b/src/ui/job_worker/mod.rs @@ -5,10 +5,10 @@ use self::{ }; use crate::profile::Profile; use nix::sys::signal::{ - kill, Signal::{SIGKILL, SIGTERM}, + kill, }; -use relm4::{prelude::*, Sender, WorkerController}; +use relm4::{Sender, WorkerController, prelude::*}; use std::{ collections::VecDeque, sync::{Arc, Mutex}, diff --git a/src/ui/libsurvive_setup_window.rs b/src/ui/libsurvive_setup_window.rs index bde1503..406241d 100644 --- a/src/ui/libsurvive_setup_window.rs +++ b/src/ui/libsurvive_setup_window.rs @@ -1,7 +1,7 @@ use super::alert::alert; use crate::{ cmd_runner::CmdRunner, - profile::{prepare_ld_library_path, Profile}, + profile::{Profile, prepare_ld_library_path}, }; use adw::prelude::*; use gtk::glib; diff --git a/src/ui/main_view.rs b/src/ui/main_view.rs index bb032e6..d4ab156 100644 --- a/src/ui/main_view.rs +++ b/src/ui/main_view.rs @@ -1,4 +1,5 @@ use super::{ + SENDER_IO_ERR_MSG, alert::alert, app::{ AboutAction, BuildProfileAction, BuildProfileCleanAction, ConfigureWivrnAction, @@ -12,12 +13,11 @@ use super::{ steamvr_calibration_box::{SteamVrCalibrationBox, SteamVrCalibrationBoxMsg}, util::{limit_dropdown_width, warning_heading}, wivrn_wired_start_box::{WivrnWiredStartBox, WivrnWiredStartBoxInit, WivrnWiredStartBoxMsg}, - SENDER_IO_ERR_MSG, }; use crate::{ config::Config, depcheck::common::dep_pkexec, - gpu_profile::{get_amd_gpu_power_profile, GpuPowerProfile}, + gpu_profile::{GpuPowerProfile, get_amd_gpu_power_profile}, paths::{get_data_dir, get_home_dir}, profile::{LighthouseDriver, Profile, XRServiceType}, stateless_action, @@ -29,7 +29,7 @@ use crate::{ wivrn_dbus, xr_devices::XRDevice, }; -use adw::{prelude::*, ResponseAppearance}; +use adw::{ResponseAppearance, prelude::*}; use gtk::glib::clone; use relm4::{ actions::{ActionGroupName, RelmAction, RelmActionGroup}, diff --git a/src/ui/openhmd_calibration_box.rs b/src/ui/openhmd_calibration_box.rs index 6258ad1..3de58f3 100644 --- a/src/ui/openhmd_calibration_box.rs +++ b/src/ui/openhmd_calibration_box.rs @@ -1,7 +1,7 @@ use crate::{constants::APP_NAME, xdg::XDG}; use relm4::{ - gtk::{self, prelude::*}, ComponentParts, ComponentSender, SimpleComponent, + gtk::{self, prelude::*}, }; use tracing::{debug, error}; diff --git a/src/ui/plugins/add_custom_plugin_win.rs b/src/ui/plugins/add_custom_plugin_win.rs index 734a4ea..b3d3d0f 100644 --- a/src/ui/plugins/add_custom_plugin_win.rs +++ b/src/ui/plugins/add_custom_plugin_win.rs @@ -3,8 +3,8 @@ use std::path::PathBuf; use crate::{ constants::APP_ID, ui::{ - preference_rows::{entry_row, file_row}, SENDER_IO_ERR_MSG, + preference_rows::{entry_row, file_row}, }, }; diff --git a/src/ui/plugins/mod.rs b/src/ui/plugins/mod.rs index cb18440..677e637 100644 --- a/src/ui/plugins/mod.rs +++ b/src/ui/plugins/mod.rs @@ -163,7 +163,7 @@ impl Plugin { /// urls to manifest json files representing plugins. /// each manifest should be json and the link should always point to the latest version -const MANIFESTS: [&str;3] = [ +const MANIFESTS: [&str; 3] = [ "https://github.com/galister/wlx-overlay-s/raw/refs/heads/meta/com.github.galister.wlx-overlay-s.json", "https://github.com/StardustXR/telescope/raw/refs/heads/main/envision/org.stardustxr.telescope.json", "https://github.com/olekolek1000/wayvr-dashboard/raw/refs/heads/meta/dev.oo8.wayvr_dashboard.json", diff --git a/src/ui/plugins/store.rs b/src/ui/plugins/store.rs index 168000a..2897043 100644 --- a/src/ui/plugins/store.rs +++ b/src/ui/plugins/store.rs @@ -1,16 +1,16 @@ use super::{ + Plugin, add_custom_plugin_win::{ AddCustomPluginWin, AddCustomPluginWinInit, AddCustomPluginWinMsg, AddCustomPluginWinOutMsg, }, refresh_plugins, store_detail::{StoreDetail, StoreDetailMsg, StoreDetailOutMsg}, store_row_factory::{StoreRowModel, StoreRowModelInit, StoreRowModelMsg, StoreRowModelOutMsg}, - Plugin, }; use crate::{ config::PluginConfig, downloader::download_file_async, - ui::{alert::alert, SENDER_IO_ERR_MSG}, + ui::{SENDER_IO_ERR_MSG, alert::alert}, }; use adw::prelude::*; use relm4::{factory::AsyncFactoryVecDeque, prelude::*}; @@ -360,9 +360,12 @@ impl AsyncComponent for PluginStore { Some(&format!( "Downloading {} {} failed:\n\nNo executable url provided for this plugin, this is likely a bug!", plugin.name, - plugin.version.as_ref().unwrap_or(&"(no version)".to_string())) - ), - Some(&self.win.as_ref().unwrap().clone().upcast::()) + plugin + .version + .as_ref() + .unwrap_or(&"(no version)".to_string()) + )), + Some(&self.win.as_ref().unwrap().clone().upcast::()), ); } }; diff --git a/src/ui/plugins/store_row_factory.rs b/src/ui/plugins/store_row_factory.rs index 72f9e02..48cddcf 100644 --- a/src/ui/plugins/store_row_factory.rs +++ b/src/ui/plugins/store_row_factory.rs @@ -2,7 +2,7 @@ use super::Plugin; use crate::{downloader::cache_file, ui::SENDER_IO_ERR_MSG}; use gtk::prelude::*; use relm4::{ - factory::AsyncFactoryComponent, prelude::DynamicIndex, AsyncFactorySender, RelmWidgetExt, + AsyncFactorySender, RelmWidgetExt, factory::AsyncFactoryComponent, prelude::DynamicIndex, }; use tracing::error; diff --git a/src/ui/preference_rows.rs b/src/ui/preference_rows.rs index b4ab4b4..3d6e103 100644 --- a/src/ui/preference_rows.rs +++ b/src/ui/preference_rows.rs @@ -1,7 +1,7 @@ use adw::prelude::*; use gtk::{ gio, - glib::{self, clone, GString}, + glib::{self, GString, clone}, }; use relm4::prelude::*; diff --git a/src/ui/profile_editor.rs b/src/ui/profile_editor.rs index 99f7b7b..06a8fc2 100644 --- a/src/ui/profile_editor.rs +++ b/src/ui/profile_editor.rs @@ -1,8 +1,8 @@ use super::{ + ADW_DIALOG_WIDTH, alert::alert_w_widget, factories::env_var_row_factory::{EnvVarModel, EnvVarModelInit, EnvVarModelOutMsg}, preference_rows::{combo_row, entry_row, path_row, switch_row}, - ADW_DIALOG_WIDTH, }; use crate::{ env_var_descriptions::ENV_VAR_DESCRIPTIONS_AS_PARAGRAPH, @@ -554,7 +554,9 @@ impl SimpleComponent for ProfileEditor { { desc.set_selectable(true); } else { - warn!("failed to make env var preference group description selectable, please open a bug report"); + warn!( + "failed to make env var preference group description selectable, please open a bug report" + ); } pg }; diff --git a/src/ui/steamvr_calibration_box.rs b/src/ui/steamvr_calibration_box.rs index beae630..2aa3ca1 100644 --- a/src/ui/steamvr_calibration_box.rs +++ b/src/ui/steamvr_calibration_box.rs @@ -1,12 +1,12 @@ use super::job_worker::{ + JobWorker, internal_worker::JobWorkerOut, job::{FuncWorkerOut, WorkerJob}, - JobWorker, }; use crate::paths::get_steamvr_bin_dir_path; use relm4::{ - gtk::{self, prelude::*}, ComponentParts, ComponentSender, RelmWidgetExt, SimpleComponent, + gtk::{self, prelude::*}, }; use std::{ collections::{HashMap, VecDeque}, diff --git a/src/ui/term_widget.rs b/src/ui/term_widget.rs index ad4333c..877c03d 100644 --- a/src/ui/term_widget.rs +++ b/src/ui/term_widget.rs @@ -1,5 +1,5 @@ use gtk::{gdk, glib::clone, prelude::*}; -use vte4::{prelude::*, Terminal}; +use vte4::{Terminal, prelude::*}; use super::util::copy_text; diff --git a/src/ui/wivrn_conf_editor.rs b/src/ui/wivrn_conf_editor.rs index 42b29e2..56bd8db 100644 --- a/src/ui/wivrn_conf_editor.rs +++ b/src/ui/wivrn_conf_editor.rs @@ -9,13 +9,13 @@ use super::{ }; use crate::{ file_builders::wivrn_config::{ - dump_wivrn_config, get_wivrn_config, WivrnConfEncoder, WivrnConfig, + WivrnConfEncoder, WivrnConfig, dump_wivrn_config, get_wivrn_config, }, ui::{ + ADW_DIALOG_WIDTH, preference_rows::{number_entry_row, spin_row, switch_row}, util::bits_to_mbits, wivrn_encoder_presets_win::WivrnEncoderPresetsWinInit, - ADW_DIALOG_WIDTH, }, }; use adw::prelude::*; diff --git a/src/ui/wivrn_wired_start_box.rs b/src/ui/wivrn_wired_start_box.rs index b121c5f..fcbd44f 100644 --- a/src/ui/wivrn_wired_start_box.rs +++ b/src/ui/wivrn_wired_start_box.rs @@ -1,4 +1,4 @@ -use super::{alert::alert, ADB_ERR_NO_DEV}; +use super::{ADB_ERR_NO_DEV, alert::alert}; use crate::{ async_process::async_process, constants::APP_NAME, @@ -112,7 +112,13 @@ impl AsyncComponent for WivrnWiredStartBox { Self::Input::UpdateSelectedProfile(p) => self.set_selected_profile(p), Self::Input::StartWivrnClient => { if !dep_adb().check() { - alert("ADB is not installed", Some(&format!("Please install ADB on your computer to start the WiVRn client from {APP_NAME}.")), Some(&self.root_win)); + alert( + "ADB is not installed", + Some(&format!( + "Please install ADB on your computer to start the WiVRn client from {APP_NAME}." + )), + Some(&self.root_win), + ); return; } self.set_start_client_status(StartClientStatus::InProgress); diff --git a/src/util/file_utils.rs b/src/util/file_utils.rs index 951493b..068806d 100644 --- a/src/util/file_utils.rs +++ b/src/util/file_utils.rs @@ -2,10 +2,10 @@ use crate::{async_process::async_process, depcheck::common::dep_getcap_setcap, p use anyhow::bail; use nix::{ errno::Errno, - sys::statvfs::{statvfs, FsFlags}, + sys::statvfs::{FsFlags, statvfs}, }; use std::{ - fs::{self, copy, create_dir_all, remove_dir_all, File, OpenOptions}, + fs::{self, File, OpenOptions, copy, create_dir_all, remove_dir_all}, io::{BufReader, BufWriter}, os::unix::fs::PermissionsExt, path::Path, diff --git a/src/vulkaninfo.rs b/src/vulkaninfo.rs index 6d76a92..c769e57 100644 --- a/src/vulkaninfo.rs +++ b/src/vulkaninfo.rs @@ -1,6 +1,6 @@ use ash::{ - vk::{ApplicationInfo, InstanceCreateInfo}, Entry, + vk::{ApplicationInfo, InstanceCreateInfo}, }; #[derive(Debug, Clone)] diff --git a/src/xr_devices.rs b/src/xr_devices.rs index 45ccb9d..8ae622c 100644 --- a/src/xr_devices.rs +++ b/src/xr_devices.rs @@ -253,13 +253,10 @@ impl XRDevice { id: dev.name_id, index: dev.index, serial: dev.serial().ok(), - battery: dev.battery_status().ok().and_then(|bs| { - if bs.present { - Some(bs) - } else { - None - } - }), + battery: dev + .battery_status() + .ok() + .and_then(|bs| if bs.present { Some(bs) } else { None }), name: dev.name, roles: Vec::default(), },