-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from sentialx/docs
docs: separate docs to files and describe breaking changes
- Loading branch information
Showing
6 changed files
with
250 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Breaking changes | ||
|
||
List of breaking changes between major versions. | ||
|
||
## Planned Breaking API Changes (2.0) | ||
|
||
### `windowManager.getScaleFactor(monitor: number)` | ||
|
||
```typescript | ||
// Deprecated | ||
windowManager.getScaleFactor(windowManager.getActiveWindow().getMonitor()); | ||
// Replace with | ||
windowManager.getActiveWindow().getMonitor().getScaleFactor(); | ||
``` | ||
|
||
### `windowManager.requestAccessibility()` `macOS` | ||
|
||
The `windowManager.requestAccessibility` method won't be required before each operation on windows anymore. Only on: | ||
|
||
- `window.setBounds` | ||
- `window.maximize` | ||
- `window.minimize` | ||
- `window.restore` | ||
- `window.bringToTop` | ||
- `window.getTitle` | ||
|
||
### `window.getMonitor(): number` | ||
|
||
Now the `window.getMonitor` method returns [`Monitor`](monitor.md) object. | ||
|
||
### `window.getInfo()` | ||
|
||
`window.getInfo` method has been removed. | ||
|
||
```typescript | ||
// Deprecated | ||
const { title } = window.getInfo(); | ||
// Replace with | ||
const title = window.getTitle(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## Class `Monitor` `Windows` | ||
|
||
Control monitors. | ||
|
||
```typescript | ||
import { windowManager } from 'node-window-manager'; | ||
|
||
// Gets height of the primary window working area. | ||
const { height } = windowManager.getPrimaryWindow().getWorkArea(); | ||
``` | ||
|
||
### new Monitor(id: number) | ||
|
||
- `id` number - the monitor handle | ||
|
||
### Instance properties | ||
|
||
- `id` number | ||
|
||
### Instance methods | ||
|
||
#### monitor.getBounds() `Windows` | ||
|
||
- Returns [`Rectangle`](rectangle.md) | ||
|
||
#### monitor.getWorkArea() `Windows` | ||
|
||
Gets monitor working area bounds. | ||
|
||
- Returns [`Rectangle`](rectangle.md) | ||
|
||
#### monitor.isPrimary() `Windows` | ||
|
||
Whether the monitor is primary. | ||
|
||
- Returns `boolean` | ||
|
||
#### monitor.getScaleFactor() `Windows` | ||
|
||
Gets monitor scale factor (DPI). | ||
|
||
- Returns `number` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Object `Rectangle` | ||
|
||
- `x` number | ||
- `y` number | ||
- `width` number | ||
- `height` number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
## `windowManager` | ||
|
||
Get monitors and opened windows. | ||
|
||
```typescript | ||
import { windowManager } from 'node-window-manager'; | ||
|
||
windowManager.requestAccessibility(); | ||
|
||
const window = windowManager.getActiveWindow(); | ||
|
||
// Prints the currently focused window title. | ||
console.log(window.getTitle()); | ||
``` | ||
|
||
### Instance methods | ||
|
||
#### windowManager.requestAccessibility() `macOS` | ||
|
||
If the accessibility permission is not granted on `macOS`, it opens an accessibility permission request dialog. | ||
|
||
The method is required to call before calling the following methods: | ||
|
||
- `window.setBounds` | ||
- `window.maximize` | ||
- `window.minimize` | ||
- `window.restore` | ||
- `window.bringToTop` | ||
- `window.getTitle` | ||
|
||
- Returns `boolean` | ||
|
||
#### windowManager.getActiveWindow() `Windows` `macOS` | ||
|
||
- Returns [`Window`](window.md) | ||
|
||
#### windowManager.getWindows() `Windows` `macOS` | ||
|
||
- Returns [`Window[]`](window.md) | ||
|
||
#### windowManager.getMonitors() `Windows` | ||
|
||
- Returns [`Monitor[]`](monitor.md) | ||
|
||
#### windowManager.getPrimaryMonitor() `Windows` | ||
|
||
- Returns [`Monitor`](monitor.md) | ||
|
||
### Events | ||
|
||
#### Event 'window-activated' `Windows` `macOS` | ||
|
||
Returns: | ||
|
||
- [`Window`](window.md) | ||
|
||
Emitted when a window has been activated. |
Oops, something went wrong.