要制作魔镜的朋友们,最好先看我之前的博客扩展一下root分区,不然很容易导致空间已满无法安装。
1、
首先,我们让树莓派禁止在图形化界面屏保:
输入 sudo vim /etc/profile.d/Screen.sh
export DISPLAY=:0.0
xset dpms 0 0 0
xset s off
输入
sudo vim /etc/lightdm/lightdm.conf
在最后增加一行:
xserver-command=X -s 0 dpms
树莓派禁止在console界面屏保,
输入 vim ~/.bashrc
添加一行:
setterm -blank 0 -powerdown 0
2、
安装npm,将npm源指向taobao,否则在使用npm安装electron时将会出错:
输入 sudo apt-get install npm
输入 npm config set registry https://registry.npm.taobao.org
输入 vim ~/.npmrc
添加如下内容:
registry=https://registry.npm.taobao.org
electron_mirror=http://npm.taobao.org/mirrors/electron/
3、
下载并安装魔镜
输入 bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)";
不能输错,如果跳出错误你可以尝试手动输入hhh
接着会跳出如下的一张图来,耐心等待
4、
下载好后,我们就可以开始配置魔镜了。
输入 cd MagicMirror
输入 ls config
输入 vim config/config.js
可以参考我的配置进行略微修改
/* Magic Mirror Config file */
var config = {
address: "", // - "", "0.0.0.0", "::" to listen on any interface
port: 8080,
ipWhitelist: [], // Set [] to allow all IP addresses
language: "zh",
timeFormat: 24,
units: "metric",
modules: [
{
module: "alert",
},
{
module: "helloworld",
position: "top_center",
config: {
text: "欢迎来到凌云物网智科实验室!"
}
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_left",
config: {
timeFormat: "12",
timezone: "Asia/Shanghai"
}
},
{
module: "compliments",
position: "lower_third",
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}
5、
接下来我们可以任意地修改提示语。
依旧在MagicMirror下,输入 vim modules/default/compliments/compliments.js
修改其中的提示语,修改完后运行的时候会一句一句地弹出来,就像这样:
6、
不过在其之前我们需要启动魔镜
在主目录下输入 vim mm.sh
添加如下代码到脚本文件中:
cd ~/MagicMirror
DISPLAY=:0 npm start
最后给其权限,运行
输入 chmod a+x mm.sh
输入 ./mm.sh对了,还想要问一下大家的是
怎么关闭魔镜再次启动桌面啊???
在下又重新烧录了一遍系统,欲哭无泪呐