Skip to content

Commit 03f05f3

Browse files
feat: add option to change desktop background to default
users can now select 'default' as their desktop background
1 parent fa60f66 commit 03f05f3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/UI/UIWindowDesktopBGSettings.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async function UIWindowDesktopBGSettings(options){
3434
// type
3535
h += `<label>${i18n('background')}:</label>`;
3636
h += `<select class="desktop-bg-type" style="width: 150px; margin-bottom: 20px;">`
37+
h += `<option value="default">${i18n('default')}</option>`;
3738
h += `<option value="picture">${i18n('picture')}</option>`;
3839
h += `<option value="color">${i18n('color')}</option>`;
3940
h += `</select>`;
@@ -109,18 +110,20 @@ async function UIWindowDesktopBGSettings(options){
109110
...options.window_options,
110111
})
111112

112-
if(window.desktop_bg_url !== undefined && window.desktop_bg_url !== null){
113-
$(el_window).find('.desktop-bg-settings-wrapper').hide();
113+
const default_wallpaper = (window.gui_env === 'prod') ? '/dist/images/wallpaper.webp' : '/images/wallpaper.webp';
114+
$(el_window).find('.desktop-bg-settings-wrapper').hide();
115+
116+
if(window.desktop_bg_url === default_wallpaper) {
117+
$(el_window).find('.desktop-bg-type').val('default');
118+
}else if(window.desktop_bg_url !== undefined && window.desktop_bg_url !== null){
114119
$(el_window).find('.desktop-bg-settings-picture').show();
115120
$(el_window).find('.desktop-bg-type').val('picture');
116121
}else if(window.desktop_bg_color !== undefined && window.desktop_bg_color !== null){
117-
$(el_window).find('.desktop-bg-settings-wrapper').hide();
118122
$(el_window).find('.desktop-bg-settings-color').show();
119123
$(el_window).find('.desktop-bg-type').val('color');
120124
}else{
121-
$(el_window).find('.desktop-bg-settings-wrapper').hide();
122-
$(el_window).find('.desktop-bg-settings-picture').show();
123-
$(el_window).find('.desktop-bg-type').val('picture');
125+
// Default fallback if no specific wallpaper settings are detected
126+
$(el_window).find('.desktop-bg-type').val('default');
124127
}
125128

126129
$(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){
146149

147150
$(el_window).find('.desktop-bg-type').on('change', function(e){
148151
const type = $(this).val();
152+
$(el_window).find('.desktop-bg-settings-wrapper').hide();
149153
if(type === 'picture'){
150-
$(el_window).find('.desktop-bg-settings-wrapper').hide();
151154
$(el_window).find('.desktop-bg-settings-picture').show();
152155
}else if(type==='color'){
153-
$(el_window).find('.desktop-bg-settings-wrapper').hide();
154156
$(el_window).find('.desktop-bg-settings-color').show();
157+
}else if(type==='default') {
158+
bg_color = undefined;
159+
bg_fit = 'cover';
160+
window.set_desktop_background({url: default_wallpaper, fit: bg_fit});
155161
}
156162
})
157163

src/i18n/translations/en.js

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const en = {
7272
clock_visible_show: 'Show - Always visible',
7373
clock_visible_auto: 'Auto - Default, visible only in full-screen mode.',
7474
date_modified: 'Date modified',
75+
default: 'Default',
7576
delete: 'Delete',
7677
delete_account: "Delete Account",
7778
delete_permanently: "Delete Permanently",

0 commit comments

Comments
 (0)