@@ -17,6 +17,8 @@ use iced::window::{self, Id, Settings};
1717use iced:: { Element , Subscription , Task , Theme } ;
1818use objc2:: rc:: Retained ;
1919use objc2_app_kit:: NSRunningApplication ;
20+ use tray_item:: IconSource ;
21+ use tray_item:: TrayItem ;
2022
2123use std:: cmp:: min;
2224use std:: fs;
@@ -43,6 +45,22 @@ fn log_error_and_exit(msg: &str) {
4345 exit ( -1 )
4446}
4547
48+ pub fn create_tray_icons ( ) {
49+ let mut tray = TrayItem :: new (
50+ "RustCast" ,
51+ IconSource :: Data {
52+ height : 10 ,
53+ width : 10 ,
54+ data : include_bytes ! ( "../docs/icon.png" ) . to_vec ( ) ,
55+ } ,
56+ )
57+ . unwrap ( ) ;
58+
59+ let inner = tray. inner_mut ( ) ;
60+ inner. add_quit_item ( "Quit" ) ;
61+ inner. display ( ) ;
62+ }
63+
4664pub fn get_installed_apps ( dir : impl AsRef < Path > ) -> Vec < App > {
4765 fs:: read_dir ( dir)
4866 . unwrap_or_else ( |x| {
@@ -175,6 +193,7 @@ pub struct Tile {
175193impl Tile {
176194 /// A base window
177195 pub fn new ( ) -> ( Self , Task < Message > ) {
196+ // let _ = create_tray_icons();
178197 let ( id, open) = window:: open ( default_settings ( ) ) ;
179198 let _ = window:: run ( id, |handle| {
180199 macos:: macos_window_config (
@@ -231,7 +250,15 @@ impl Tile {
231250 icon_path: None ,
232251 name: rand:: random_range( 0 ..100 ) . to_string( ) ,
233252 name_lc: String :: new( ) ,
234- } ]
253+ } ] ;
254+ return window:: resize (
255+ id,
256+ iced:: Size {
257+ width : WINDOW_WIDTH ,
258+ height : DEFAULT_WINDOW_HEIGHT + 55. ,
259+ } ,
260+ ) ;
261+
235262 }
236263
237264 let filter_vec = if self . query_lc . starts_with ( & self . prev_query_lc ) {
0 commit comments