diff --git a/src/app/apps.rs b/src/app/apps.rs index cfad6e9..e745bd3 100644 --- a/src/app/apps.rs +++ b/src/app/apps.rs @@ -18,7 +18,7 @@ use crate::{ /// This struct represents a command that rustcast can perform, providing the rustcast /// the data needed to search for the app, to display the app in search results, and to actually /// "run" the app. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct App { pub open_command: Function, pub desc: String, @@ -45,6 +45,13 @@ impl App { name: "Open RustCast Preferences".to_string(), name_lc: "settings".to_string(), }, + App { + open_command: Function::Nothing, + desc: RUSTCAST_DESC_NAME.to_string(), + icons: None, + name: "Clipboard History".to_string(), + name_lc: "clipboard".to_string(), + }, ] } diff --git a/src/app/tile/update.rs b/src/app/tile/update.rs index 0e5a6cd..2d41ecc 100644 --- a/src/app/tile/update.rs +++ b/src/app/tile/update.rs @@ -92,6 +92,18 @@ pub fn handle_update(tile: &mut Tile, message: Message) -> Task { let max_elem = min(5, new_length); + if tile.results + == vec![App { + open_command: Function::Nothing, + desc: RUSTCAST_DESC_NAME.to_string(), + icons: None, + name: "Clipboard History".to_string(), + name_lc: "clipboard".to_string(), + }] + { + tile.page = Page::ClipboardHistory + } + if prev_size != new_length && tile.page == Page::Main { std::thread::sleep(Duration::from_millis(30)); diff --git a/src/calculator.rs b/src/calculator.rs index f16e1c6..c1f5029 100644 --- a/src/calculator.rs +++ b/src/calculator.rs @@ -1,7 +1,7 @@ //! This handle the logic for the calculator in rustcast /// A struct that represents an expression -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq)] pub struct Expression { pub first_num: f64, pub operation: Operation, @@ -9,7 +9,7 @@ pub struct Expression { } /// An enum that represents the different operations that can be performed on an expression -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq)] pub enum Operation { Addition, Subtraction, diff --git a/src/commands.rs b/src/commands.rs index 4a3bb7e..355a1d4 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -9,7 +9,7 @@ use objc2_foundation::NSURL; use crate::{calculator::Expression, clipboard::ClipBoardContentType, config::Config}; /// The different functions that rustcast can perform -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub enum Function { OpenApp(String), RunShellCommand(String, String), @@ -18,6 +18,7 @@ pub enum Function { GoogleSearch(String), Calculate(Expression), OpenPrefPane, + Nothing, Quit, } @@ -91,6 +92,7 @@ impl Function { )); }); } + Function::Nothing => {} Function::Quit => std::process::exit(0), } }