-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FAQ] Center on screen #463
Labels
FAQ
Common project related questions and answers
Comments
The problem is getting the screen size in a cross-platform way. let window = ctx.window();
// get the window position property, maybe not like this, i cant recall exactly now
let window_x = ctx.widget(window).get("position").clone().x();
let window_x = ctx.widget(window).get("position").clone().y(); then match orbclient::get_display_size() {
Ok(screen_size) => {
self.x = (screen_size.0 - window_width) / 2;
self.y = (screen_size.1 - window_height) / 2;
/// set window's positon property values of x and y
}
Err(msg) => {
eprintln!("Cannot determine screen size: {}", msg);
} (I just implemented centering on my own lib, i will try port it to back orbtk when i have some time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Window spawns in top left corner. I want my window be centered on screen. How do i make it spawn centered on screen?
I thought about manually centering window, but i haven't found a way to get screen resolution. Also i heard that wayland does not let you know your screen resolution.
The text was updated successfully, but these errors were encountered: