Skip to content

Commit b8d2471

Browse files
Option to disable thumbnailing
Closes: #1216
1 parent acf5295 commit b8d2471

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

i18n/en/cosmic_files.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ theme = Theme
291291
match-desktop = Match desktop
292292
dark = Dark
293293
light = Light
294+
enable-thumbnails = Thumbnails
294295
295296
### Type to Search
296297
type-to-search = Type to Search

src/app.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use wayland_client::{Proxy, protocol::wl_output::WlOutput};
6969
use crate::{
7070
clipboard::{ClipboardCopy, ClipboardKind, ClipboardPaste},
7171
config::{
72-
AppTheme, Config, DesktopConfig, Favorite, IconSizes, TIME_CONFIG_ID, TabConfig,
72+
AppTheme, Config, DesktopConfig, Favorite, IconSizes, TIME_CONFIG_ID, TabConfig, ThumbCfg,
7373
TimeConfig, TypeToSearch,
7474
},
7575
dialog::{Dialog, DialogKind, DialogMessage, DialogResult},
@@ -387,6 +387,7 @@ pub enum Message {
387387
TabPrev,
388388
TabClose(Option<Entity>),
389389
TabConfig(TabConfig),
390+
ThumbConfig(ThumbCfg),
390391
TabMessage(Option<Entity>, tab::Message),
391392
TabNew,
392393
TabRescan(
@@ -1905,6 +1906,18 @@ impl App {
19051906
},
19061907
))
19071908
})
1909+
.add({
1910+
let thumb_cfg = self.config.thumb_cfg;
1911+
widget::settings::item::builder(fl!("enable-thumbnails")).toggler(
1912+
thumb_cfg.enabled,
1913+
move |enabled| {
1914+
Message::ThumbConfig(ThumbCfg {
1915+
enabled,
1916+
..thumb_cfg
1917+
})
1918+
},
1919+
)
1920+
})
19081921
.into(),
19091922
widget::settings::section()
19101923
.title(fl!("type-to-search"))
@@ -3803,6 +3816,12 @@ impl Application for App {
38033816
return self.update_config();
38043817
}
38053818
}
3819+
Message::ThumbConfig(config) => {
3820+
if config != self.config.thumb_cfg {
3821+
config_set!(thumb_cfg, config);
3822+
return self.update_config();
3823+
}
3824+
}
38063825
Message::ToggleFoldersFirst => {
38073826
let mut config = self.config.tab;
38083827
config.folders_first = !config.folders_first;

src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ pub struct ThumbCfg {
298298
pub jobs: NonZeroU16,
299299
pub max_mem_mb: NonZeroU16,
300300
pub max_size_mb: NonZeroU16,
301+
pub enabled: bool,
301302
}
302303

303304
impl Default for ThumbCfg {
@@ -306,6 +307,7 @@ impl Default for ThumbCfg {
306307
jobs: 4.try_into().unwrap(),
307308
max_mem_mb: 2000.try_into().unwrap(),
308309
max_size_mb: 64.try_into().unwrap(),
310+
enabled: true,
309311
}
310312
}
311313
}

src/tab.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5614,7 +5614,7 @@ impl Tab {
56145614
};
56155615

56165616
for item in items.iter() {
5617-
if item.thumbnail_opt.is_some() {
5617+
if item.thumbnail_opt.is_some() || !self.thumb_config.enabled {
56185618
// Skip items that already have a mime type and thumbnail
56195619
continue;
56205620
}

0 commit comments

Comments
 (0)