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 22// SPDX-License-Identifier: Apache-2.0
33// SPDX-License-Identifier: MIT
44
5- const COMMANDS : & [ & str ] = & [ "move_window" ] ;
5+ const COMMANDS : & [ & str ] = & [ "move_window" , "set_tray_icon_state" ] ;
66
77fn main ( ) {
88 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> {
4040}
4141
4242export 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-
5543 await invoke ( 'plugin:positioner|set_tray_icon_state' , {
56- position,
57- size
44+ position : event . rect . position ,
45+ size : event . rect . size
5846 } )
5947}
Original file line number Diff line number Diff line change 44
55[[permission ]]
66identifier = " 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 ."
88commands.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 11## Default Permission
22
3- Allows the move_window command
3+ Allows the moveWindow and handleIconState APIs
44
55- ` allow-move-window `
66- ` set-tray-icon-state `
@@ -48,7 +48,20 @@ Denies the move_window command without any pre-configured scope.
4848</td >
4949<td >
5050
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.
5265
5366</td >
5467</tr >
Original file line number Diff line number Diff line change 11"$schema" = " schemas/schema.json"
22[default ]
3- description = " Allows the move_window command "
3+ description = " Allows the moveWindow and handleIconState APIs "
44permissions = [" allow-move-window" , " set-tray-icon-state" ]
Original file line number Diff line number Diff line change 305305 "const" : " deny-move-window"
306306 },
307307 {
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 ." ,
309309 "type" : " string" ,
310310 "const" : " allow-set-tray-icon-state"
311311 },
312312 {
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" ,
314319 "type" : " string" ,
315320 "const" : " default"
316321 }
You can’t perform that action at this time.
0 commit comments