shbatm / MMM-OnScreenMenu

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

MMM-OnScreenMenu Request #4

Closed MSakana closed 6 years ago

MSakana commented 6 years ago

Wondering if there is a way to add a button for exiting the MagicMirror interface, to get to the desktop. Thank you, working great so far with my touchscreen!

shbatm commented 6 years ago

Do you want to exit MagicMirror completely or just minimize the window?

MSakana commented 6 years ago

Either one. Maybe minimize would be best, if that means I could maximize it again. I'm not working on a "MagicMirror" per se, but a home info kiosk w/ touchscreen using the MM modules to display the usual stuff, and then want to be able to exit MM to use the browser, for instance.

shbatm commented 6 years ago

I've added a way to stop the MM instance, if you're using PM2 to run it. You can now create a "stop" menu item and it will exit the MM app by sending a pm2 stop mm command.

This is on the work-in-progress (wip) branch, so you'll need to switch and update the module:

cd ~/MagicMirror/modules/MMM-RTSPStream
git checkout wip
git pull
npm install

I looked at being able to interact with the window itself to minimize/maximize but I don't see an easy way to interact via code with the browser window due to the way NodeJS, electron, and the actual webpage interact. You may ask on the forums (https://forum.magicmirror.builders) and see if a node_helper can access the electron instance (sorry, I don't have time to really investigate further right now).

Something you may want to try based on your configuration: In config/config.js add a line just under var config = {:

electronOptions: { fullscreen: false },

In js/electron.js on line 51 below var mainWindow = new BrowserWindow... add:

mainWindow.maximize();

This will start the MagicMirror in a maximized, but not full screen window; which will leave you access to the taskbar to minimize/maximize/resize as needed. Note: by editing js/electron.js you'll be tweaking you MagicMirror's core code, which will be overwritten whenever you update the mirror. This is the piece I don't know how to access from a module.

MSakana commented 6 years ago

Thank you so much!! Will play around with this more over the weekend, cheers!

MSakana commented 6 years ago

Finally got around to adding the stop option to my menu, it's working great! Thanks again!!

shbatm commented 6 years ago

@MSakana - In case you're interested, I found out how to interact with the electron window. I've added menu options to minimize the window (without exiting) and to toggle full screen mode. Details are in the updated README.

MSakana commented 6 years ago

Wow, that is perfect! Toggle fullscreen mode is exactly what I wanted. Thank you!!