diff --git a/extensions/downloads-manager/CHANGELOG.md b/extensions/downloads-manager/CHANGELOG.md index 0f47c8c27ac13..3f5386fe6159b 100644 --- a/extensions/downloads-manager/CHANGELOG.md +++ b/extensions/downloads-manager/CHANGELOG.md @@ -1,5 +1,9 @@ # Downloads Manager Changelog +## [Add show hidden files preference] - {PR_MERGE_DATE} + +- Added a preference to show hidden files in the `Manage Downloads` command + ## [Add close window script] - 2024-10-29 - Added a script to close the window to ensure it closes after the action is completed diff --git a/extensions/downloads-manager/package.json b/extensions/downloads-manager/package.json index 6fe9eef5322dd..021d7669e27cc 100644 --- a/extensions/downloads-manager/package.json +++ b/extensions/downloads-manager/package.json @@ -20,7 +20,18 @@ "name": "manage-downloads", "title": "Manage Downloads", "description": "Search and organize your downloaded files", - "mode": "view" + "mode": "view", + "preferences": [ + { + "type": "checkbox", + "name": "showHiddenFiles", + "label": "Show Hidden Files", + "title": "Show Hidden Files", + "description": "Show hidden files in the folder", + "required": false, + "default": false + } + ] }, { "name": "open-latest-download", diff --git a/extensions/downloads-manager/src/utils.tsx b/extensions/downloads-manager/src/utils.tsx index d52dfee0ca4e6..3db72a959aebc 100644 --- a/extensions/downloads-manager/src/utils.tsx +++ b/extensions/downloads-manager/src/utils.tsx @@ -4,13 +4,14 @@ import { join } from "path"; import { ComponentType } from "react"; import untildify from "untildify"; -const preferences: Preferences = getPreferenceValues(); +const preferences = getPreferenceValues(); export const downloadsFolder = untildify(preferences.downloadsFolder ?? "~/Downloads"); +const showHiddenFiles = preferences.showHiddenFiles; export function getDownloads() { const files = readdirSync(downloadsFolder); return files - .filter((file) => !file.startsWith(".")) + .filter((file) => showHiddenFiles || !file.startsWith(".")) .map((file) => { const path = join(downloadsFolder, file); const lastModifiedAt = statSync(path).mtime;