Skip to content

Commit 7285a27

Browse files
committed
Fix toolbar autohide/hide timing
1 parent 2103374 commit 7285a27

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/gui/src/UI/UIDesktop.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,10 @@ async function UIDesktop(options) {
7070

7171
// Load the toolbar auto-hide preference
7272
let toolbar_auto_hide_enabled_val = await puter.kv.get('toolbar_auto_hide_enabled');
73-
console.log('toolbar_auto_hide_enabled_val', toolbar_auto_hide_enabled_val);
7473
if(toolbar_auto_hide_enabled_val === 'false' || toolbar_auto_hide_enabled_val === false){
7574
window.toolbar_auto_hide_enabled = false;
7675
}
7776

78-
// If auto-hide is disabled, ensure toolbar is visible on load
79-
if (!window.toolbar_auto_hide_enabled) {
80-
// Make sure toolbar is visible when auto-hide is disabled
81-
setTimeout(() => {
82-
if ($('.toolbar').hasClass('toolbar-hidden')) {
83-
window.show_toolbar();
84-
}
85-
}, 100); // Small delay to ensure DOM is ready
86-
}
87-
8877
// Modify the hide/show functions to use CSS rules that will apply to all icons, including future ones
8978
window.hideDesktopIcons = function () {
9079
// Add a CSS class to the desktop container that will hide all child icons
@@ -1155,7 +1144,6 @@ async function UIDesktop(options) {
11551144
// logo
11561145
ht += `<div class="toolbar-btn toolbar-puter-logo" title="Puter" style="margin-left: 10px;"><img src="${window.icons['logo-white.svg']}" draggable="false" style="display:block; width:17px; height:17px"></div>`;
11571146

1158-
11591147
// clock spacer
11601148
ht += `<div class="toolbar-spacer"></div>`;
11611149

@@ -1188,7 +1176,6 @@ async function UIDesktop(options) {
11881176
// search button
11891177
ht += `<div class="toolbar-btn search-btn" title="${i18n('toolbar.search')}" style="background-image:url('${window.icons['search.svg']}')"></div>`;
11901178

1191-
11921179
//clock
11931180
ht += `<div id="clock" class="toolbar-clock" style="">12:00 AM Sun, Jan 01</div>`;
11941181

@@ -1201,6 +1188,15 @@ async function UIDesktop(options) {
12011188
// prepend toolbar to desktop
12021189
$(ht).insertBefore(el_desktop);
12031190

1191+
// If auto-hide is disabled, ensure toolbar is visible on load
1192+
if (!window.toolbar_auto_hide_enabled) {
1193+
// Make sure toolbar is visible when auto-hide is disabled
1194+
setTimeout(() => {
1195+
if ($('.toolbar').hasClass('toolbar-hidden')) {
1196+
window.show_toolbar();
1197+
}
1198+
}, 100); // Small delay to ensure DOM is ready
1199+
}
12041200

12051201
// send event
12061202
window.dispatchEvent(new CustomEvent('toolbar:ready'));

0 commit comments

Comments
 (0)