Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/app/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(),
},
]
}

Expand Down
12 changes: 12 additions & 0 deletions src/app/tile/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ pub fn handle_update(tile: &mut Tile, message: Message) -> Task<Message> {

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));

Expand Down
4 changes: 2 additions & 2 deletions src/calculator.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//! 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,
pub second_num: f64,
}

/// 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,
Expand Down
4 changes: 3 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -18,6 +18,7 @@ pub enum Function {
GoogleSearch(String),
Calculate(Expression),
OpenPrefPane,
Nothing,
Quit,
}

Expand Down Expand Up @@ -91,6 +92,7 @@ impl Function {
));
});
}
Function::Nothing => {}
Function::Quit => std::process::exit(0),
}
}
Expand Down