Merge pull request #329 from Eric-Lighthall/desktop-bg-revert

feat: add option to change desktop background to default
This commit is contained in:
Nariman Jelveh 2024-04-22 20:26:39 -07:00 committed by GitHub
commit 5066128c72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 8 deletions

View File

@ -34,6 +34,7 @@ async function UIWindowDesktopBGSettings(options){
// type
h += `<label>${i18n('background')}:</label>`;
h += `<select class="desktop-bg-type" style="width: 150px; margin-bottom: 20px;">`
h += `<option value="default">${i18n('default')}</option>`;
h += `<option value="picture">${i18n('picture')}</option>`;
h += `<option value="color">${i18n('color')}</option>`;
h += `</select>`;
@ -109,18 +110,20 @@ async function UIWindowDesktopBGSettings(options){
...options.window_options,
})
if(window.desktop_bg_url !== undefined && window.desktop_bg_url !== null){
$(el_window).find('.desktop-bg-settings-wrapper').hide();
const default_wallpaper = (window.gui_env === 'prod') ? '/dist/images/wallpaper.webp' : '/images/wallpaper.webp';
$(el_window).find('.desktop-bg-settings-wrapper').hide();
if(window.desktop_bg_url === default_wallpaper) {
$(el_window).find('.desktop-bg-type').val('default');
}else if(window.desktop_bg_url !== undefined && window.desktop_bg_url !== null){
$(el_window).find('.desktop-bg-settings-picture').show();
$(el_window).find('.desktop-bg-type').val('picture');
}else if(window.desktop_bg_color !== undefined && window.desktop_bg_color !== null){
$(el_window).find('.desktop-bg-settings-wrapper').hide();
$(el_window).find('.desktop-bg-settings-color').show();
$(el_window).find('.desktop-bg-type').val('color');
}else{
$(el_window).find('.desktop-bg-settings-wrapper').hide();
$(el_window).find('.desktop-bg-settings-picture').show();
$(el_window).find('.desktop-bg-type').val('picture');
// Default fallback if no specific wallpaper settings are detected
$(el_window).find('.desktop-bg-type').val('default');
}
$(el_window).find('.desktop-bg-color-block:not(.desktop-bg-color-block-palette').on('click', async function(e){
@ -146,12 +149,15 @@ async function UIWindowDesktopBGSettings(options){
$(el_window).find('.desktop-bg-type').on('change', function(e){
const type = $(this).val();
$(el_window).find('.desktop-bg-settings-wrapper').hide();
if(type === 'picture'){
$(el_window).find('.desktop-bg-settings-wrapper').hide();
$(el_window).find('.desktop-bg-settings-picture').show();
}else if(type==='color'){
$(el_window).find('.desktop-bg-settings-wrapper').hide();
$(el_window).find('.desktop-bg-settings-color').show();
}else if(type==='default') {
bg_color = undefined;
bg_fit = 'cover';
window.set_desktop_background({url: default_wallpaper, fit: bg_fit});
}
})

View File

@ -72,6 +72,7 @@ const en = {
clock_visible_show: 'Show - Always visible',
clock_visible_auto: 'Auto - Default, visible only in full-screen mode.',
date_modified: 'Date modified',
default: 'Default',
delete: 'Delete',
delete_account: "Delete Account",
delete_permanently: "Delete Permanently",