Test this on macOS
I don't have a macOS to test this on, so I cannot ensure that this is working there. But as far as I know, All crates used support macOS.
Hi! I tried to build this on MacOS (Sonoma 14.3, rust 1.75.0):
- First, you need to install LLVM (
brew install llvm, and thenecho 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc)
But then, running cargo build -p attractor-egui --release, I get this error:
Compiling wallpaper v4.0.0 (https://github.com/Rodrigodd/wallpaper.rs.git?rev=5733320aca9349bcf06c727250dac5ec6c6b5f42#5733320a)
error[E0412]: cannot find type `Path` in this scope
--> /Users/annahope/.cargo/git/checkouts/wallpaper.rs-85390b1710a6df7f/5733320/src/macos.rs:20:14
|
20 | P: AsRef<Path> + std::fmt::Display,
| ^^^^ not found in this scope
|
help: consider importing this struct
|
1 + use std::path::Path;
|
Looks like this file needs to import std::path::Path.
It seems like wallpaper.rs has a few issues on OS X. Apologies for the raw diff, but here's a quick and dirty set of changes to what I did to get it to build with 1.76.0-nightly (after installing LLVM).
index c94ce0a..ad2442d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ license = "Unlicense"
dirs = { version = "1", optional = true }
thiserror = "1"
reqwest = { version = "0.11", optional = true, features = ["blocking"] }
+rust-ini = "0.12"
[target.'cfg(unix)'.dependencies]
enquote = "1"
diff --git a/src/macos.rs b/src/macos.rs
index 06f74b5..ed85584 100644
--- a/src/macos.rs
+++ b/src/macos.rs
@@ -1,4 +1,5 @@
-use crate::{get_stdout, run, Mode, Result};
+use crate::{get_stdout, run, Result};
+use std::path::Path;
#[cfg(feature = "from_url")]
use crate::download_image;
@@ -19,13 +20,14 @@ pub fn set_from_path<P>(path: P) -> Result<()>
where
P: AsRef<Path> + std::fmt::Display,
{
+ let path_str = path.to_string(); // Convert path to a string
run(
"osascript",
&[
"-e",
&format!(
r#"tell application "System Events" to tell every desktop to set picture to {}"#,
- enquote::enquote('"', path),
+ enquote::enquote('"', &path_str),
),
],
)
@@ -38,7 +40,3 @@ pub fn set_from_url(url: &str) -> Result<()> {
set_from_path(&path)
}
-/// No-op. Unable to change with AppleScript.
-pub fn set_mode(_: Mode) -> Result<()> {
- Err("unsupported on macos".into())
-}```
It seems like it's not doing great with my Macbook Pro's high dpi display. Looks to be half-sized, and the Configuration controls appear to be relative to the window (vs. the actual mouse position). I've never used egui, will have to leave this to somebody else to try and fix.
All that said, everything does build and work, nice work!
Thanks @anna-hope and @jacobbarssbailey for testing it out!
In #7, I added a GitHub action that builds the project on macOS, and I think it is working now. If this was the only problem, I will close this issue.
@jacobbarssbailey, there appears to be a problem with handling DPI scaling (I don't remember if I am handling it at all). I will create another issue about that.