chore: add cosmic app list and cosmic panel buttons

This commit is contained in:
Ashley Wulber 2022-06-06 11:52:45 -04:00
parent 853caa5b84
commit 464338585c
No known key found for this signature in database
GPG key ID: BCD0B777C3F6E2FD
54 changed files with 3855 additions and 187 deletions

View file

@ -0,0 +1,26 @@
// SPDX-License-Identifier: MPL-2.0-only
use std::path::PathBuf;
use gtk4::glib;
use std::future::Future;
pub fn data_path(id: &str) -> PathBuf {
let mut path = glib::user_data_dir();
path.push(id);
std::fs::create_dir_all(&path).expect("Could not create directory.");
path.push("data.json");
path
}
pub fn thread_context() -> glib::MainContext {
glib::MainContext::thread_default().unwrap_or_else(|| glib::MainContext::new())
}
pub fn block_on<F>(future: F) -> F::Output
where
F: Future,
{
let ctx = thread_context();
ctx.with_thread_default(|| ctx.block_on(future)).unwrap()
}