@@ -31,14 +31,14 @@ pub const FILE_SEARCH_BATCH_SIZE: u32 = 10;
3131/// The rustcast descriptor name to be put for all rustcast commands
3232pub const RUSTCAST_DESC_NAME : & str = "Utility" ;
3333
34- /// The different pages that rustcast can have / has
34+ /// The different pages that rustcast can have / has within the launcher
35+ /// Settings is notably missing since this opens as a new window outside the launcher
3536#[ derive( Debug , Clone , PartialEq ) ]
3637pub enum Page {
3738 Main ,
3839 FileSearch ,
3940 ClipboardHistory ,
4041 EmojiSearch ,
41- Settings ,
4242}
4343
4444/// The settings panel tabs
@@ -94,7 +94,6 @@ impl std::fmt::Display for Page {
9494 Page :: FileSearch => "File search" ,
9595 Page :: EmojiSearch => "Emoji search" ,
9696 Page :: ClipboardHistory => "Clipboard history" ,
97- Page :: Settings => "Settings" ,
9897 } )
9998 }
10099}
@@ -127,7 +126,7 @@ pub enum Editable<T> {
127126#[ derive( Debug , Clone ) ]
128127pub enum Message {
129128 UriReceived ( String ) ,
130- WriteConfig ( bool ) ,
129+ WriteConfig ,
131130 SaveRanking ,
132131 ToggleAutoStartup ( bool ) ,
133132 LoadRanking ,
@@ -136,7 +135,6 @@ pub enum Message {
136135 ResizeWindow ( Id , f32 ) ,
137136 OpenWindow ,
138137 OpenResult ( u32 ) ,
139- OpenToSettings ,
140138 SearchQueryChanged ( String , Id ) ,
141139 KeyPressed ( Shortcut ) ,
142140 FocusTextInput ( Move ) ,
@@ -169,6 +167,8 @@ pub enum Message {
169167 DebouncedSearch ( Id ) ,
170168 ThemeModeChanged ( bool ) ,
171169 SimulatePaste ( i32 ) ,
170+ OpenSettingsWindow ,
171+ SettingsWindowOpened ( window:: Id ) ,
172172}
173173
174174#[ derive( Debug , Clone ) ]
@@ -228,6 +228,23 @@ pub fn default_settings() -> Settings {
228228 }
229229}
230230
231+ pub fn settings_window_settings ( ) -> window:: Settings {
232+ Settings {
233+ resizable : false ,
234+ decorations : true ,
235+ minimizable : false ,
236+ level : window:: Level :: AlwaysOnTop ,
237+ transparent : false ,
238+ blur : false ,
239+ size : iced:: Size {
240+ width : 900. ,
241+ height : 600. ,
242+ } ,
243+ position : window:: Position :: Centered ,
244+ ..Default :: default ( )
245+ }
246+ }
247+
231248/// A Trait to define that a struct can be converted to an app
232249pub trait ToApp {
233250 /// Convert self into an app
@@ -287,7 +304,7 @@ impl ToApps for HashMap<String, String> {
287304impl DebouncePolicy for Page {
288305 fn debounce_delay ( & self , config : & Config ) -> Option < Duration > {
289306 match self {
290- Page :: Main | Page :: ClipboardHistory | Page :: Settings => None ,
307+ Page :: Main | Page :: ClipboardHistory => None ,
291308 Page :: FileSearch | Page :: EmojiSearch => {
292309 Some ( Duration :: from_millis ( config. debounce_delay ) )
293310 }
@@ -306,7 +323,6 @@ mod tests {
306323 assert_eq ! ( Page :: FileSearch . to_string( ) , "File search" ) ;
307324 assert_eq ! ( Page :: ClipboardHistory . to_string( ) , "Clipboard history" ) ;
308325 assert_eq ! ( Page :: EmojiSearch . to_string( ) , "Emoji search" ) ;
309- assert_eq ! ( Page :: Settings . to_string( ) , "Settings" ) ;
310326 }
311327
312328 #[ test]
@@ -318,7 +334,6 @@ mod tests {
318334
319335 assert_eq ! ( Page :: Main . debounce_delay( & config) , None ) ;
320336 assert_eq ! ( Page :: ClipboardHistory . debounce_delay( & config) , None ) ;
321- assert_eq ! ( Page :: Settings . debounce_delay( & config) , None ) ;
322337 assert_eq ! (
323338 Page :: FileSearch . debounce_delay( & config) ,
324339 Some ( Duration :: from_millis( 123 ) )
0 commit comments