Skip to content

Commit 0f63f5e

Browse files
fix(api): Fix monitor functions, closes #2294 (#2301)
Co-authored-by: Amr Bashir <48618675+amrbashir@users.noreply.github.com>
1 parent caa7bf4 commit 0f63f5e

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.changes/fix-monitor-api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"api": patch
3+
---
4+
5+
- Fixes monitor api not working.
6+
- Fixes window.print() not working on macOS.

core/tauri/scripts/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/tauri/scripts/core.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,12 @@ if (!String.prototype.startsWith) {
371371
{
372372
__tauriModule: 'Window',
373373
message: {
374-
cmd: 'print'
374+
cmd: 'manage',
375+
data: {
376+
cmd: {
377+
type: 'print'
378+
}
379+
}
375380
}
376381
},
377382
_KEY_VALUE_

tooling/api/src/window.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,12 @@ async function currentMonitor(): Promise<Monitor | null> {
11671167
return invokeTauriCommand({
11681168
__tauriModule: 'Window',
11691169
message: {
1170-
cmd: 'currentMonitor'
1170+
cmd: 'manage',
1171+
data: {
1172+
cmd: {
1173+
type: 'currentMonitor'
1174+
}
1175+
}
11711176
}
11721177
})
11731178
}
@@ -1180,7 +1185,12 @@ async function primaryMonitor(): Promise<Monitor | null> {
11801185
return invokeTauriCommand({
11811186
__tauriModule: 'Window',
11821187
message: {
1183-
cmd: 'primaryMonitor'
1188+
cmd: 'manage',
1189+
data: {
1190+
cmd: {
1191+
type: 'primaryMonitor'
1192+
}
1193+
}
11841194
}
11851195
})
11861196
}
@@ -1190,7 +1200,12 @@ async function availableMonitors(): Promise<Monitor[]> {
11901200
return invokeTauriCommand({
11911201
__tauriModule: 'Window',
11921202
message: {
1193-
cmd: 'availableMonitors'
1203+
cmd: 'manage',
1204+
data: {
1205+
cmd: {
1206+
type: 'availableMonitors'
1207+
}
1208+
}
11941209
}
11951210
})
11961211
}

0 commit comments

Comments
 (0)