@@ -37,6 +37,7 @@ pub enum Page {
3737 FileSearch ,
3838 ClipboardHistory ,
3939 EmojiSearch ,
40+ Settings ,
4041}
4142
4243impl std:: fmt:: Display for Page {
@@ -46,6 +47,7 @@ impl std::fmt::Display for Page {
4647 Page :: FileSearch => "File search" ,
4748 Page :: EmojiSearch => "Emoji search" ,
4849 Page :: ClipboardHistory => "Clipboard history" ,
50+ Page :: Settings => "Settings" ,
4951 } )
5052 }
5153}
@@ -70,15 +72,18 @@ pub enum Move {
7072/// The message type that iced uses for actions that can do something
7173#[ derive( Debug , Clone ) ]
7274pub enum Message {
75+ WriteConfig ,
7376 UpdateAvailable ,
7477 ResizeWindow ( Id , f32 ) ,
7578 OpenWindow ,
79+ OpenToSettings ,
7680 SearchQueryChanged ( String , Id ) ,
7781 KeyPressed ( u32 ) ,
7882 FocusTextInput ( Move ) ,
7983 HideWindow ( Id ) ,
8084 RunFunction ( Function ) ,
8185 OpenFocused ,
86+ SetConfig ( SetConfigFields ) ,
8287 ReturnFocus ,
8388 EscKeyPressed ( Id ) ,
8489 ClearSearchResults ,
@@ -97,6 +102,37 @@ pub enum Message {
97102 DebouncedSearch ( Id ) ,
98103}
99104
105+ #[ derive( Debug , Clone ) ]
106+ pub enum SetConfigFields {
107+ ToDefault ,
108+ ToggleHotkey ( String ) ,
109+ ClipboardHotkey ( String ) ,
110+ PlaceHolder ( String ) ,
111+ SearchUrl ( String ) ,
112+ HapticFeedback ( bool ) ,
113+ ShowMenubarIcon ( bool ) ,
114+ // Modes(HashMap<String, String>),
115+ // Aliases(HashMap<String, String>),
116+ // SearchDirs(Vec<String>),
117+ DebounceDelay ( u64 ) ,
118+ SetThemeFields ( SetConfigThemeFields ) ,
119+ SetBufferFields ( SetConfigBufferFields ) ,
120+ }
121+
122+ #[ derive( Debug , Clone ) ]
123+ pub enum SetConfigThemeFields {
124+ TextColor ( f32 , f32 , f32 ) ,
125+ BackgroundColor ( f32 , f32 , f32 ) ,
126+ ShowIcons ( bool ) ,
127+ Font ( String ) ,
128+ }
129+
130+ #[ derive( Debug , Clone ) ]
131+ pub enum SetConfigBufferFields {
132+ ClearOnHide ( bool ) ,
133+ ClearOnEnter ( bool ) ,
134+ }
135+
100136/// The window settings for rustcast
101137pub fn default_settings ( ) -> Settings {
102138 Settings {
@@ -173,10 +209,10 @@ impl ToApps for HashMap<String, String> {
173209impl DebouncePolicy for Page {
174210 fn debounce_delay ( & self , config : & Config ) -> Option < Duration > {
175211 match self {
176- Page :: Main => None ,
177- Page :: FileSearch => Some ( Duration :: from_millis ( config . debounce_delay ) ) ,
178- Page :: ClipboardHistory => None ,
179- Page :: EmojiSearch => Some ( Duration :: from_millis ( config . debounce_delay ) ) ,
212+ Page :: Main | Page :: ClipboardHistory | Page :: Settings => None ,
213+ Page :: FileSearch | Page :: EmojiSearch => {
214+ Some ( Duration :: from_millis ( config . debounce_delay ) )
215+ }
180216 }
181217 }
182218}
0 commit comments