-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathapp.rs
More file actions
84 lines (75 loc) · 1.86 KB
/
app.rs
File metadata and controls
84 lines (75 loc) · 1.86 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Main logic for the app
use crate::commands::Function;
use crate::{app::tile::ExtSender, clipboard::ClipBoardContentType};
pub mod apps;
pub mod menubar;
pub mod pages;
pub mod tile;
use iced::window::{self, Id, Settings};
/// The default window width
pub const WINDOW_WIDTH: f32 = 500.;
/// The default window height
pub const DEFAULT_WINDOW_HEIGHT: f32 = 80.;
/// The rustcast descriptor name to be put for all rustcast commands
pub const RUSTCAST_DESC_NAME: &str = "Utility";
/// The different pages that rustcast can have / has
#[derive(Debug, Clone, PartialEq)]
pub enum Page {
Main,
ClipboardHistory,
EmojiSearch,
}
/// The types of arrow keys
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub enum ArrowKey {
Up,
Down,
Left,
Right,
}
/// The ways the cursor can move when a key is pressed
#[derive(Debug, Clone)]
pub enum Move {
Back,
Forwards(String),
}
/// The message type that iced uses for actions that can do something
#[derive(Debug, Clone)]
pub enum Message {
ResizeWindow(Id, f32),
OpenWindow,
SearchQueryChanged(String, Id),
KeyPressed(u32),
FocusTextInput(Move),
HideWindow(Id),
RunFunction(Function),
OpenFocused,
ReturnFocus,
EscKeyPressed(Id),
ClearSearchResults,
WindowFocusChanged(Id, bool),
ClearSearchQuery,
HideTrayIcon,
ReloadConfig,
SetSender(ExtSender),
SwitchToPage(Page),
ClipboardHistory(ClipBoardContentType),
ChangeFocus(ArrowKey),
}
/// The window settings for rustcast
pub fn default_settings() -> Settings {
Settings {
resizable: false,
decorations: false,
minimizable: false,
level: window::Level::AlwaysOnTop,
transparent: true,
blur: false,
size: iced::Size {
width: WINDOW_WIDTH,
height: DEFAULT_WINDOW_HEIGHT,
},
..Default::default()
}
}