Connect applications to schemes, filetypes, and more on macOS (more to come)
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Removed truly needless async declarations

+9 -11
+5 -7
infat-lib/src/association.rs
··· 1 - //! High-level association management combining all the pieces 2 - 3 1 use crate::{ 4 2 error::{InfatError, Result}, 5 3 macos::{launch_services, workspace}, ··· 8 6 use tracing::{debug, info}; 9 7 10 8 /// Set the default application for a file extension 11 - pub async fn set_default_app_for_extension(extension: &str, app_name: &str) -> Result<()> { 9 + pub fn set_default_app_for_extension(extension: &str, app_name: &str) -> Result<()> { 12 10 info!( 13 11 "Setting default app for extension .{} to {}", 14 12 extension, app_name ··· 17 15 // Handle special routing for HTML 18 16 if extension.to_lowercase() == "html" { 19 17 debug!("Routing .html to HTTP scheme handler"); 20 - return set_default_app_for_url_scheme("http", app_name).await; 18 + return set_default_app_for_url_scheme("http", app_name); 21 19 } 22 20 23 21 // Get the UTI for the extension ··· 35 33 } 36 34 37 35 /// Set the default application for a URL scheme 38 - pub async fn set_default_app_for_url_scheme(scheme: &str, app_name: &str) -> Result<()> { 36 + pub fn set_default_app_for_url_scheme(scheme: &str, app_name: &str) -> Result<()> { 39 37 info!( 40 38 "Setting default app for URL scheme {} to {}", 41 39 scheme, app_name ··· 65 63 } 66 64 67 65 /// Set the default application for a supertype/UTI 68 - pub async fn set_default_app_for_type(type_name: &str, app_name: &str) -> Result<()> { 66 + pub fn set_default_app_for_type(type_name: &str, app_name: &str) -> Result<()> { 69 67 info!("Setting default app for type {} to {}", type_name, app_name); 70 68 71 69 // Handle special routing for web types 72 70 if type_name == "com.apple.default-app.web-browser" || type_name == "public.html" { 73 71 debug!("Routing web browser type to HTTP scheme handler"); 74 - return set_default_app_for_url_scheme("http", app_name).await; 72 + return set_default_app_for_url_scheme("http", app_name); 75 73 } 76 74 77 75 // Try to parse as a SuperType first
+4 -4
infat-lib/src/config.rs
··· 126 126 } 127 127 128 128 /// Apply configuration settings 129 - pub async fn apply_config(config: &Config, robust: bool) -> Result<()> { 129 + pub fn apply_config(config: &Config, robust: bool) -> Result<()> { 130 130 info!("Applying configuration settings"); 131 131 132 132 config.validate()?; ··· 147 147 config.types.len() 148 148 ); 149 149 for (type_name, app_name) in &config.types { 150 - match association::set_default_app_for_type(type_name, app_name).await { 150 + match association::set_default_app_for_type(type_name, app_name) { 151 151 Ok(_) => { 152 152 info!("✓ Set type {} → {}", type_name, app_name); 153 153 success_count += 1; ··· 172 172 config.extensions.len() 173 173 ); 174 174 for (ext, app_name) in &config.extensions { 175 - match association::set_default_app_for_extension(ext, app_name).await { 175 + match association::set_default_app_for_extension(ext, app_name) { 176 176 Ok(_) => { 177 177 info!("✓ Set .{} → {}", ext, app_name); 178 178 success_count += 1; ··· 197 197 config.schemes.len() 198 198 ); 199 199 for (scheme, app_name) in &config.schemes { 200 - match association::set_default_app_for_url_scheme(scheme, app_name).await { 200 + match association::set_default_app_for_url_scheme(scheme, app_name) { 201 201 Ok(_) => { 202 202 info!("✓ Set {} → {}", scheme, app_name); 203 203 success_count += 1;