summaryrefslogtreecommitdiffstats
path: root/src/gui/mod.rs
blob: 4574a39da03a17d0e6354de4aab1c6e4f1c12e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use anyhow::Result;
use iced::Application;

#[derive(Debug)]
struct DistroxGui;

impl Application for DistroxGui {
    type Executor = iced::executor::Default; // tokio
    type Message = ();
    type Flags = ();

    fn new(_flags: ()) -> (Self, iced::Command<Self::Message>) {
        (DistroxGui, iced::Command::none())
    }

    fn title(&self) -> String {
        String::from("distrox")
    }

    fn update(&mut self, _message: Self::Message, _clipboard: &mut iced::Clipboard) -> iced::Command<Self::Message> {
        iced::Command::none()
    }

    fn view(&mut self) -> iced::Element<Self::Message> {
        iced::Text::new("Hello, world!").into()
    }

}

pub fn run() -> Result<()> {
    let settings = iced::Settings {
        window: iced::window::Settings {
            resizable: true,
            decorations: true,
            transparent: false,
            always_on_top: false,
            ..iced::window::Settings::default()
        },
        exit_on_close_request: true,
        ..iced::Settings::default()
    };

    DistroxGui::run(settings).map_err(anyhow::Error::from)
}