wipe xdg state home on init

This commit is contained in:
Erica Z 2024-11-23 13:38:03 +01:00
parent c827dd4863
commit cd3cb3aeb8

View file

@ -174,6 +174,10 @@ mod imp {
fn constructed(&self) { fn constructed(&self) {
self.parent_constructed(); self.parent_constructed();
// wipe state directory on init (gets rid of stale mpris cover art)
let state_home = audrey::globals::xdg_dirs().get_state_home();
std::fs::remove_dir_all(state_home).expect("could not remove xdg state home");
if let Some(display) = gdk::Display::default() { if let Some(display) = gdk::Display::default() {
gtk::style_context_add_provider_for_display(&display, &self.css_provider, 420); gtk::style_context_add_provider_for_display(&display, &self.css_provider, 420);
} }
@ -761,7 +765,6 @@ mod imp {
let mut mpris_art_path = audrey::globals::MPRIS_ART_PATH.lock().await; let mut mpris_art_path = audrey::globals::MPRIS_ART_PATH.lock().await;
let save_future = audrey::globals::runtime().spawn_blocking( let save_future = audrey::globals::runtime().spawn_blocking(
move || -> Result<(), image::ImageError> { move || -> Result<(), image::ImageError> {
// TODO: wipe xdg state folder on init
if let Some(path) = mpris_art_path.take() { if let Some(path) = mpris_art_path.take() {
if let Err(err) = std::fs::remove_file(&path) { if let Err(err) = std::fs::remove_file(&path) {
event!( event!(