Pregunta

Is there any simple way to align window of Node-Webkit application? As far as I can see in documentation there is such metod as Window.moveTo(), as well as property "position", which nevertheless could have only 3 values: "center", "mouse" and null. So in order to align the app by the right side of monitor I need to move window manually from code on start, or are there any other way?

¿Fue útil?

Solución

  1. Use javascript window.screen.availHeight and window.screen.availWidth (which excludes window decorations n toolbar)
    or

    window.screen.height and window.screen.width (which includes window decorations n toolbar) to get the screen resolution.

  2. In node-webkit package.json set

    "window": { "show": false } this will hide the node-webkit window initially.

  3. var appWidth = 400; // width of your application

  4. Use window.moveTo(window.screen.availWidth - appWidth, 40);

  5. Use window.show(); to show the window

this allows to place window anywhere on screen

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top