Skip to content

Commit 6a06803

Browse files
committed
chore(windows/app.rs)
on launch of the app, it would not center it nor take it to the right screen, now it does.
1 parent df924f3 commit 6a06803

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

src/app.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,30 @@ pub struct Tile {
170170
impl Tile {
171171
/// A base window
172172
pub fn new(keybind_id: u32, config: &Config) -> (Self, Task<Message>) {
173-
let (id, open) = window::open(default_settings());
173+
let mut settings = default_settings();
174+
#[cfg(target_os = "windows")]
175+
{
176+
// get normal settings and modify position
177+
use crate::utils::open_on_focused_monitor;
178+
use iced::window::Position::Specific;
179+
let pos = open_on_focused_monitor();
180+
settings.position = Specific(pos);
181+
}
174182

175-
let open = open.discard().chain(window::run(id, |handle| {
176-
#[cfg(target_os = "macos")]
177-
{
178-
macos::macos_window_config(
179-
&handle.window_handle().expect("Unable to get window handle"),
180-
);
181-
// should work now that we have a window
182-
transform_process_to_ui_element();
183-
};
184-
}));
183+
let (id, open) = window::open(settings);
184+
185+
#[cfg(target_os = "macos")]
186+
{
187+
let open = open.discard().chain(window::run(id, |handle| {
188+
{
189+
macos::macos_window_config(
190+
&handle.window_handle().expect("Unable to get window handle"),
191+
);
192+
// should work now that we have a window
193+
transform_process_to_ui_element();
194+
}
195+
}));
196+
}
185197

186198
let store_icons = config.theme.show_icons;
187199
let paths;

0 commit comments

Comments
 (0)