refactor x11

This commit is contained in:
Ashley Wulber 2022-01-14 18:24:31 -05:00
parent 28151177d0
commit eefe17e3c6
2 changed files with 15 additions and 20 deletions

View file

@ -2,8 +2,6 @@ use gtk4::gdk::Display;
use gtk4::prelude::*;
use gtk4::CssProvider;
use gtk4::StyleContext;
use once_cell::sync::OnceCell;
use x11rb::rust_connection::RustConnection;
use window::AppLibraryWindow;
@ -14,8 +12,6 @@ mod group_grid;
mod utils;
mod window;
static X11_CONN: OnceCell<RustConnection> = OnceCell::new();
fn main() {
let app = gtk4::Application::new(Some("com.cosmic.app_library"), Default::default());
app.connect_startup(|_app| {
@ -45,10 +41,6 @@ fn load_css() {
fn build_ui(app: &gtk4::Application) {
// Create a new custom window and show it
let window = AppLibraryWindow::new(app);
let (conn, _screen_num) = x11rb::connect(None).expect("Failed to connect to X");
if X11_CONN.set(conn).is_err() {
println!("failed to set X11_CONN. Exiting");
std::process::exit(1);
};
window.show();
}