node window manager
2.2.0
管理 Windows、macOS 和Linux (开发中)
要安装这个包,只需运行
$ npm install node-window-manager
以下示例演示如何获取当前焦点窗口的标题并隐藏它。
const { windowManager } = require ( "node-window-manager" ) ;
const window = windowManager . getActiveWindow ( ) ;
// Prints the currently focused window bounds.
console . log ( window . getBounds ( ) ) ;
// This method has to be called on macOS before changing the window's bounds, otherwise it will throw an error.
// It will prompt an accessibility permission request dialog, if needed.
windowManager . requestAccessibility ( ) ;
// Sets the active window's bounds.
window . setBounds ( { x : 0 , y : 0 } ) ;
文档和 API 参考位于docs
目录中。