Skip to content

Commit

Permalink
Merge pull request #122 from AShujiao/dev_2.5.0
Browse files Browse the repository at this point in the history
Dev 2.5.0
  • Loading branch information
AShujiao authored May 27, 2024
2 parents 3aa6dc5 + 87b30ff commit c0edbff
Show file tree
Hide file tree
Showing 18 changed files with 383 additions and 82 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,12 @@

#### ver 2.4.0 (2024/05/15)

1.支持设置图片填充方式及图片位置
1.支持设置图片填充方式及图片位置

#### ver 2.5.0 (2024/05/26)

1.支持在线图片快速设置背景!!!
2.在线社区集成进vscode左侧栏,发布图片、设置默认页
3.社区支持注册(需邮箱激活)
4.社区支持回复主题,上传图片、添加第三方图片(用于设置背景图)
5.社区支持发布个人主题(私人图库)(需要作者审核)
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<br>
VS Code - Background Cover
<br>

<br>
</h1>

Expand All @@ -21,7 +22,7 @@ Add a picture you like to cover the entire vscode..
</p>

---

[集成在线图库](https://vs.20988.xyz/d/24-vscodebei-jing-tu-tu-ku)

> **使用此扩展请以管理员身份运行vscode**
Expand All @@ -34,11 +35,12 @@ Add a picture you like to cover the entire vscode..


## It looks like:

![](https://user-images.githubusercontent.com/14969576/59507703-68952700-8ede-11e9-9633-5b9351c5bbb8.gif)
![](https://user-images.githubusercontent.com/14969576/59507145-b90b8500-8edc-11e9-9bf4-a7b9d1d8ae00.png)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/df3089cd-d370-4b41-ac0b-777038dd6323)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/5533db3e-9a2b-46e5-a41d-df103141d0cd)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/20172d72-5384-4bfe-bceb-ec582cfb1698)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/dcbb7870-8342-4069-9dd8-026d3b903420)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/26066847-050b-4e72-8b2d-f44ffcb063f8)
![](https://github.com/AShujiao/vscode-maxPlus/assets/14969576/57e5e908-4464-409a-8b67-c8a6edf5b431)
## Warns 警告:

> **本插件是通过修改 vscode 的 css 文件的方式运行**
Expand Down Expand Up @@ -110,18 +112,20 @@ Add a picture you like to cover the entire vscode..
## 最近更新日志
[完整日志](https://github.com/vscode-extension/vscode-background-cover/blob/master/CHANGELOG.md)

#### ver 2.4.0 (2024/05/15)
#### ver 2.5.0 (2024/05/26)

1.支持设置图片填充方式及图片位置
1.支持在线图片快速设置背景!!!
2.在线社区集成进vscode左侧栏,发布图片、设置默认页
3.社区支持注册(需邮箱激活)
4.社区支持回复主题,上传图片、添加第三方图片(用于设置背景图)
5.社区支持发布个人主题(私人图库)(需要作者审核)

---
### Thanks 感谢

* [vscode-background](https://github.com/shalldie/vscode-background)
* [feature_restart_random_image](https://github.com/AShujiao/vscode-background-cover/pull/2)

底层部分代码来自 [shalldie](https://github.com/shalldie)[vscode-background](https://marketplace.visualstudio.com/items?itemName=shalldie.background)

## Contributors
* 对于扩展的贡献者默认都会展示在此列表中,如果不愿意展示此处也可以进行提交pr移除
[<img alt="AShujiao" src="https://avatars2.githubusercontent.com/u/14969576?s=460&v=4" width="117">](https://github.com/AShujiao)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

55 changes: 54 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "background-cover",
"displayName": "background-cover",
"description": "Add a picture you like to cover the entire vscode..",
"version": "2.4.0",
"version": "2.5.0",
"publisher": "manasxx",
"engines": {
"vscode": "^1.38.0"
Expand Down Expand Up @@ -37,6 +37,22 @@
{
"command": "extension.backgroundCover.refresh",
"title": "backgroundCover - refresh"
},
{
"command": "backgroundCover.refreshEntry",
"title": "刷新",
"icon": {
"light": "resources/light/refresh.svg",
"dark": "resources/dark/refresh.svg"
}
},
{
"command": "backgroundCover.home",
"title": "首页",
"icon": {
"light": "resources/light/home.svg",
"dark": "resources/dark/home.svg"
}
}
],
"keybindings": [
Expand Down Expand Up @@ -74,8 +90,45 @@
"type": "string",
"default": "cover",
"description": "Background image size adaptive mode / 图片尺寸适应模式"
},
"backgroundCover.defaultOnlinePage": {
"type": "string",
"default": "https://vs.20988.xyz/d/24-vscodebei-jing-tu-tu-ku",
"description": "Online images default page / 在线图库默认页面"
}
}
},
"viewsContainers": {
"activitybar": [
{
"id": "backgroundCover-explorer",
"title": "backgroundCover",
"icon": "resources/big.svg"
}
]
},
"views": {
"backgroundCover-explorer": [
{
"id": "backgroundCover.readerView",
"type": "webview",
"name": "backgroundCover"
}
]
},
"menus": {
"view/title": [
{
"command": "backgroundCover.refreshEntry",
"when": "view == backgroundCover.readerView",
"group": "navigation@1"
},
{
"command": "backgroundCover.home",
"when": "view == backgroundCover.readerView",
"group": "navigation@0"
}
]
}
},
"bugs": {
Expand Down
1 change: 1 addition & 0 deletions resources/backgroundCover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/big.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/dark/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/dark/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/light/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/light/refresh.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 18 additions & 7 deletions src/FileDom.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import * as path from 'path';
import * as fs from 'fs';
import version from './version';
import * as vscode from 'vscode';
import {
Uri,
window,
InputBoxOptions,
commands,
} from 'vscode';
import { exec } from 'child_process';
import vsHelp from './vsHelp';

const cssName: string = vscode.version >= "1.38" ? 'workbench.desktop.main.css' : 'workbench.main.css';
const cssName: string = version >= "1.38" ? 'workbench.desktop.main.css' : 'workbench.main.css';
export class FileDom {

// 文件路径
Expand Down Expand Up @@ -138,6 +143,12 @@ export class FileDom {
return true;
}


public localImgToVsc() {
var url = "vscode-file://vscode-app/" + this.imagePath
this.imagePath = Uri.parse(url).toString();
}

/**
* 设置文件内容
*
Expand Down Expand Up @@ -194,15 +205,15 @@ export class FileDom {
if (error) {
// console.log('EACCES: permission denied', error?.message);
// 对文件没有读写权限则提示输入管理员密码以继续写入样式
let option: vscode.InputBoxOptions = {
let option: InputBoxOptions = {
ignoreFocusOut: true,
password: false,
placeHolder: 'Please enter the root password for access / 请输入 ROOT 密码用于获取权限',
prompt: '请输入管理员密码',
}
vscode.window.showInputBox(option).then((value) => {
window.showInputBox(option).then((value) => {
if (!value) {
vscode.window.showWarningMessage(
window.showWarningMessage(
'Please enter password / 请输入密码!'
);
return;
Expand All @@ -228,13 +239,13 @@ export class FileDom {
(error) => {
// console.log('Chmod error:', error?.message);
if (error) {
vscode.window.showWarningMessage(
window.showWarningMessage(
`${error.name}: 密码可能输入有误,请重新尝试!`
);
}
// 写入样式并自动重启程序
fs.writeFileSync(this.filePath, content, 'utf-8');
vscode.commands.executeCommand('workbench.action.reloadWindow');
commands.executeCommand('workbench.action.reloadWindow');
}
);
}
Expand Down
9 changes: 6 additions & 3 deletions src/ImgItem.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import * as vscode from 'vscode';
import {
QuickPickItem,
QuickPickItemKind,
} from 'vscode';
/**
* imgItem / 图片List类
*/
export class ImgItem implements vscode.QuickPickItem {
export class ImgItem implements QuickPickItem {

label: string;
description: string;
imageType: number;
path?: string | undefined;
kind?: vscode.QuickPickItemKind | undefined;
kind?: QuickPickItemKind | undefined;

constructor(label: string, description: string, type: number, path?: string | undefined) {
this.label = label;
Expand Down
Loading

0 comments on commit c0edbff

Please sign in to comment.