From 03f05f316f11e8afe5fcee40b2b80a0de5e6826f Mon Sep 17 00:00:00 2001
From: Eric Lighthall <55029902+Eric-Lighthall@users.noreply.github.com>
Date: Mon, 22 Apr 2024 18:26:15 -0700
Subject: [PATCH] feat: add option to change desktop background to default
users can now select 'default' as their desktop background
---
src/UI/UIWindowDesktopBGSettings.js | 22 ++++++++++++++--------
src/i18n/translations/en.js | 1 +
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/UI/UIWindowDesktopBGSettings.js b/src/UI/UIWindowDesktopBGSettings.js
index e8a18b4cb..49bace6f3 100644
--- a/src/UI/UIWindowDesktopBGSettings.js
+++ b/src/UI/UIWindowDesktopBGSettings.js
@@ -34,6 +34,7 @@ async function UIWindowDesktopBGSettings(options){
// type
h += ``;
h += ``;
@@ -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});
}
})
diff --git a/src/i18n/translations/en.js b/src/i18n/translations/en.js
index 44b829592..eab5afac7 100644
--- a/src/i18n/translations/en.js
+++ b/src/i18n/translations/en.js
@@ -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",