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
46 changes: 45 additions & 1 deletion src/gui/src/UI/Settings/UITabPersonalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ export default {
<option value="show">${i18n('clock_visible_show')}</option>
</select>
</div>
<div class="settings-card">
<strong style="flex-grow:1;">Auto-Hide Toolbar</strong>
<label class="switch">
<input type="checkbox" class="toggle-toolbar-autohide">
<span class="slider round"></span>
</label>
</div>

<div class="settings-card" style="display: block; height: auto;">
<strong style="margin: 15px 0 30px; display: block;">${i18n('menubar_style')}</strong>
<div style="flex-grow:1; margin-top: 10px;">
Expand Down Expand Up @@ -102,6 +110,42 @@ export default {

window.change_clock_visible();

// ============================================
// Toolbar Auto-Hide Toggle Handler
// ============================================

// Load the current state from KV store and set checkbox
puter.kv.get('user_preferences.toolbar_autohide').then(async (val) => {
const isEnabled = val === true || val === 'true';
Copy link

@israx israx Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would be the case when val is a string?

$el_window.find('.toggle-toolbar-autohide').prop('checked', isEnabled);

// Also sync with the toolbar_autohide state
if (window.toolbar_autohide && isEnabled !== window.toolbar_autohide.isEnabled) {
if (isEnabled) {
window.toolbar_autohide.enable();
} else {
window.toolbar_autohide.disable();
}
}
});

// Handle checkbox changes
$el_window.find('.toggle-toolbar-autohide').on('change', function(e) {
const isEnabled = $(this).is(':checked');
if (window.toolbar_autohide) {
if (isEnabled) {
window.toolbar_autohide.enable();
} else {
window.toolbar_autohide.disable();
}
// Save preference
window.mutate_user_preferences({
toolbar_autohide: isEnabled
});
}
});
// ============================================

puter.kv.get('menubar_style').then(async (val) => {
if(val === 'system' || !val){
$el_window.find('#menubar_style_system').prop('checked', true);
Expand Down Expand Up @@ -152,4 +196,4 @@ export default {
}
})
},
};
};
6 changes: 5 additions & 1 deletion src/gui/src/UI/UIDesktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import UIWindowWelcome from "./UIWindowWelcome.js"
import launch_app from "../helpers/launch_app.js"
import item_icon from "../helpers/item_icon.js"
import UIWindowSearch from "./UIWindowSearch.js"
import toolbar_autohide from "../helpers/toolbar_autohide.js"

async function UIDesktop(options){
let h = '';
Expand Down Expand Up @@ -1105,7 +1106,7 @@ async function UIDesktop(options){
let ht = '';
ht += `<div class="toolbar" style="height:${window.toolbar_height}px; min-height:${window.toolbar_height}px; max-height:${window.toolbar_height}px;">`;
// logo
ht += `<div class="toolbar-btn toolbar-puter-logo" title="Puter" style="margin-left: 10px; margin-right: auto;"><img src="${window.icons['logo-white.svg']}" draggable="false" style="display:block; width:17px; height:17px"></div>`;
ht += `<div class="toolbar-btn toolbar-puter-logo" title="Puter"><img src="${window.icons['logo-white.svg']}" draggable="false" style="display:block; width:17px; height:17px"></div>`;

// create account button
ht += `<div class="toolbar-btn user-options-create-account-btn ${window.user.is_temp ? '' : 'hidden' }" style="padding:0; opacity:1;" title="Save Account">`;
Expand Down Expand Up @@ -1145,6 +1146,9 @@ async function UIDesktop(options){
// prepend toolbar to desktop
$(ht).insertBefore(el_desktop);

// initialize toolbar auto-hide functionality
toolbar_autohide.init();

// notification container
$('body').append(`<div class="notification-container"><div class="notifications-close-all">${i18n('close_all')}</div></div>`);

Expand Down
98 changes: 91 additions & 7 deletions src/gui/src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1736,19 +1736,46 @@ label {
}

.toolbar {
float: right;
width: 100%;
background-color: #00000040;
position: fixed;
top: 10px;
left: 50%;
transform: translateX(-50%);
width: auto;
height: 30px;
position: relative;
background-color: #00000040;
z-index: 999999;
box-sizing: border-box;
display: flex;
flex-direction: row;
justify-content: flex-end;
justify-content: center;
align-content: center;
flex-wrap: wrap;
padding-right: 10px
align-items: center;
flex-wrap: nowrap;
padding: 0 15px;
gap: 5px;
border-radius: 20px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* Toolbar hidden state */
.toolbar.toolbar-hidden {
transform: translateX(-50%) translateY(-100%);
opacity: 0;
pointer-events: none;
}

/* Toolbar visible state (explicit for clarity) */
.toolbar.toolbar-visible {
transform: translateX(-50%) translateY(0);
opacity: 1;
pointer-events: all;
}

/* Toolbar peek state (when mouse is near top) */
.toolbar.toolbar-peek {
transform: translateX(-50%) translateY(0);
opacity: 0.6;
}

.show-desktop-btn {
Expand Down Expand Up @@ -4144,6 +4171,63 @@ fieldset[name=number-code] {
color: #c98900;
}

/* Toggle Switch */
.switch {
position: relative;
display: inline-block;
width: 44px;
height: 24px;
flex-shrink: 0;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.3s;
}

.slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: 0.3s;
}

input:checked + .slider {
background-color: #2196F3;
}

input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
transform: translateX(20px);
}

.slider.round {
border-radius: 24px;
}

.slider.round:before {
border-radius: 50%;
}

.error-message {
display: none;
color: rgb(215 2 2);
Expand Down
1 change: 1 addition & 0 deletions src/gui/src/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ if (window.user_preferences === null) {
show_hidden_files: false,
language: navigator.language.split("-")[0] || navigator.userLanguage || 'en',
clock_visible: 'auto',
toolbar_autohide: false, // Add this new preference
}
}

Expand Down
Loading