Commit 5 of 6:
f0e29ec8f0
feat: position system tray
previous
next
whole branch
Review threads live on the whole diff, not on one commit, so
none are shown here - a thread's line means something in the
branch's final form, and painting it into an intermediate
step would put it on code it is not about.
eslint.config.ts modified +1 -1 Changes to eslint.config.ts ⋯ 11 lines Show the 11 lines above this hunk @@ -12,7 +12,7 @@ const config: ESLintConfig = stacks({ 12 12 yaml : true , 13 13 ignores : [ 14 14 'fixtures/**' , 15 - ' example /src-tauri/**' , 15 + ' examples/** /src-tauri/**' , 16 16 ] , 17 17 } ) 18 18
examples/tray-with-custom-tray-menu-window/src-tauri/src/main.rs modified +14 -0 Changes to examples/tray-with-custom-tray-menu-window/src-tauri/src/main.rs ⋯ 2 lines Show the 2 lines above this hunk @@ -3,8 +3,22 @@3 3 windows_subsystem = "windows" 4 4 ) ] 5 5 6 + use tauri : : Manager ; 7 + use tauri_plugin_positioner : : { WindowExt , Position } ; 8 + 9 + # [ tauri : : command ] 10 + fn move_window ( app : tauri : : AppHandle , window_label : String ) { 11 + if let Some ( win ) = app . get_window ( & window_label ) { 12 + let _ = win . move_window ( Position : : TrayBottomCenter ) ; 13 + } else { 14 + eprintln ! ( "Window with label '{}' not found" , window_label ) ; 15 + } 16 + } 17 + 6 18 fn main ( ) { 7 19 tauri : : Builder : : default ( ) 20 + . plugin ( tauri_plugin_positioner : : init ( ) ) 21 + . invoke_handler ( tauri : : generate_handler ! [ move_window ] ) 8 22 . run ( tauri : : generate_context ! ( ) ) 9 23 . expect ( "error while running tauri application" ) ; 10 24 }
packages/vite-plugin-tauri/src/tauri.ts modified +8 -0 Changes to packages/vite-plugin-tauri/src/tauri.ts ⋯ 187 lines Show the 187 lines above this hunk @@ -188,6 +188,10 @@ export function tauri(config?: TauriConfig): PluginOption { 188 188 'positioner:default' , 189 189 'core:window:allow-show' , 190 190 'core:webview:allow-webview-show' , 191 + 'core:window:allow-is-visible' , 192 + 'core:window:allow-get-all-windows' , 193 + 'core:window:allow-is-focused' , 194 + 'core:window:allow-set-position' , 191 195 ] , 192 196 } , 193 197 ] , ⋯ 82 lines Show the 82 lines above this hunk @@ -276,6 +280,10 @@ export function tauri(config?: TauriConfig): PluginOption { 276 280 'positioner:default' , 277 281 'core:window:allow-show' , 278 282 'core:webview:allow-webview-show' , 283 + 'core:window:allow-is-visible' , 284 + 'core:window:allow-get-all-windows' , 285 + 'core:window:allow-is-focused' , 286 + 'core:window:allow-set-position' , 279 287 ] , 280 288 } , 281 289 ] ,