File tree Expand file tree Collapse file tree 8 files changed +39
-22
lines changed Expand file tree Collapse file tree 8 files changed +39
-22
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " positioner " : patch
3
+ " positioner-js " : patch
4
+ ---
5
+
6
+ Added missing permission for ` handleIconState ` and fixed its event processing logic.
Original file line number Diff line number Diff line change 2
2
// SPDX-License-Identifier: Apache-2.0
3
3
// SPDX-License-Identifier: MIT
4
4
5
- const COMMANDS : & [ & str ] = & [ "move_window" ] ;
5
+ const COMMANDS : & [ & str ] = & [ "move_window" , "set_tray_icon_state" ] ;
6
6
7
7
fn main ( ) {
8
8
tauri_plugin:: Builder :: new ( COMMANDS )
Original file line number Diff line number Diff line change @@ -40,20 +40,8 @@ export async function moveWindow(to: Position): Promise<void> {
40
40
}
41
41
42
42
export async function handleIconState ( event : TrayIconEvent ) : Promise < void > {
43
- const size = { } as Record < string , unknown >
44
- size [ `${ event . rect . size . type } ` ] = {
45
- width : event . rect . size . width ,
46
- height : event . rect . size . height
47
- }
48
-
49
- const position = { } as Record < string , unknown >
50
- position [ `${ event . rect . position . type } ` ] = {
51
- x : event . rect . position . x ,
52
- y : event . rect . position . y
53
- }
54
-
55
43
await invoke ( 'plugin:positioner|set_tray_icon_state' , {
56
- position,
57
- size
44
+ position : event . rect . position ,
45
+ size : event . rect . size
58
46
} )
59
47
}
Original file line number Diff line number Diff line change 4
4
5
5
[[permission ]]
6
6
identifier = " allow-set-tray-icon-state"
7
- description = " Enables the set_tray_icon_state to handle events and set the TrayIcon state ."
7
+ description = " Enables the set_tray_icon_state command without any pre-configured scope ."
8
8
commands.allow = [" set_tray_icon_state" ]
9
+
10
+ [[permission ]]
11
+ identifier = " deny-set-tray-icon-state"
12
+ description = " Denies the set_tray_icon_state command without any pre-configured scope."
13
+ commands.deny = [" set_tray_icon_state" ]
Original file line number Diff line number Diff line change 1
1
## Default Permission
2
2
3
- Allows the move_window command
3
+ Allows the moveWindow and handleIconState APIs
4
4
5
5
- ` allow-move-window `
6
6
- ` set-tray-icon-state `
@@ -48,7 +48,20 @@ Denies the move_window command without any pre-configured scope.
48
48
</td >
49
49
<td >
50
50
51
- Enables the set_tray_icon_state to handle events and set the TrayIcon state.
51
+ Enables the set_tray_icon_state command without any pre-configured scope.
52
+
53
+ </td >
54
+ </tr >
55
+
56
+ <tr >
57
+ <td >
58
+
59
+ ` positioner:deny-set-tray-icon-state `
60
+
61
+ </td >
62
+ <td >
63
+
64
+ Denies the set_tray_icon_state command without any pre-configured scope.
52
65
53
66
</td >
54
67
</tr >
Original file line number Diff line number Diff line change 1
1
"$schema" = " schemas/schema.json"
2
2
[default ]
3
- description = " Allows the move_window command "
3
+ description = " Allows the moveWindow and handleIconState APIs "
4
4
permissions = [" allow-move-window" , " set-tray-icon-state" ]
Original file line number Diff line number Diff line change 305
305
"const" : " deny-move-window"
306
306
},
307
307
{
308
- "description" : " Enables the set_tray_icon_state to handle events and set the TrayIcon state ." ,
308
+ "description" : " Enables the set_tray_icon_state command without any pre-configured scope ." ,
309
309
"type" : " string" ,
310
310
"const" : " allow-set-tray-icon-state"
311
311
},
312
312
{
313
- "description" : " Allows the move_window command" ,
313
+ "description" : " Denies the set_tray_icon_state command without any pre-configured scope." ,
314
+ "type" : " string" ,
315
+ "const" : " deny-set-tray-icon-state"
316
+ },
317
+ {
318
+ "description" : " Allows the moveWindow and handleIconState APIs" ,
314
319
"type" : " string" ,
315
320
"const" : " default"
316
321
}
You can’t perform that action at this time.
0 commit comments