Skip to content

Commit

Permalink
Remove useWindowOptionsForAllBackgrounds option (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Aug 4, 2024
1 parent f080e94 commit a6ea477
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
6 changes: 0 additions & 6 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ This extension also modifies `%LocalAppData%\Programs\Microsoft VS Code\resource

Backgrounds are not removed on extension disable or uninstall, you must run the **Background: Uninstall** command to remove backgrounds.

### Options not working for editor/sidebar/panel

*`background.useWindowOptionsForAllBackgrounds` is deprecated, do not use it.*

Options will not change if `background.useWindowOptionsForAllBackgrounds` is set to `true`, either change the options for window or set `background.useWindowOptionsForAllBackgrounds` to `false`.

### Background doesn't work on window buttons (minimize/maximize/close) [#178](https://github.com/KatsuteDev/Background/issues/178)

These buttons are controlled by the system and not VSCode; and can not be modified by this extension.
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,6 @@
"type": "boolean",
"default": false
},
"background.useWindowOptionsForAllBackgrounds": {
"markdownDescription": "**Deprecated:** This setting is being removed to reduce confusion for new users, please set options separately.\n\n~~If enabled, all background images will use the options set for the windows background.~~\n\n~~This does not include the backgrounds, you still need to add background images separately.~~",
"order": 13,
"type": "boolean",
"default": false
},
"background.renderContentAboveBackground": {
"markdownDescription": "Render content like images, PDFs, and markdown previews above the background.",
"order": 14,
Expand Down
10 changes: 5 additions & 5 deletions src/extension/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ export const notify: () => void = () =>

// get

export const get: (key: ConfigurationKey, ui?: UI, fallbackToWindowOption?: boolean) => any = (key: ConfigurationKey, ui?: UI, fallbackToWindowOption: boolean = false) =>
export const get: (key: ConfigurationKey, ui?: UI) => any = (key: ConfigurationKey, ui?: UI) =>
!ui
? configuration().get(key)
?? getConfigurationProperty(key).default
?? "null"
: (configuration().get(key) as any[])[fallbackToWindowOption && get("useWindowOptionsForAllBackgrounds") === true ? 0 : Index(ui)]
: (configuration().get(key) as any[])[Index(ui)]
?? getConfigurationProperty(key).default[0]
?? "null";

export const getCSS: (key: ConfigurationKey, ui: UI) => string = (key: ConfigurationKey, ui: UI) => {
const value: string = get(key, ui, true);
const value: string = get(key, ui);
const prop: Properties = getConfigurationProperty(key);

switch(key){
Expand All @@ -75,7 +75,7 @@ export const getCSS: (key: ConfigurationKey, ui: UI) => string = (key: Configura
case prop.items!.enum![6]: return "left bottom";
case prop.items!.enum![7]: return "center bottom";
case prop.items!.enum![8]: return "right bottom";
case prop.items!.enum![9]: return sanitizeUnits(get("backgroundAlignmentValue", ui, true));
case prop.items!.enum![9]: return sanitizeUnits(get("backgroundAlignmentValue", ui));
}
}
case "backgroundBlur": {
Expand All @@ -99,7 +99,7 @@ export const getCSS: (key: ConfigurationKey, ui: UI) => string = (key: Configura
case prop.items!.enum![0]: return "auto";
case prop.items!.enum![1]: return "contain";
case prop.items!.enum![2]: return "cover";
case prop.items!.enum![3]: return sanitizeUnits(get("backgroundSizeValue", ui, true));
case prop.items!.enum![3]: return sanitizeUnits(get("backgroundSizeValue", ui));
}
}
default: {
Expand Down
8 changes: 4 additions & 4 deletions src/extension/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ const iEditorBackgrounds = [...Array(${images.editor.length}).keys()];
const iSidebarBackgrounds = [...Array(${images.sidebar.length}).keys()];
const iPanelBackgrounds = [...Array(${images.panel.length}).keys()];
const windowTime = ${get("backgroundChangeTime", "window", true) == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "window", true), 2), 5)};
const editorTime = ${get("backgroundChangeTime", "editor", true) == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "editor", true), 2), 5)};
const sidebarTime = ${get("backgroundChangeTime", "sidebar", true) == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "sidebar", true), 2), 5)};
const panelTime = ${get("backgroundChangeTime", "panel", true) == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "panel", true), 2), 5)};
const windowTime = ${get("backgroundChangeTime", "window") == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "window"), 2), 5)};
const editorTime = ${get("backgroundChangeTime", "editor") == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "editor"), 2), 5)};
const sidebarTime = ${get("backgroundChangeTime", "sidebar") == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "sidebar"), 2), 5)};
const panelTime = ${get("backgroundChangeTime", "panel") == 0 ? 0 : Math.max(round(get("backgroundChangeTime", "panel"), 2), 5)};
`
+ // individual background css - window
`
Expand Down
1 change: 0 additions & 1 deletion src/extension/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export type ConfigurationKey =
"backgroundSizeValue" |
"backgroundChangeTime" |
"autoInstall" |
"useWindowOptionsForAllBackgrounds" |
"renderContentAboveBackground" |
"smoothImageRendering" |
"CSS";
Expand Down

0 comments on commit a6ea477

Please sign in to comment.