Skip to content

Commit

Permalink
Force MacOS "dock" to refresh
Browse files Browse the repository at this point in the history
Signed-off-by: Thibault Meyer <meyer.thibault@gmail.com>
  • Loading branch information
thibaultmeyer committed Feb 21, 2024
1 parent 012a027 commit c4f766c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ choose the one that seems best suited to you (crontab, gnome start at launch, et

* [LINUX] Only Gnome is natively supported, to use this application with another Desktop
Environment, you have to use `exec_apply_wallpaper` option in the configuration file
* [MACOS] Dock, don't refresh wallpaper. This application have a workaround (but sometime Dock wins)
* [WINDOWS] Parameter `--nowindow` (or `-w`) not working if you use Terminal as default
console. Terminal don't honor Windows API and don't allow application to detach from
terminal. As workaround, you could create a shortcut and configure it to enable the
Expand Down
7 changes: 5 additions & 2 deletions src/bingwallpaper/bingwallpaperchanger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ impl BingWallpaperChanger {
}

#[cfg(target_os = "macos")] {
self.change_wallpaper_macos();
// Loop is needed to force Dock to refresh wallpaper :(
for _ in 0..20 {
self.change_wallpaper_macos();
}
}

#[cfg(target_os = "windows")] {
Expand Down Expand Up @@ -242,7 +245,7 @@ impl BingWallpaperChanger {
.expect("Can't change wallpaper");
child.wait().expect("Can't wait for child process");

std::thread::sleep(std::time::Duration::from_secs(1));
//std::thread::sleep(std::time::Duration::from_secs(1));
fs::remove_file(&tmp_filename).unwrap();
fs::remove_file(swift_script_path).unwrap();
}
Expand Down

0 comments on commit c4f766c

Please sign in to comment.