diff --git a/src/Facades/Window.php b/src/Facades/Window.php index 75efc45a..5ac1e901 100644 --- a/src/Facades/Window.php +++ b/src/Facades/Window.php @@ -8,6 +8,7 @@ * @method static \Native\Laravel\Windows\PendingOpenWindow open(string $id = 'main') * @method static void close($id = null) * @method static object current() + * @method static array all() * @method static void resize($width, $height, $id = null) * @method static void position($x, $y, $animated = false, $id = null) * @method static void alwaysOnTop($alwaysOnTop = true, $id = null) diff --git a/src/Windows/WindowManager.php b/src/Windows/WindowManager.php index 98907081..49574e61 100644 --- a/src/Windows/WindowManager.php +++ b/src/Windows/WindowManager.php @@ -39,6 +39,18 @@ public function current(): Window ->fromRuntimeWindow($window); } + public function all(): array + { + $windows = (array) $this->client->get('window/all')->json(); + + return array_map( + fn ($window) => (new Window($window['id'])) + ->setClient($this->client) + ->fromRuntimeWindow((object) $window), + $windows + ); + } + public function get(string $id): Window { $window = (object) $this->client->get("window/get/{$id}")->json();