Make each monitor an independant tab

This commit is contained in:
Jeremy Soller 2024-10-04 11:53:27 -06:00
parent 01f0b0967a
commit cc2a62a14c
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
4 changed files with 112 additions and 58 deletions

View file

@ -27,12 +27,24 @@ pub(crate) fn err_str<T: ToString>(err: T) -> String {
err.to_string()
}
pub fn desktop_dir() -> PathBuf {
match dirs::desktop_dir() {
Some(path) => path,
None => {
let path = home_dir().join("Desktop");
log::warn!("failed to locate desktop directory, falling back to {path:?}");
path
}
}
}
pub fn home_dir() -> PathBuf {
match dirs::home_dir() {
Some(home) => home,
None => {
log::warn!("failed to locate home directory");
PathBuf::from("/")
let path = PathBuf::from("/");
log::warn!("failed to locate home directory, falling back to {path:?}");
path
}
}
}
@ -46,17 +58,6 @@ pub fn desktop() -> Result<(), Box<dyn std::error::Error>> {
let (config_handler, config) = Config::load();
let locations = vec![
match dirs::desktop_dir() {
Some(path) => Location::Path(path),
None => {
let path = home_dir().join("Desktop");
log::warn!("failed to find XDG_DESKTOP_DIR, falling back to {path:?}");
Location::Path(path)
}
}
];
let mut settings = Settings::default();
settings = settings.theme(config.app_theme.theme());
settings = settings.size_limits(Limits::NONE.min_width(360.0).min_height(180.0));
@ -71,7 +72,7 @@ pub fn desktop() -> Result<(), Box<dyn std::error::Error>> {
config_handler,
config,
mode: app::Mode::Desktop,
locations,
locations: vec![tab::Location::Path(desktop_dir())],
};
cosmic::app::run::<App>(settings, flags)?;