Skip to content

Conversation

@PrayagCodes
Copy link

Summary

This PR implements a feature to display the count of hidden files in the explorer status bar footer. When "Show Hidden Files" is enabled and hidden files are present, the status bar shows the count in the format "X items (Y hidden)".

Motivation

Currently, users cannot easily determine how many files in a folder are hidden files, even when "Show Hidden Files" is enabled. This information is useful for:

  • Understanding folder contents at a glance
  • Verifying that hidden files are being displayed correctly
  • Managing files that start with '.' (dot prefix)

Changes

Core Functionality

  • Modified update_explorer_footer_item_count() in UIWindow.js to count visible and hidden files separately
  • Updated show_or_hide_files() in helpers.js to trigger footer count updates when toggling visibility
  • Added "hidden" translation key to en.js for internationalization support

Bug Fixes

  • Fixed newly created hidden files defaulting to visible state instead of respecting user preferences
  • Added visibility class updates when renaming files to/from hidden status (both local and remote operations)

Files Modified

  • src/gui/src/UI/UIWindow.js - Enhanced footer count logic
  • src/gui/src/helpers.js - Added footer updates on toggle and rename operations
  • src/gui/src/UI/UIItem.js - Auto-determine visibility based on filename
  • src/gui/src/UI/UIDesktop.js - Handle visibility updates on remote rename events
  • src/gui/src/i18n/translations/en.js - Added translation key

Implementation Details

Hidden files are identified by names starting with '.' (dot). The visibility state uses three CSS classes:

  • item-visible: Normal files (not hidden)
  • item-revealed: Hidden files when "Show Hidden Files" is enabled (reduced opacity)
  • item-hidden: Hidden files when "Show Hidden Files" is disabled (display: none)

The count only displays when:

  1. "Show Hidden Files" preference is enabled
  2. At least one hidden file is present in the current folder

Testing Instructions

Test Case 1: Basic Hidden File Count Display

  1. Navigate to any folder (e.g., Documents)
  2. Create 2 normal files: file1.txt, file2.txt
  3. Create 2 hidden files: .hidden1, .hidden2
  4. Verify status bar shows "2 items" (hidden files not counted when hidden)
  5. Right-click and enable "Show Hidden Files"
  6. Verify status bar shows "4 items (2 hidden)"
  7. Disable "Show Hidden Files"
  8. Verify status bar shows "2 items" again

Test Case 2: Newly Created Hidden Files

  1. Ensure "Show Hidden Files" is disabled
  2. Create a new file and name it .newhidden
  3. Verify the file does not appear (properly hidden)
  4. Enable "Show Hidden Files"
  5. Verify .newhidden appears with reduced opacity
  6. Verify status bar shows hidden count

Test Case 3: Renaming to/from Hidden

  1. Enable "Show Hidden Files"
  2. Create normal file: test.txt
  3. Rename to .test.txt
  4. Verify file becomes semi-transparent (revealed state)
  5. Verify status bar updates hidden count
  6. Rename back to test.txt
  7. Verify file becomes fully visible
  8. Verify status bar updates hidden count

Test Case 4: Toggle Updates Count Immediately

  1. Open folder with both normal and hidden files
  2. Toggle "Show Hidden Files" on/off multiple times
  3. Verify status bar updates immediately each time

Display hidden file count as 'X items (Y hidden)' when Show Hidden Files
is enabled. Also fixes visibility handling for newly created and renamed
hidden files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant