前言
Keep an eye on what is happening on your machine and in the World.(官网)
原理
- Übersicht是一个可以在桌面渲染自定义jsx的软件,可以通过自定义jsx代码,实现个性化的桌面
安装Übersicht
1
| brew install --cask ubersicht
|
视频壁纸代码
为了省事,我直接在默认模版中修改了代码
./xxx.mp4
:需要修改成自己的视频文件名
~/Library/Application Support/Übersicht/widgets/GettingStarted.jsx1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
export const command = "";
export const refreshFrequency = 3600000;
export const className = ` width: 100%; height: 100%; h1 { color: red; } `
export const render = ({output}) => { return ( <div> <video src="./xxx.mp4" /* 视频路径 */ width="100%" /* 视频宽度 */ height="100%" /* 视频高度 */ loop="loop" /* 视频循环播放 */ autoPlay="autoPlay" /* 视频自动播放 */ muted="muted" /* 视频静音 */ ></video> </div> ); }
|
自动切换图片壁纸代码
- Übersicht中内置了jQuery,可以直接通过
$
调用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
export const command = "echo success";
export const refreshFrequency = 5000;
export const className = ` #app { width: 1920px; height: 1080px; background: white; } `;
export const render = ({output}) => { $.getJSON("https://api.luvying.com/acgimg?return=json", "", (result) => { document.getElementById("app").style.backgroundImage = `url(${result["acgurl"]})`; }); return ( <div id="app"></div> ); }
|
完成
参考文献
知乎——Femd
CSDN——CallMeKongkong