The Official Raspberry Pi Projects Book - Projects_Book_v4

(singke) #1

Make your mirror truly yours by adding and customising modules


MIRROR


CUSTOMISING YOUR


s well as the pre-installed default modules,
you can add third-party modules that have
either been created by the community
or yourself. They’re easy to add: you just need to
download the files and then update the configuration
file to use them.
First of all, take a look on the page for the
MagicMirror modules in the GitHub repo here:
magpi.cc/WKRaXQ. You’ll find a list of great modules
to add, such as a Bitcoin monitor and something that
displays today’s XKCD comic. Pick one you like and
copy the link location to it.
To install the module, first move to the modules
folder with cd~/MagicMirror/modules and then
download the data for it with:

git clone https://github.com/[author]/
[module-name]

...with the GitHub link pasted from the link you
copied. Check out the readme for the module and see
if there are any other steps to perform, otherwise
open up the config.js file from before and add the
module to the module section. You’ll need to format it
something like:

{
module: 'module name',
position: 'position',
header: 'optional header',
config: {
extra option: 'value'
}
},

Here’s the full list of options to use...

A


OPTION DESCRIPTION


module The name of the module. This can also contain the
subfolder. Valid examples include clock, default/
calendar, and modules/[module name].

position The location of the module on the mirror.
Possible values are:

top_bar, top_left, top_center,
top_right, upper_third, middle_center,
lower_third, bottom_left, bottom_center,
bottom_right, bottom_bar,
fullscreen_above, and fullscreen_below.

This field is optional, but most modules require
it to be set. Check the documentation of the
module for more information. Multiple modules
with the same position will be arranged based
on the order in the configuration file. Some trial
and error is required.

classes Additional classes which are passed to the
module. The field is optional.

header To display a header text above the module, add
the header property. This field is optional.

disabled Set disabled to true to skip creating the module.
This field is optional.

config An object with the module configuration
properties. Check the documentation of the
module for more information. This field
is optional, unless the module requires
extra configuration.

DON’T WANT
TO DISMANTLE
YOUR MIRROR?
Use SSH from another
computer to access
the Pi inside

Feature


(^130) The Official Raspberry Pi Projects Book raspberrypi.org/magpi

Free download pdf