Skip to content

Commit ba015bb

Browse files
committed
chore: tray
1 parent 0fd6777 commit ba015bb

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src-tauri/src/omb/tray.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,26 @@ pub fn menu() -> SystemTray {
2121
pub fn menu_event(app: &AppHandle, event: SystemTrayEvent) {
2222
match event {
2323
SystemTrayEvent::LeftClick {
24-
position: _,
24+
position,
2525
size: _,
2626
..
2727
} => {
2828
println!("system tray received a left click");
29+
let win = app.get_window("main").unwrap();
30+
win.show().unwrap();
31+
let logical_size = tauri::LogicalSize::<f64> {
32+
width: 300.00,
33+
height: 500.00,
34+
};
35+
let size = tauri::Size::Logical(logical_size);
36+
win.set_size(size).unwrap();
37+
let logical_position = tauri::LogicalPosition::<f64> {
38+
x: position.x / 2.0,
39+
y: position.y - logical_size.height - 50.,
40+
};
41+
let pos = tauri::Position::Logical(logical_position);
42+
win.set_position(pos).unwrap();
43+
win.set_focus().unwrap();
2944
}
3045
SystemTrayEvent::RightClick {
3146
position: _,

src/styles/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ code {
1717

1818
* {
1919
box-sizing: border-box;
20-
}
20+
}

0 commit comments

Comments
 (0)