diff --git a/src/UI/Settings/UIWindowSettings.js b/src/UI/Settings/UIWindowSettings.js index 5418e4d3..5587ea2b 100644 --- a/src/UI/Settings/UIWindowSettings.js +++ b/src/UI/Settings/UIWindowSettings.js @@ -133,9 +133,9 @@ async function UIWindowSettings(options){ h += `
` h += `${i18n('click_visable')}:` h += `` h += `
` h += ``; @@ -361,15 +361,11 @@ async function UIWindowSettings(options){ const $this = $(this); const value = $this.val(); - value === 'show' && $('#clock').show(); - value === 'hide' && $('#clock').hide(); - - // save clock_visable to user preferences - window.mutate_user_preferences({ - clock_visable: value - }); + changeClockVisable(value); }) + change_clock_visable(); + resolve(el_window); }); } diff --git a/src/UI/UIDesktop.js b/src/UI/UIDesktop.js index e3c07f44..1b3724b3 100644 --- a/src/UI/UIDesktop.js +++ b/src/UI/UIDesktop.js @@ -1029,7 +1029,6 @@ async function UIDesktop(options){ } }) } - } $(document).on('contextmenu taphold', '.taskbar', function(event){ diff --git a/src/UI/UITaskbar.js b/src/UI/UITaskbar.js index b76cb899..5d00082c 100644 --- a/src/UI/UITaskbar.js +++ b/src/UI/UITaskbar.js @@ -45,6 +45,9 @@ async function UITaskbar(options){ $('.desktop').append(h); + // init clock visibility + window.change_clock_visable(); + //--------------------------------------------- // add `Start` to taskbar //--------------------------------------------- diff --git a/src/helpers.js b/src/helpers.js index cf352459..21676a71 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -3676,4 +3676,23 @@ window.save_desktop_item_positions = ()=>{ window.delete_desktop_item_positions = ()=>{ desktop_item_positions = {} puter.kv.del('desktop_item_positions'); +} + +window.change_clock_visable = (clock_visable) => { + let newValue = clock_visable || window.user_preferences.clock_visable; + + newValue === 'show' && $('#clock').show(); + newValue === 'hide' && $('#clock').hide(); + + + if(clock_visable) { + // save clock_visable to user preferences + window.mutate_user_preferences({ + clock_visable: newValue + }); + + return; + } + + $('select.change-clock-visable').val(window.user_preferences.clock_visable); } \ No newline at end of file