shbatm / MMM-OnScreenMenu

MagicMirror² utility module that provides a simple on screen menu for control
MIT License
62 stars 22 forks source link

MMM-KeyBindings #14

Open DennisFre opened 5 years ago

DennisFre commented 5 years ago

Hey, can't get the keybindings up and running with my Amazon remote.

If I habe a look into the chrome dev console it looks like this:

MMM-OnScreenMenu.js:430 Uncaught TypeError: Cannot use 'in' operator to search for 'ArrowUp' in undefined at Class.validateKeyPress (MMM-OnScreenMenu.js:430) at Class.notificationReceived (MMM-OnScreenMenu.js:105) at sendNotification (main.js:95) at Object.sendNotification (main.js:498) at Class.sendNotification (module.js:368) at Mousetrap.bindGlobal (MMM-KeyBindings.js:142) at f (mousetrap.min.js:5) at c.h._handleKey (mousetrap.min.js:7) at c.handleKey (mousetrap.min.js:10) at HTMLDocument.d (mousetrap.min.js:5)

Here is my config.js: ` { module: 'MMM-OnScreenMenu', position: 'bottom_right', // Valid positions: 'top_right', 'top_left', 'bottom_right', 'bottom_left' config: { touchMode: true, enableKeyboard: true, menuItems: { monitorOff: { title: "Turn Off Monitor", icon: "television", source: "ALL" }, restart: { title: "Restart MagicMirror", icon: "recycle", source: "ALL" }, refresh: { title: "Refresh MagicMirror", icon: "refresh", source: "ALL" }, reboot: { title: "Reboot", icon: "spinner", source: "ALL" }, shutdown: { title: "Shutdown", icon: "power-off", source: "ALL" }, }, enableKeyBindings: true, keyBindingsMode: "OSM", keyBindings: { Up: "ArrowUp", Down: "ArrowDown", Select: "Enter", Close: "Return", Menu: "Menu" }, kbMultiInstance: true, keyBindingsTakeFocus: "Menu"

        }
    }

`

Any suggestions ?

Cheers

shbatm commented 5 years ago

Try changing enableKeyboard: true, to enableKeyboard: false, if you have enableKeyBindings: true. They are mutually exclusive--if you have MMM-KeyBindings then all keyboard functions are handled by that module and 'enableKeyboard' in this module will get in the way.

Note to self: I need to clean up error handling & config options.

DennisFre commented 5 years ago

Awesome ! Done !

Works well!

Cheers

On 22. Nov 2018, at 20:46, shbatm notifications@github.com wrote:

Try changing enableKeyboard: true, to enableKeyboard: false, if you have enableKeyBindings: true. They are mutually exclusive--if you have MMM-KeyBindings then all keyboard functions are handled by that module and 'enableKeyboard' in this module will get in the way.

Note to self: I need to clean up error handling & config options.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/shbatm/MMM-OnScreenMenu/issues/14#issuecomment-441110519, or mute the thread https://github.com/notifications/unsubscribe-auth/AciznRhGa3BZZthP3qHektAJ_wK1NXa7ks5uxv77gaJpZM4YvfXz.

mafraqs commented 5 years ago

I'd like to jump in on this issue. I've set up MMM-KeyBindings and MMM-OnScreenMenu. Below is my current config. While I'm able to control the OSM with a Keyboard (connected via USB to my raspi), I'm not able to control OSM with my connected Amazon Fire TV Remote. The keypress from the Amazon remote control is registered as seen in the log (see below config). What is wrong, please help :)

config.js

{
    module: 'MMM-KeyBindings',
    config: {  
        enableKeyboard: true, 
    },
},
{
    module: 'MMM-OnScreenMenu',
    position: 'bottom_right',
    /* Valid positions: 'top_right', 'top_left', 'bottom_right', 'bottom_left' */
    config: {
        touchMode: true,
        menuItems: {
            monitorToggle: { title: "Toggle Monitor", icon: "television", source: "ALL" },
            openDevTools: { title: "Open Dev Tools", icon: "laptop-code", source: "ALL" },
            restart: { title: "Restart MagicMirror", icon: "recycle", source: "ALL" },
            refresh: { title: "Refresh MagicMirror", icon: "refresh", source: "ALL" },
            reboot: { title: "Reboot", icon: "spinner", source: "ALL" },
            shutdown: { title: "Shutdown", icon: "power-off", source: "ALL" },
        },
        enableKeyBindings: true,
        keyBindingsMode: "OSM",
        keyBindings: {
            Up: "ArrowUp",
            Down: "ArrowDown",
            Select: "Enter",
            Close: "Return",
            Menu: "Menu"
        },
        keyBindingsTakeFocus: "Menu"
    },
},

dev console log

clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS
module.js:154 clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS
module.js:154 clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS
matze6486 commented 3 years ago

I'd like to jump in on this issue. I've set up MMM-KeyBindings and MMM-OnScreenMenu. Below is my current config. While I'm able to control the OSM with a Keyboard (connected via USB to my raspi), I'm not able to control OSM with my connected Amazon Fire TV Remote. The keypress from the Amazon remote control is registered as seen in the log (see below config). What is wrong, please help :)

config.js

{
    module: 'MMM-KeyBindings',
    config: {  
        enableKeyboard: true, 
    },
},
{
    module: 'MMM-OnScreenMenu',
    position: 'bottom_right',
    /* Valid positions: 'top_right', 'top_left', 'bottom_right', 'bottom_left' */
    config: {
        touchMode: true,
        menuItems: {
            monitorToggle: { title: "Toggle Monitor", icon: "television", source: "ALL" },
            openDevTools: { title: "Open Dev Tools", icon: "laptop-code", source: "ALL" },
            restart: { title: "Restart MagicMirror", icon: "recycle", source: "ALL" },
            refresh: { title: "Refresh MagicMirror", icon: "refresh", source: "ALL" },
            reboot: { title: "Reboot", icon: "spinner", source: "ALL" },
            shutdown: { title: "Shutdown", icon: "power-off", source: "ALL" },
        },
        enableKeyBindings: true,
        keyBindingsMode: "OSM",
        keyBindings: {
            Up: "ArrowUp",
            Down: "ArrowDown",
            Select: "Enter",
            Close: "Return",
            Menu: "Menu"
        },
        keyBindingsTakeFocus: "Menu"
    },
},

dev console log

clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS
module.js:154 clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS
module.js:154 clock received a module notification: KEYPRESS from sender: MMM-KeyBindings
module.js:154 calendar received a module notification: KEYPRESS from sender: MMM-KeyBindings
newsfeed.js:344 newsfeed - received notification: KEYPRESS
newsfeed.js:403 newsfeed - unknown notification, ignoring: KEYPRESS

Do you found a solution for this issue? i have exactly the same problem.