Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/gui/src/UI/UIDesktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,34 @@ async function UIDesktop(options){
$(this).attr('data-path', new_el_path);
});

// Update visibility based on whether the new name starts with '.'
const old_name = path.basename(item.old_path);
const old_is_hidden = old_name.startsWith('.');
const new_is_hidden = item.name.startsWith('.');

// If hidden status changed, update the visibility classes
if(old_is_hidden !== new_is_hidden){
const all_matching_items = $(`.item[data-uid='${item.uid}']`);

if(new_is_hidden){
// File is now hidden
all_matching_items.removeClass('item-visible');
if(window.user_preferences.show_hidden_files){
all_matching_items.removeClass('item-hidden').addClass('item-revealed');
}else{
all_matching_items.removeClass('item-revealed').addClass('item-hidden');
}
}else{
// File is now visible (not hidden)
all_matching_items.removeClass('item-hidden item-revealed').addClass('item-visible');
}

// Update footer counts in all explorer windows
document.querySelectorAll('.window[data-app="explorer"]').forEach(el_window => {
window.update_explorer_footer_item_count(el_window);
});
}

// Update all exact-matching windows
$(`.window-${item.uid}`).each(function(){
window.update_window_path(this, new_path);
Expand Down
12 changes: 11 additions & 1 deletion src/gui/src/UI/UIItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,17 @@ function UIItem(options){

// set options defaults
options.disabled = options.disabled ?? false;
options.visible = options.visible ?? 'visible'; // one of 'visible', 'revealed', 'hidden'
// Determine visibility based on filename if not explicitly provided
if(options.visible === undefined){
const is_hidden_file = options.name.startsWith('.');
if (!is_hidden_file){
options.visible = 'visible';
}else if (window.user_preferences.show_hidden_files) {
options.visible = 'revealed';
}else{
options.visible = 'hidden';
}
}
options.is_dir = options.is_dir ?? false;
options.is_selected = options.is_selected ?? false;
options.is_shared = options.is_shared ?? false;
Expand Down
20 changes: 18 additions & 2 deletions src/gui/src/UI/UIWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -3327,8 +3327,24 @@ window.scale_window = (el_window)=>{

window.update_explorer_footer_item_count = function(el_window){
//update dir count in explorer footer
let item_count = $(el_window).find('.item').length;
$(el_window).find('.explorer-footer .explorer-footer-item-count').html(item_count + ` ${i18n('item')}` + (item_count == 0 || item_count > 1 ? `${i18n('plural_suffix')}` : ''));
// Count all items (excluding hidden ones)
let all_items = $(el_window).find('.item');
let visible_items = all_items.filter(':not(.item-hidden)');
let item_count = visible_items.length;

// Count hidden files that are currently revealed
let hidden_items = all_items.filter('.item-revealed');
let hidden_count = hidden_items.length;

// Build the display text
let display_text = item_count + ` ${i18n('item')}` + (item_count == 0 || item_count > 1 ? `${i18n('plural_suffix')}` : '');

// Add hidden count if hidden files are shown and there are hidden files
if(window.user_preferences.show_hidden_files && hidden_count > 0){
display_text += ` (${hidden_count} ${i18n('hidden')})`;
}

$(el_window).find('.explorer-footer .explorer-footer-item-count').html(display_text);
}

window.update_explorer_footer_selected_items_count = function(el_window){
Expand Down
32 changes: 32 additions & 0 deletions src/gui/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,11 @@ window.show_or_hide_files = (item_containers) => {
.find('.item')
.filter((_, item) => item.dataset.name.startsWith('.'))
.removeClass(class_to_remove).addClass(class_to_add);

// Update footer counts in all explorer windows
document.querySelectorAll('.window[data-app="explorer"]').forEach(el_window => {
window.update_explorer_footer_item_count(el_window);
});
}

window.create_folder = async(basedir, appendto_element)=>{
Expand Down Expand Up @@ -2352,6 +2357,33 @@ window.rename_file = async(options, new_name, old_name, old_path, el_item, el_it
website_url = window.determine_website_url(new_path);
$(el_item).attr('data-website_url', website_url);

// Update visibility based on whether the new name starts with '.'
const old_is_hidden = old_name.startsWith('.');
const new_is_hidden = new_name.startsWith('.');

// If hidden status changed, update the visibility classes
if(old_is_hidden !== new_is_hidden){
const all_matching_items = $(`.item[data-uid='${$(el_item).attr('data-uid')}']`);

if(new_is_hidden){
// File is now hidden
all_matching_items.removeClass('item-visible');
if(window.user_preferences.show_hidden_files){
all_matching_items.removeClass('item-hidden').addClass('item-revealed');
}else{
all_matching_items.removeClass('item-revealed').addClass('item-hidden');
}
}else{
// File is now visible (not hidden)
all_matching_items.removeClass('item-hidden item-revealed').addClass('item-visible');
}

// Update footer counts in all explorer windows
document.querySelectorAll('.window[data-app="explorer"]').forEach(el_window => {
window.update_explorer_footer_item_count(el_window);
});
}

// Update all exact-matching windows
$(`.window-${options.uid}`).each(function(){
window.update_window_path(this, options.path);
Expand Down
1 change: 1 addition & 0 deletions src/gui/src/i18n/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const en = {
get_a_copy_of_on_puter: `Get a copy of '%%' on Puter.com!`,
get_copy_link: 'Get Copy Link',
hide_all_windows: "Hide All Windows",
hidden: 'hidden',
home: 'Home',
html_document: 'HTML document',
hue: 'Hue',
Expand Down