@@ -102,6 +109,19 @@ export default {
window.change_clock_visible();
+ // Initialize startup chime toggle
+ puter.kv.get('startup_chime_enabled').then(async (val) => {
+ // Default to enabled if not set
+ const enabled = val === 'false' ? false : true;
+ $el_window.find('.startup-chime-toggle').prop('checked', enabled);
+ });
+
+ // Handle startup chime toggle change
+ $el_window.find('.startup-chime-toggle').on('change', function(e) {
+ const enabled = $(this).is(':checked');
+ puter.kv.set('startup_chime_enabled', enabled.toString());
+ });
+
puter.kv.get('menubar_style').then(async (val) => {
if(val === 'system' || !val){
$el_window.find('#menubar_style_system').prop('checked', true);
diff --git a/src/gui/src/UI/UIWindowLogin.js b/src/gui/src/UI/UIWindowLogin.js
index 148eef471..c721946be 100644
--- a/src/gui/src/UI/UIWindowLogin.js
+++ b/src/gui/src/UI/UIWindowLogin.js
@@ -28,6 +28,7 @@ import JustHTML from './Components/JustHTML.js';
import StepView from './Components/StepView.js';
import Button from './Components/Button.js';
import RecoveryCodeEntryView from './Components/RecoveryCodeEntryView.js';
+import play_startup_chime from '../helpers/play_startup_chime.js';
async function UIWindowLogin(options){
options = options ?? {};
diff --git a/src/gui/src/helpers.js b/src/gui/src/helpers.js
index 86aab6f0c..0bb62e1d8 100644
--- a/src/gui/src/helpers.js
+++ b/src/gui/src/helpers.js
@@ -30,6 +30,7 @@ import UIWindowProgress from './UI/UIWindowProgress.js';
import globToRegExp from "./helpers/globToRegExp.js";
import get_html_element_from_options from "./helpers/get_html_element_from_options.js";
import item_icon from "./helpers/item_icon.js";
+import play_startup_chime from "./helpers/play_startup_chime.js";
window.is_auth = ()=>{
if(localStorage.getItem("auth_token") === null || window.auth_token === null)
@@ -436,6 +437,11 @@ window.update_auth_data = async (auth_token, user)=>{
window.auth_token = auth_token;
localStorage.setItem('auth_token', auth_token);
+ // Play startup chime if enabled
+ if (typeof play_startup_chime === 'function') {
+ play_startup_chime();
+ }
+
// Has username changed?
if(window.user?.username !== user.username)
update_username_in_gui(user.username);
diff --git a/src/gui/src/helpers/play_startup_chime.js b/src/gui/src/helpers/play_startup_chime.js
new file mode 100644
index 000000000..29edcc983
--- /dev/null
+++ b/src/gui/src/helpers/play_startup_chime.js
@@ -0,0 +1,41 @@
+/**
+ * Copyright (C) 2024-present Puter Technologies Inc.
+ *
+ * This file is part of Puter.
+ *
+ * Puter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * Plays the Puter startup chime sound if enabled in settings
+ * @returns {Promise} A promise that resolves when the sound has played or if playing is skipped
+ */
+export default async function play_startup_chime() {
+ try {
+ // Check if startup chime is enabled in settings
+ const startupChimeEnabled = await puter.kv.get('startup_chime_enabled');
+
+ // If explicitly disabled, don't play
+ if (startupChimeEnabled === 'false') {
+ return;
+ }
+
+ // Create audio element and play the chime
+ const audio = new Audio('/audio/puter_chime.mp3');
+ await audio.play();
+ } catch (error) {
+ // Silently fail if audio can't be played (common in browsers without user interaction)
+ console.log('Could not play startup chime:', error);
+ }
+}
\ No newline at end of file