diff --git a/src/app/tile.rs b/src/app/tile.rs index 6d20700..cae008f 100644 --- a/src/app/tile.rs +++ b/src/app/tile.rs @@ -1,6 +1,6 @@ //! This module handles the logic for the tile, AKA rustcast's main window -mod elm; -mod update; +pub mod elm; +pub mod update; use crate::app::apps::App; use crate::app::tile::elm::default_app_paths; @@ -16,7 +16,7 @@ use global_hotkey::{GlobalHotKeyEvent, HotKeyState}; use iced::futures::SinkExt; use iced::futures::channel::mpsc::{Sender, channel}; use iced::{ - Element, Subscription, Task, Theme, futures, + Subscription, Theme, futures, keyboard::{self, key::Named}, stream, }; @@ -105,24 +105,6 @@ pub struct Tile { } impl Tile { - /// Initialise the base window - pub fn new(hotkey: HotKey, config: &Config) -> (Self, Task) { - elm::new(hotkey, config) - } - - /// This handles the iced's updates, which have all the variants of [Message] - pub fn update(&mut self, message: Message) -> Task { - update::handle_update(self, message) - } - - /// This is the view of the window. It handles the rendering of the window - /// - /// The rendering of the window size (the resizing of the window) is handled by the - /// [`Tile::update`] function. - pub fn view(&self, wid: window::Id) -> Element<'_, Message> { - elm::view(self, wid) - } - /// This returns the theme of the window pub fn theme(&self, _: window::Id) -> Option { Some(self.theme.clone()) diff --git a/src/main.rs b/src/main.rs index 8c50450..7a74dac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,10 @@ mod utils; use std::path::Path; -use crate::{app::tile::Tile, config::Config}; +use crate::{ + app::tile::{self, Tile}, + config::Config, +}; use global_hotkey::GlobalHotKeyManager; @@ -49,9 +52,9 @@ fn main() -> iced::Result { .expect("Unable to register hotkey"); iced::daemon( - move || Tile::new(show_hide, &config), - Tile::update, - Tile::view, + move || tile::elm::new(show_hide, &config), + tile::update::handle_update, + tile::elm::view, ) .subscription(Tile::subscription) .theme(Tile::theme)