@@ -134,7 +134,7 @@ impl Default for WindowConfig {
134134
135135/// The Updater configuration object.
136136#[ derive( PartialEq , Deserialize , Debug , Clone ) ]
137- #[ serde( tag = "updater" , rename_all = "camelCase" ) ]
137+ #[ serde( rename_all = "camelCase" ) ]
138138pub struct UpdaterConfig {
139139 /// Whether the updater is active or not.
140140 #[ serde( default ) ]
@@ -167,12 +167,21 @@ impl Default for UpdaterConfig {
167167
168168/// Security configuration.
169169#[ derive( PartialEq , Deserialize , Debug , Clone , Default ) ]
170- #[ serde( tag = "updater" , rename_all = "camelCase" ) ]
170+ #[ serde( rename_all = "camelCase" ) ]
171171pub struct SecurityConfig {
172172 /// Content security policy to inject to HTML files with the custom protocol.
173173 pub csp : Option < String > ,
174174}
175175
176+ /// Configuration for application system tray icon.
177+ #[ derive( PartialEq , Deserialize , Debug , Clone , Default ) ]
178+ #[ serde( rename_all = "camelCase" ) ]
179+ pub struct SystemTrayConfig {
180+ /// Path to the icon to use on the system tray.
181+ /// Automatically set to be an `.png` on macOS and Linux, and `.ico` on Windows.
182+ pub icon_path : PathBuf ,
183+ }
184+
176185/// A CLI argument definition
177186#[ derive( PartialEq , Deserialize , Debug , Default , Clone ) ]
178187#[ serde( rename_all = "camelCase" ) ]
@@ -262,7 +271,7 @@ pub struct CliArg {
262271
263272/// The CLI root command definition.
264273#[ derive( PartialEq , Deserialize , Debug , Clone ) ]
265- #[ serde( tag = "cli" , rename_all = "camelCase" ) ]
274+ #[ serde( rename_all = "camelCase" ) ]
266275#[ allow( missing_docs) ] // TODO
267276pub struct CliConfig {
268277 pub description : Option < String > ,
@@ -311,7 +320,7 @@ impl CliConfig {
311320
312321/// The bundler configuration object.
313322#[ derive( PartialEq , Deserialize , Debug ) ]
314- #[ serde( tag = "bundle" , rename_all = "camelCase" ) ]
323+ #[ serde( rename_all = "camelCase" ) ]
315324pub struct BundleConfig {
316325 /// The bundle identifier.
317326 pub identifier : String ,
@@ -335,7 +344,7 @@ fn default_window_config() -> Vec<WindowConfig> {
335344
336345/// The Tauri configuration object.
337346#[ derive( PartialEq , Deserialize , Debug ) ]
338- #[ serde( tag = "tauri" , rename_all = "camelCase" ) ]
347+ #[ serde( rename_all = "camelCase" ) ]
339348pub struct TauriConfig {
340349 /// The window configuration.
341350 #[ serde( default = "default_window_config" ) ]
@@ -352,6 +361,8 @@ pub struct TauriConfig {
352361 /// The security configuration.
353362 #[ serde( default ) ]
354363 pub security : SecurityConfig ,
364+ /// System tray configuration.
365+ pub system_tray : Option < SystemTrayConfig > ,
355366}
356367
357368impl Default for TauriConfig {
@@ -362,13 +373,14 @@ impl Default for TauriConfig {
362373 bundle : BundleConfig :: default ( ) ,
363374 updater : UpdaterConfig :: default ( ) ,
364375 security : SecurityConfig :: default ( ) ,
376+ system_tray : None ,
365377 }
366378 }
367379}
368380
369381/// The Build configuration object.
370382#[ derive( PartialEq , Deserialize , Debug ) ]
371- #[ serde( tag = "build" , rename_all = "camelCase" ) ]
383+ #[ serde( rename_all = "camelCase" ) ]
372384pub struct BuildConfig {
373385 /// the devPath config.
374386 #[ serde( default = "default_dev_path" ) ]
@@ -777,15 +789,33 @@ mod build {
777789 }
778790 }
779791
792+ impl ToTokens for SystemTrayConfig {
793+ fn to_tokens ( & self , tokens : & mut TokenStream ) {
794+ let icon_path = self . icon_path . to_string_lossy ( ) . to_string ( ) ;
795+ let icon_path = quote ! { :: std:: path:: PathBuf :: from( #icon_path) } ;
796+ literal_struct ! ( tokens, SystemTrayConfig , icon_path) ;
797+ }
798+ }
799+
780800 impl ToTokens for TauriConfig {
781801 fn to_tokens ( & self , tokens : & mut TokenStream ) {
782802 let windows = vec_lit ( & self . windows , identity) ;
783803 let cli = opt_lit ( self . cli . as_ref ( ) ) ;
784804 let bundle = & self . bundle ;
785805 let updater = & self . updater ;
786806 let security = & self . security ;
807+ let system_tray = opt_lit ( self . system_tray . as_ref ( ) ) ;
787808
788- literal_struct ! ( tokens, TauriConfig , windows, cli, bundle, updater, security) ;
809+ literal_struct ! (
810+ tokens,
811+ TauriConfig ,
812+ windows,
813+ cli,
814+ bundle,
815+ updater,
816+ security,
817+ system_tray
818+ ) ;
789819 }
790820 }
791821
@@ -880,6 +910,7 @@ mod test {
880910 endpoints : None ,
881911 } ,
882912 security : SecurityConfig { csp : None } ,
913+ system_tray : None ,
883914 } ;
884915
885916 // create a build config
0 commit comments