Skip to content

This Module adds a touch menu to switch between different profiles from the MMM-ProfileSwitcher. This an extension for the MagicMirror².

License

Notifications You must be signed in to change notification settings

tosti007/MMM-TouchNavigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MMM-TouchNavigation

This an extension for the MagicMirror². This Module adds a touch menu to switch between different profiles from the MMM-ProfileSwitcher.

Thanks to shashank for his input in the module and testing.

Installation

Since I made this module to work in conjunction with the MMM-ProfileSwitcher you will have to install this module first. You can read more information about how to install it on it's github page.

Note: it is also possible to use this module in conjunction with other modules since it only uses notifications, if a module supports this navigation is up to the maker. More information about this in Notes For Other Developers.

After installing the MMM-ProfileSwitcher.

In your terminal, go to your MagicMirror's Module folder:

cd ~/MagicMirror/modules

Clone this repository:

git clone https://github.com/tosti007/MMM-TouchNavigation.git

Using the module

To use this module, add it to the modules array in the config/config.js file:

modules: [
    {
        module: 'MMM-TouchNavigation',
        config: {
            // See 'Configuration options' for more information.
        }
    }
]

Configuration options

The following properties can be configured:

Option Description
showBorder Determines if the border around the buttons should be shown.

Possible values: true or false
Default value: true
minWidth The minimum width for all the buttons.

Possible values: css length
Default value: 0px
minHeight The minimum height for all the buttons.

Possible values: css length
Default value: 0px
picturePlacement The location of the symbol or image relative to the text.

Possible values: left, right, top or bottom
Default value: left
direction The direction of the menu.

Possible values: row, column, row-reverse or column-reverse
Default value: row
buttons All the different buttons in the menu.

Possible values: a button configuration, see Configuring Buttons
Default value: some example buttons

Configuring Buttons

Buttons have to be placed in buttons in the config. A button contains a profile name as key and a configuration in an object ({}).

Option Description
text A string to display in the button.

Note: if no value is set no text will be displayed.
Possible values: string
symbol A symbol to display in the button.

Note: if no value is set no symbol will be displayed.
Possible values: See Font Awesome website
size The size of the symbol.

Note: will only have effect on the symbol.
Default value: 1
Possible values: 1, 2, 3, 4 or 5
img An image to display in the button.

Note: it will only display if no symbol is set.
Possible values: A path to an image (an url or local path)
width The width of the image.

Note: will only have effect on the image.
Possible values: number
height The height of the image.

Note: will only have effect on the image.
Possible values: number

An example:

buttons: {
    "profile_name": { 
        // A button with text and a symbol
        text: "text to display",
        symbol: "ban"
    },
    "example1": {
        // A button with only a symbol
        symbol: "paper-plane"
    },
    "example2": {
        // A button with only text
        text: "Click me"  
    }
}

An Example Module Configuration

An example configuration file has been added to this repository, file example-config.js.

Notes

  • If the image is an local path and it does not show. Try different ways to write the local path. If this still does not work then try putting the image in a folder in your MagicMirror folder and use as local path foldername/imagename.
  • If only heigh or width is set for an image the other size will scale to maintain it the image it's original aspect ratio.
  • Profile name is case sensitive.
  • If both the text and symbol aren't set for a button then the button won't contain anything, but still show the border.
  • The symbols are all form the Font Awesome website.
  • The text may contain HTML tags and will be displayed as HTML.

Notes For Other Developers

  • When a button is pressed a CURRENT_PROFILE notification will be send.
  • When a CHANGED_PROFILE notification is received the menu dom will be updated.

The MIT License (MIT)

Copyright (c) 2017 Brian Janssen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

This Module adds a touch menu to switch between different profiles from the MMM-ProfileSwitcher. This an extension for the MagicMirror².

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published