11//! This is the config file type definitions for rustcast
2- use std:: { path:: Path , sync:: Arc } ;
2+ use std:: { collections :: HashMap , path:: Path , sync:: Arc } ;
33
44use iced:: { Font , font:: Family , theme:: Custom , widget:: image:: Handle } ;
55use serde:: { Deserialize , Serialize } ;
66
77use crate :: {
8- app:: apps:: { App , AppCommand } ,
8+ app:: {
9+ ToApp ,
10+ apps:: { App , AppCommand } ,
11+ } ,
912 commands:: Function ,
1013 utils:: handle_from_icns,
1114} ;
@@ -23,6 +26,7 @@ pub struct Config {
2326 pub haptic_feedback : bool ,
2427 pub show_trayicon : bool ,
2528 pub shells : Vec < Shelly > ,
29+ pub modes : HashMap < String , String > ,
2630 pub log_path : String ,
2731}
2832
@@ -39,6 +43,7 @@ impl Default for Config {
3943 haptic_feedback : false ,
4044 show_trayicon : true ,
4145 log_path : "/tmp/rustcast.log" . to_string ( ) ,
46+ modes : HashMap :: new ( ) ,
4247 shells : vec ! [ ] ,
4348 }
4449 }
@@ -173,9 +178,8 @@ pub struct Shelly {
173178 alias_lc : String ,
174179}
175180
176- impl Shelly {
177- /// Converts the shelly struct to an app so that it can be added to the app list
178- pub fn to_app ( & self ) -> App {
181+ impl ToApp for Shelly {
182+ fn to_app ( & self ) -> App {
179183 let self_clone = self . clone ( ) ;
180184 let icon = self_clone. icon_path . and_then ( |x| {
181185 let x = x. replace ( "~" , & std:: env:: var ( "HOME" ) . unwrap ( ) ) ;
@@ -187,10 +191,7 @@ impl Shelly {
187191 } ) ;
188192 App {
189193 ranking : 0 ,
190- open_command : AppCommand :: Function ( Function :: RunShellCommand (
191- self_clone. command ,
192- self_clone. alias_lc . clone ( ) ,
193- ) ) ,
194+ open_command : AppCommand :: Function ( Function :: RunShellCommand ( self_clone. command ) ) ,
194195 desc : "Shell Command" . to_string ( ) ,
195196 icons : icon,
196197 display_name : self_clone. alias ,
0 commit comments