chore: update dependencies
Updates all dependencies other than ICU. Enables the `dbus-config` libcosmic feature to fix theming responsiveness. Also prevents the trash and network drive layer container from touching the edge of the window.
This commit is contained in:
parent
4d642ee3fa
commit
3ee1a07f09
12 changed files with 296 additions and 619 deletions
28
src/app.rs
28
src/app.rs
|
|
@ -44,8 +44,8 @@ use cosmic::{
|
|||
};
|
||||
use mime_guess::Mime;
|
||||
use notify_debouncer_full::{
|
||||
DebouncedEvent, Debouncer, FileIdMap, new_debouncer,
|
||||
notify::{self, RecommendedWatcher, Watcher},
|
||||
DebouncedEvent, Debouncer, RecommendedCache, new_debouncer,
|
||||
notify::{self, RecommendedWatcher},
|
||||
};
|
||||
use slotmap::Key as SlotMapKey;
|
||||
use std::{
|
||||
|
|
@ -611,7 +611,7 @@ pub enum WindowKind {
|
|||
}
|
||||
|
||||
pub struct WatcherWrapper {
|
||||
watcher_opt: Option<Debouncer<RecommendedWatcher, FileIdMap>>,
|
||||
watcher_opt: Option<Debouncer<RecommendedWatcher, RecommendedCache>>,
|
||||
}
|
||||
|
||||
impl Clone for WatcherWrapper {
|
||||
|
|
@ -673,7 +673,10 @@ pub struct App {
|
|||
#[cfg(all(feature = "wayland", feature = "desktop-applet"))]
|
||||
surface_names: HashMap<WindowId, String>,
|
||||
toasts: widget::toaster::Toasts<Message>,
|
||||
watcher_opt: Option<(Debouncer<RecommendedWatcher, FileIdMap>, HashSet<PathBuf>)>,
|
||||
watcher_opt: Option<(
|
||||
Debouncer<RecommendedWatcher, RecommendedCache>,
|
||||
HashSet<PathBuf>,
|
||||
)>,
|
||||
windows: HashMap<window::Id, WindowKind>,
|
||||
nav_dnd_hover: Option<(Location, Instant)>,
|
||||
tab_dnd_hover: Option<(Entity, Instant)>,
|
||||
|
|
@ -1583,7 +1586,7 @@ impl App {
|
|||
// Unwatch paths no longer used
|
||||
for path in old_paths.iter() {
|
||||
if !new_paths.contains(path) {
|
||||
match watcher.watcher().unwatch(path) {
|
||||
match watcher.unwatch(path) {
|
||||
Ok(()) => {
|
||||
log::debug!("unwatching {:?}", path);
|
||||
}
|
||||
|
|
@ -1597,10 +1600,7 @@ impl App {
|
|||
// Watch new paths
|
||||
for path in new_paths.iter() {
|
||||
if !old_paths.contains(path) {
|
||||
match watcher
|
||||
.watcher()
|
||||
.watch(path, notify::RecursiveMode::NonRecursive)
|
||||
{
|
||||
match watcher.watch(path, notify::RecursiveMode::NonRecursive) {
|
||||
Ok(()) => {
|
||||
log::debug!("watching {:?}", path);
|
||||
}
|
||||
|
|
@ -5983,9 +5983,8 @@ impl Application for App {
|
|||
.map(|path| [path.join("files"), path])
|
||||
.flatten();
|
||||
for path in trash_paths {
|
||||
if let Err(e) = watcher
|
||||
.watcher()
|
||||
.watch(&path, notify::RecursiveMode::NonRecursive)
|
||||
if let Err(e) =
|
||||
watcher.watch(&path, notify::RecursiveMode::NonRecursive)
|
||||
{
|
||||
log::warn!(
|
||||
"failed to add trash bin `{}` to watcher: {e:?}",
|
||||
|
|
@ -6055,9 +6054,8 @@ impl Application for App {
|
|||
|
||||
match watcher_res {
|
||||
Ok(mut watcher) => {
|
||||
if let Err(e) = watcher
|
||||
.watcher()
|
||||
.watch(&recents_path, notify::RecursiveMode::NonRecursive)
|
||||
if let Err(e) =
|
||||
watcher.watch(&recents_path, notify::RecursiveMode::NonRecursive)
|
||||
{
|
||||
log::warn!(
|
||||
"failed to add recents file `{}` to watcher: {}",
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ pub const SUPPORTED_ARCHIVE_TYPES: &[&str] = &[
|
|||
"application/x-bzip2",
|
||||
#[cfg(feature = "bzip2")]
|
||||
"application/x-bzip2-compressed-tar",
|
||||
#[cfg(feature = "xz2")]
|
||||
#[cfg(feature = "liblzma")]
|
||||
"application/x-xz",
|
||||
#[cfg(feature = "xz2")]
|
||||
#[cfg(feature = "liblzma")]
|
||||
"application/x-xz-compressed-tar",
|
||||
];
|
||||
|
||||
|
|
@ -86,11 +86,11 @@ pub fn extract(
|
|||
.map(tar::Archive::new)
|
||||
.and_then(|mut archive| archive.unpack(new_dir))
|
||||
.map_err(|e| OperationError::from_err(e, controller))?,
|
||||
#[cfg(feature = "xz2")]
|
||||
#[cfg(feature = "liblzma")]
|
||||
"application/x-xz" | "application/x-xz-compressed-tar" => {
|
||||
OpReader::new(path, controller.clone())
|
||||
.map(io::BufReader::new)
|
||||
.map(xz2::read::XzDecoder::new)
|
||||
.map(liblzma::read::XzDecoder::new)
|
||||
.map(tar::Archive::new)
|
||||
.and_then(|mut archive| archive.unpack(new_dir))
|
||||
.map_err(|e| OperationError::from_err(e, controller))?
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ use cosmic::{
|
|||
},
|
||||
};
|
||||
use notify_debouncer_full::{
|
||||
DebouncedEvent, Debouncer, FileIdMap, new_debouncer,
|
||||
notify::{self, RecommendedWatcher, Watcher},
|
||||
DebouncedEvent, Debouncer, RecommendedCache, new_debouncer,
|
||||
notify::{self, RecommendedWatcher},
|
||||
};
|
||||
use recently_used_xbel::update_recently_used;
|
||||
use std::{
|
||||
|
|
@ -468,7 +468,7 @@ impl From<AppMessage> for Message {
|
|||
pub struct MounterData(MounterKey, MounterItem);
|
||||
|
||||
struct WatcherWrapper {
|
||||
watcher_opt: Option<Debouncer<RecommendedWatcher, FileIdMap>>,
|
||||
watcher_opt: Option<Debouncer<RecommendedWatcher, RecommendedCache>>,
|
||||
}
|
||||
|
||||
impl Clone for WatcherWrapper {
|
||||
|
|
@ -510,7 +510,10 @@ struct App {
|
|||
search_id: widget::Id,
|
||||
tab: Tab,
|
||||
key_binds: HashMap<KeyBind, Action>,
|
||||
watcher_opt: Option<(Debouncer<RecommendedWatcher, FileIdMap>, HashSet<PathBuf>)>,
|
||||
watcher_opt: Option<(
|
||||
Debouncer<RecommendedWatcher, RecommendedCache>,
|
||||
HashSet<PathBuf>,
|
||||
)>,
|
||||
auto_scroll_speed: Option<i16>,
|
||||
}
|
||||
|
||||
|
|
@ -866,7 +869,7 @@ impl App {
|
|||
// Unwatch paths no longer used
|
||||
for path in old_paths.iter() {
|
||||
if !new_paths.contains(path) {
|
||||
match watcher.watcher().unwatch(path) {
|
||||
match watcher.unwatch(path) {
|
||||
Ok(()) => {
|
||||
log::debug!("unwatching {:?}", path);
|
||||
}
|
||||
|
|
@ -881,10 +884,7 @@ impl App {
|
|||
for path in new_paths.iter() {
|
||||
if !old_paths.contains(path) {
|
||||
//TODO: should this be recursive?
|
||||
match watcher
|
||||
.watcher()
|
||||
.watch(path, notify::RecursiveMode::NonRecursive)
|
||||
{
|
||||
match watcher.watch(path, notify::RecursiveMode::NonRecursive) {
|
||||
Ok(()) => {
|
||||
log::debug!("watching {:?}", path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use i18n_embed::{
|
||||
DefaultLocalizer, LanguageLoader, Localizer,
|
||||
fluent::{FluentLanguageLoader, fluent_language_loader},
|
||||
|
|
@ -9,14 +7,15 @@ use i18n_embed::{
|
|||
use icu::locid::Locale;
|
||||
use icu_collator::{Collator, CollatorOptions, Numeric};
|
||||
use icu_provider::DataLocale;
|
||||
use once_cell::sync::Lazy;
|
||||
use rust_embed::RustEmbed;
|
||||
use std::str::FromStr;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "i18n/"]
|
||||
struct Localizations;
|
||||
|
||||
pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| {
|
||||
pub static LANGUAGE_LOADER: LazyLock<FluentLanguageLoader> = LazyLock::new(|| {
|
||||
let loader: FluentLanguageLoader = fluent_language_loader!();
|
||||
|
||||
loader
|
||||
|
|
@ -26,7 +25,7 @@ pub static LANGUAGE_LOADER: Lazy<FluentLanguageLoader> = Lazy::new(|| {
|
|||
loader
|
||||
});
|
||||
|
||||
pub static LANGUAGE_SORTER: Lazy<Collator> = Lazy::new(|| {
|
||||
pub static LANGUAGE_SORTER: LazyLock<Collator> = LazyLock::new(|| {
|
||||
let mut options = CollatorOptions::new();
|
||||
options.numeric = Some(Numeric::On);
|
||||
|
||||
|
|
@ -41,7 +40,7 @@ pub static LANGUAGE_SORTER: Lazy<Collator> = Lazy::new(|| {
|
|||
.expect("Creating a collator from the system's current language, the fallback language, or American English should succeed")
|
||||
});
|
||||
|
||||
pub static LOCALE: Lazy<Locale> = Lazy::new(|| {
|
||||
pub static LOCALE: LazyLock<Locale> = LazyLock::new(|| {
|
||||
fn get_local() -> Result<Locale, Box<dyn std::error::Error>> {
|
||||
let locale = std::env::var("LC_TIME").or_else(|_| std::env::var("LANG"))?;
|
||||
|
||||
|
|
|
|||
|
|
@ -291,29 +291,22 @@ impl MimeAppCache {
|
|||
// https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
|
||||
//TODO: ensure correct lookup order
|
||||
let mut mimeapps_paths = Vec::new();
|
||||
match xdg::BaseDirectories::new() {
|
||||
Ok(xdg_dirs) => {
|
||||
for path in xdg_dirs.find_data_files("applications/mimeapps.list") {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
for desktop in desktops.iter().rev() {
|
||||
for path in
|
||||
xdg_dirs.find_data_files(format!("applications/{desktop}-mimeapps.list"))
|
||||
{
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
}
|
||||
for path in xdg_dirs.find_config_files("mimeapps.list") {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
for desktop in desktops.iter().rev() {
|
||||
for path in xdg_dirs.find_config_files(format!("{desktop}-mimeapps.list")) {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
}
|
||||
let xdg_dirs = xdg::BaseDirectories::new();
|
||||
|
||||
for path in xdg_dirs.find_data_files("applications/mimeapps.list") {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
for desktop in desktops.iter().rev() {
|
||||
for path in xdg_dirs.find_data_files(format!("applications/{desktop}-mimeapps.list")) {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("failed to get xdg base directories: {}", err);
|
||||
}
|
||||
for path in xdg_dirs.find_config_files("mimeapps.list") {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
for desktop in desktops.iter().rev() {
|
||||
for path in xdg_dirs.find_config_files(format!("{desktop}-mimeapps.list")) {
|
||||
mimeapps_paths.push(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,12 @@
|
|||
|
||||
use cosmic::widget::icon;
|
||||
use mime_guess::Mime;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{collections::HashMap, fs, path::Path, sync::Mutex};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
path::Path,
|
||||
sync::{LazyLock, Mutex},
|
||||
};
|
||||
|
||||
pub const FALLBACK_MIME_ICON: &str = "text-x-generic";
|
||||
|
||||
|
|
@ -48,7 +52,8 @@ impl MimeIconCache {
|
|||
.clone()
|
||||
}
|
||||
}
|
||||
static MIME_ICON_CACHE: Lazy<Mutex<MimeIconCache>> = Lazy::new(|| Mutex::new(MimeIconCache::new()));
|
||||
static MIME_ICON_CACHE: LazyLock<Mutex<MimeIconCache>> =
|
||||
LazyLock::new(|| Mutex::new(MimeIconCache::new()));
|
||||
|
||||
pub fn mime_for_path<P: AsRef<Path>>(
|
||||
path: P,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
use cosmic::{Task, iced::Subscription, widget};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{collections::BTreeMap, fmt, path::PathBuf, sync::Arc};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
fmt,
|
||||
path::PathBuf,
|
||||
sync::{Arc, LazyLock},
|
||||
};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::{config::IconSizes, tab};
|
||||
|
|
@ -125,4 +129,4 @@ pub fn mounters() -> Mounters {
|
|||
Mounters::new(mounters)
|
||||
}
|
||||
|
||||
pub static MOUNTERS: Lazy<Mounters> = Lazy::new(mounters);
|
||||
pub static MOUNTERS: LazyLock<Mounters> = LazyLock::new(mounters);
|
||||
|
|
|
|||
17
src/tab.rs
17
src/tab.rs
|
|
@ -1,5 +1,5 @@
|
|||
use cosmic::{
|
||||
Element, cosmic_theme, font,
|
||||
Apply, Element, cosmic_theme, font,
|
||||
iced::{
|
||||
Alignment,
|
||||
Border,
|
||||
|
|
@ -45,7 +45,6 @@ use icu::datetime::{
|
|||
use image::ImageDecoder;
|
||||
use jxl_oxide::integration::JxlDecoder;
|
||||
use mime_guess::{Mime, mime};
|
||||
use once_cell::sync::Lazy;
|
||||
use ordermap::OrderMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
|
|
@ -106,7 +105,7 @@ pub(crate) static SORT_OPTION_FALLBACK: LazyLock<HashMap<String, (HeadingOptions
|
|||
}))
|
||||
});
|
||||
|
||||
static MODE_NAMES: Lazy<Vec<String>> = Lazy::new(|| {
|
||||
static MODE_NAMES: LazyLock<Vec<String>> = LazyLock::new(|| {
|
||||
vec![
|
||||
// Mode 0
|
||||
fl!("none"),
|
||||
|
|
@ -127,7 +126,7 @@ static MODE_NAMES: Lazy<Vec<String>> = Lazy::new(|| {
|
|||
]
|
||||
});
|
||||
|
||||
static SPECIAL_DIRS: Lazy<HashMap<PathBuf, &'static str>> = Lazy::new(|| {
|
||||
static SPECIAL_DIRS: LazyLock<HashMap<PathBuf, &'static str>> = LazyLock::new(|| {
|
||||
let mut special_dirs = HashMap::new();
|
||||
if let Some(dir) = dirs::document_dir() {
|
||||
special_dirs.insert(dir, "folder-documents");
|
||||
|
|
@ -533,7 +532,7 @@ pub enum FsKind {
|
|||
pub fn fs_kind(metadata: &Metadata) -> FsKind {
|
||||
//TODO: method to reload remote filesystems dynamically
|
||||
//TODO: fix for https://github.com/eminence/procfs/issues/262
|
||||
static DEVICES: Lazy<HashMap<u64, FsKind>> = Lazy::new(|| {
|
||||
static DEVICES: LazyLock<HashMap<u64, FsKind>> = LazyLock::new(|| {
|
||||
let mut devices = HashMap::new();
|
||||
match procfs::process::Process::myself() {
|
||||
Ok(process) => match process.mountinfo() {
|
||||
|
|
@ -5520,7 +5519,9 @@ impl Tab {
|
|||
.into(),
|
||||
]))
|
||||
.padding([space_xxs, space_xs])
|
||||
.layer(cosmic_theme::Layer::Primary),
|
||||
.layer(cosmic_theme::Layer::Primary)
|
||||
.apply(widget::container)
|
||||
.padding([0, 0, 7, 0]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -5534,7 +5535,9 @@ impl Tab {
|
|||
.into(),
|
||||
]))
|
||||
.padding([space_xxs, space_xs])
|
||||
.layer(cosmic_theme::Layer::Primary),
|
||||
.layer(cosmic_theme::Layer::Primary)
|
||||
.apply(widget::container)
|
||||
.padding([0, 0, 7, 0]),
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use image::DynamicImage;
|
||||
use md5::{Digest, Md5};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
error::Error,
|
||||
|
|
@ -8,6 +7,7 @@ use std::{
|
|||
io::{self, BufReader, BufWriter},
|
||||
os::unix::fs::PermissionsExt,
|
||||
path::{Path, PathBuf},
|
||||
sync::LazyLock,
|
||||
time::UNIX_EPOCH,
|
||||
};
|
||||
use tempfile::NamedTempFile;
|
||||
|
|
@ -158,7 +158,12 @@ impl ThumbnailCacher {
|
|||
)
|
||||
};
|
||||
|
||||
let mut image_data = vec![0; reader.output_buffer_size()];
|
||||
let mut image_data = vec![
|
||||
0;
|
||||
reader.output_buffer_size().ok_or_else(
|
||||
|| "The required image buffer size is too large."
|
||||
)?
|
||||
];
|
||||
reader.next_frame(&mut image_data)?;
|
||||
|
||||
let file = File::create(path)?;
|
||||
|
|
@ -340,7 +345,7 @@ pub enum CachedThumbnail {
|
|||
Failed,
|
||||
}
|
||||
|
||||
static THUMBNAIL_CACHE_BASE_DIR: Lazy<Option<PathBuf>> = Lazy::new(|| {
|
||||
static THUMBNAIL_CACHE_BASE_DIR: LazyLock<Option<PathBuf>> = LazyLock::new(|| {
|
||||
if let Some(cache_dir) = dirs::cache_dir() {
|
||||
return Some(cache_dir.join("thumbnails"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,14 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use mime_guess::Mime;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::{collections::HashMap, fs, path::Path, process, sync::Mutex, time::Instant};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs,
|
||||
path::Path,
|
||||
process,
|
||||
sync::{LazyLock, Mutex},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Thumbnailer {
|
||||
|
|
@ -72,16 +78,13 @@ impl ThumbnailerCache {
|
|||
self.cache.clear();
|
||||
|
||||
let mut search_dirs = Vec::new();
|
||||
match xdg::BaseDirectories::new() {
|
||||
Ok(xdg_dirs) => {
|
||||
search_dirs.push(xdg_dirs.get_data_home().join("thumbnailers"));
|
||||
for data_dir in xdg_dirs.get_data_dirs() {
|
||||
search_dirs.push(data_dir.join("thumbnailers"));
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
log::warn!("failed to get xdg base directories: {}", err);
|
||||
}
|
||||
let xdg_dirs = xdg::BaseDirectories::new();
|
||||
|
||||
if let Some(data_home) = xdg_dirs.get_data_home() {
|
||||
search_dirs.push(data_home.join("thumbnailers"));
|
||||
}
|
||||
for data_dir in xdg_dirs.get_data_dirs() {
|
||||
search_dirs.push(data_dir.join("thumbnailers"));
|
||||
}
|
||||
|
||||
let mut thumbnailer_paths = Vec::new();
|
||||
|
|
@ -148,8 +151,8 @@ impl ThumbnailerCache {
|
|||
}
|
||||
}
|
||||
|
||||
static THUMBNAILER_CACHE: Lazy<Mutex<ThumbnailerCache>> =
|
||||
Lazy::new(|| Mutex::new(ThumbnailerCache::new()));
|
||||
static THUMBNAILER_CACHE: LazyLock<Mutex<ThumbnailerCache>> =
|
||||
LazyLock::new(|| Mutex::new(ThumbnailerCache::new()));
|
||||
|
||||
pub fn thumbnailer(mime: &Mime) -> Vec<Thumbnailer> {
|
||||
let thumbnailer_cache = THUMBNAILER_CACHE.lock().unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue