Skip to content

Commit cb0984f

Browse files
committed
I messed up the easter eff :(
1 parent fb3ee0e commit cb0984f

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/app.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ use iced::window::{self, Id, Settings};
1717
use iced::{Element, Subscription, Task, Theme};
1818
use objc2::rc::Retained;
1919
use objc2_app_kit::NSRunningApplication;
20+
use tray_item::IconSource;
21+
use tray_item::TrayItem;
2022

2123
use std::cmp::min;
2224
use 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+
4664
pub 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 {
175193
impl 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

Comments
 (0)