Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix VSCode 1.72 #45

Merged
merged 4 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<br>

The only background extension that supports [glob](https://github.com/isaacs/node-glob#glob-primer). Add multiple background images for the window, editors, sidebars, or the panel. No warnings about modified distributions.
The only background extension that supports [glob](https://github.com/isaacs/node-glob#glob-primer). Add multiple background images for the window, editors, sidebars, or the panel.

<div align="center">
<img alt="editor background" src="https://raw.githubusercontent.com/KatsuteDev/Background/main/assets/editor.gif">
Expand Down
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 44 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"version": "2.0.0",
"private": true,
"engines": {
"vscode": "^1.71.0"
"vscode": "^1.72.0"
},
"categories": [
"Other"
Expand Down Expand Up @@ -104,12 +104,16 @@
"type": "string"
}
},

"background.backgroundAlignment": {
"markdownDescription": "The background image alignment.",
"type": "array",
"order": 4,
"default": ["Center Center", "Center Center", "Center Center", "Center Center"],
"default": [
"Center Center",
"Center Center",
"Center Center",
"Center Center"
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -132,7 +136,12 @@
"markdownDescription": "If `#background.backgroundAlignment#` is set to `Manual`, this is the literal value for the `background-position` css property.",
"type": "array",
"order": 5,
"default": ["50%", "50%", "50%", "50%"],
"default": [
"50%",
"50%",
"50%",
"50%"
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -144,7 +153,12 @@
"markdownDescription": "The background image blur amount in css units.",
"type": "array",
"order": 6,
"default": ["0", "0", "0", "0"],
"default": [
"0",
"0",
"0",
"0"
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -156,7 +170,12 @@
"markdownDescription": "The UI opacity, make sure this number is not to low, otherwise you may not be able to see the UI and revert this change. 0 is fully visible and 1 is invisible.",
"type": "array",
"order": 7,
"default": [0.9, 0.9, 0.9, 0.9],
"default": [
0.9,
0.9,
0.9,
0.9
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -169,7 +188,12 @@
"markdownDescription": "The background image repeat.",
"type": "array",
"order": 8,
"default": ["No Repeat", "No Repeat", "No Repeat", "No Repeat"],
"default": [
"No Repeat",
"No Repeat",
"No Repeat",
"No Repeat"
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -196,7 +220,12 @@
"markdownDescription": "The background image size.",
"type": "array",
"order": 9,
"default": ["Cover", "Cover", "Cover", "Cover"],
"default": [
"Cover",
"Cover",
"Cover",
"Cover"
],
"minItems": 4,
"maxItems": 4,
"items": {
Expand All @@ -219,22 +248,25 @@
"markdownDescription": "If `#background.windowBackgroundSize#` is set to `Manual`, this is the literal value for the `background-size` css property.",
"type": "array",
"order": 10,
"default": ["100%", "100%", "100%", "100%"],
"default": [
"100%",
"100%",
"100%",
"100%"
],
"minItems": 4,
"maxItems": 4,
"items": {
"type": "string",
"pattern": "^[\\w.% +-]*$"
}
},

"background.useWindowOptionsForAllBackgrounds": {
"markdownDescription": "If enabled, all backgrounds will use the options set for the windows background.",
"order": 11,
"type": "boolean",
"default": false
},

"background.CSS": {
"markdownDescription": "**Advanced Users Only.** Apply raw CSS to VSCode.",
"order": 12,
Expand Down Expand Up @@ -279,7 +311,7 @@
"devDependencies": {
"@types/glob": "8.0.0",
"@types/node": "18.8.1",
"@types/vscode": "1.71.0",
"@types/vscode": "1.72.0",
"rimraf": "3.0.2",
"typescript": "4.8.4",
"vsce": "2.11.0"
Expand Down
5 changes: 2 additions & 3 deletions src/command/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ export const command: vscode.Disposable = vscode.commands.registerCommand("backg
});

export const notify: () => void = () => {
vscode.window.showWarningMessage("Background has been modified, a reinstall is required to see changes.", "Install and Restart", "Ignore").then((value?: string) => {
if(value === "Install and Restart")
vscode.commands.executeCommand("background.install");
vscode.window.showWarningMessage("Background has been modified, a reinstall is required to see changes.", "Install and Reload", "Ignore").then((value?: string) => {
value === "Install and Reload" && vscode.commands.executeCommand("background.install");
});
}
17 changes: 9 additions & 8 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,21 @@ export const activate: (context: vscode.ExtensionContext) => void = (context: vs

if(require.main && require.main.filename){

// %appdata%/Local/Programs/Microsoft VS Code/resources/app/out/bootstrap-window.js
// %appdata%/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js

const file: string = path.join(path.dirname(require.main.filename), "bootstrap-window.js");
const base: string = path.join(path.dirname(require.main.filename), "vs", "workbench");

const file: string = path.join(base, "workbench.desktop.main.js");
const name: string = path.basename(file);
if(fs.existsSync(file)){
js = file;
const backup: string = path.join(path.dirname(require.main.filename), "bootstrap-window-backup.js");
const backup: string = path.join(base, `${path.parse(name).name}-backup.js`);
if(!fs.existsSync(backup)){
fs.copyFileSync(file, backup);
vscode.window.showInformationMessage(`A backup was created for 'bootstrap-window.js'`);
vscode.window.showInformationMessage(`A backup was created for '${name}'`);
}
}else
vscode.window.showErrorMessage(`Failed to find 'bootstrap-window.js'`);
vscode.window.showErrorMessage(`Failed to find '${name}'`);
}else
vscode.window.showErrorMessage("Failed to find main file");

Expand Down Expand Up @@ -96,9 +99,7 @@ export const uninstallJS: () => void = () => {
}

export const restartVS: () => void = () => {
vscode.commands.executeCommand("workbench.action.newWindow").then(() => {
vscode.commands.executeCommand("workbench.action.closeWindow");
});
vscode.commands.executeCommand("workbench.action.reloadWindow");
}

//
Expand Down