Skip to content

Commit 1cb1c56

Browse files
authored
Add a function to the window manager in order to list all open windows (#396)
1 parent 5ca804a commit 1cb1c56

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Facades/Window.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @method static \Native\Laravel\Windows\PendingOpenWindow open(string $id = 'main')
99
* @method static void close($id = null)
1010
* @method static object current()
11+
* @method static array all()
1112
* @method static void resize($width, $height, $id = null)
1213
* @method static void position($x, $y, $animated = false, $id = null)
1314
* @method static void alwaysOnTop($alwaysOnTop = true, $id = null)

src/Windows/WindowManager.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ public function current(): Window
3939
->fromRuntimeWindow($window);
4040
}
4141

42+
public function all(): array
43+
{
44+
$windows = (array) $this->client->get('window/all')->json();
45+
46+
return array_map(
47+
fn ($window) => (new Window($window['id']))
48+
->setClient($this->client)
49+
->fromRuntimeWindow((object) $window),
50+
$windows
51+
);
52+
}
53+
4254
public function get(string $id): Window
4355
{
4456
$window = (object) $this->client->get("window/get/{$id}")->json();

0 commit comments

Comments
 (0)