Skip to content

Instantly share code, notes, and snippets.

@ak1ra-komj
Last active August 11, 2023 07:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ak1ra-komj/bf6141cab118c4f1bc038de177829730 to your computer and use it in GitHub Desktop.
Save ak1ra-komj/bf6141cab118c4f1bc038de177829730 to your computer and use it in GitHub Desktop.
vscode-settings-with-background
{
"background.customImages": [
"https://i.loli.net/2020/06/11/sHdtowgryvk8Qeq.png",
"https://i.loli.net/2020/06/11/yfTGIBVMWXxR5cE.png",
"https://i.loli.net/2020/06/11/eSnE3mQYukBKsPt.png",
"https://i.loli.net/2020/06/11/29x4PdKmi7ApehI.png",
"https://i.loli.net/2020/06/11/YqjZbIB5hv4PKS3.png",
"https://i.loli.net/2020/06/11/Ru84bz5NnADWZLw.png",
"https://i.loli.net/2020/06/11/lswOX1IemtUrL6c.png",
"https://i.loli.net/2020/06/11/HrAeG5PqyfvnhwL.png",
"https://i.loli.net/2020/06/11/HXu84lK3G5cVt7Z.png",
"https://i.loli.net/2020/06/11/VM98apYU3CJ1riu.png",
"https://i.loli.net/2020/06/11/HLN9tgVmQZyPxJk.png",
"https://i.loli.net/2020/06/11/lfPN7s5bOe9H2oU.png",
"https://i.loli.net/2020/06/11/MwohFcXB9aQgESs.png",
"https://i.loli.net/2020/06/11/r5x8PHLBfFeqXDJ.png",
"https://i.loli.net/2020/06/11/2KghQd3wifxXFyB.png",
"https://i.loli.net/2020/06/11/6rtoC9WxManuz1Y.png",
"https://i.loli.net/2020/06/11/DelTO3Bh96MugwR.png",
"https://i.loli.net/2020/06/11/gS3UJbFBEYohPCd.png",
"https://i.loli.net/2020/06/11/6XR5pvY4j3ESIxC.png",
"https://i.loli.net/2020/06/11/uWAMRhXHJ2yFc4x.png",
"https://i.loli.net/2020/06/11/DaMoSn4jVcYhdA6.png",
"https://i.loli.net/2020/06/11/372LFDwWrClEaUZ.png",
"https://i.loli.net/2020/06/11/JBolbK3nr6k5ivR.png",
"https://i.loli.net/2020/06/11/VX6OKGhAsPo8Wr9.png",
"https://i.loli.net/2020/06/11/qgU6ESkvrcjVFaz.png",
"https://i.loli.net/2020/06/11/tZglY56jTUhQ1Lr.png",
"https://i.loli.net/2020/06/11/CMAPSOExi9Xq4nR.png",
"https://i.loli.net/2020/06/11/a9PCXjiQ4rF8my7.png",
"https://i.loli.net/2020/06/11/gG1wo8xMrksdveN.png",
"https://i.loli.net/2020/06/11/xkhriaTMoBm2HV6.png",
"https://i.loli.net/2020/06/11/lWJQ7GnZYI54afD.png",
"https://i.loli.net/2020/06/11/5eGQK37FptqSWPf.png",
"https://i.loli.net/2020/06/11/9TyRMZQAX62Vuhn.png",
"https://i.loli.net/2020/06/11/A92HYaCNGwlsyoF.png",
"https://i.loli.net/2020/06/11/Bs5zx36lkhTOtSU.png",
"https://i.loli.net/2020/06/11/18Xwdcv7mIG2pzP.png",
"https://i.loli.net/2020/06/11/mB4hCVAiUsyJSpz.png",
"https://i.loli.net/2020/06/11/FenUhwf74OrvN5d.png",
"https://i.loli.net/2020/06/11/B9NJpMauIheR3Pt.png",
"https://i.loli.net/2020/06/11/gjEBrDGfYaHoN3A.png",
"https://i.loli.net/2020/06/11/O6Jl1hSPBsWetDv.png",
"https://i.loli.net/2020/06/11/xUSNiBoGVWDaJjq.png"
],
"background.style": {
"content": "''",
"pointer-events": "none",
"position": "absolute",
"right": "0",
"bottom": "0",
"width": "60%",
"height": "60%",
"z-index": "9999",
"background-size": "contain",
"opacity": 0.3
},
"background.useDefault": false,
"background.loop": true
}
# coding: utf-8
# 既然 VS Code Background 没有提供 shuffle 功能, 只好咱自己来了.
import os
import json
import pathlib
import random
p = pathlib.Path(os.environ["appdata"]).joinpath("Code/User/settings.json")
with open(p, "r+") as f:
settings = json.loads(f.read())
random.shuffle(settings.get("background.customImages"))
f.seek(0)
f.write(json.dumps(settings, indent=4, ensure_ascii=False))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment