@@ -12,6 +12,8 @@ use crate::{
1212 yaml_val:: { value_to_string, Val } ,
1313} ;
1414
15+ const DEFAULT_PROCESSES_TITLE : & ' static str = "Processes" ;
16+
1517pub struct ConfigContext {
1618 pub path : PathBuf ,
1719}
@@ -23,6 +25,7 @@ pub struct Config {
2325 pub mouse_scroll_speed : usize ,
2426 pub scrollback_len : usize ,
2527 pub proc_list_width : usize ,
28+ pub title : String ,
2629}
2730
2831impl Config {
@@ -62,13 +65,22 @@ impl Config {
6265 None
6366 } ;
6467
68+ let title = if let Some ( title) = config. get ( & Value :: from ( "title" ) ) {
69+ title. as_str ( ) ?. to_string ( )
70+ } else if let Some ( title) = & settings. title {
71+ title. clone ( )
72+ } else {
73+ DEFAULT_PROCESSES_TITLE . to_string ( )
74+ } ;
75+
6576 let config = Config {
6677 procs,
6778 server,
6879 hide_keymap_window : settings. hide_keymap_window ,
6980 mouse_scroll_speed : settings. mouse_scroll_speed ,
7081 scrollback_len : settings. scrollback_len ,
7182 proc_list_width : settings. proc_list_width ,
83+ title,
7284 } ;
7385
7486 Ok ( config)
@@ -82,6 +94,7 @@ impl Config {
8294 mouse_scroll_speed : settings. mouse_scroll_speed ,
8395 scrollback_len : settings. scrollback_len ,
8496 proc_list_width : settings. proc_list_width ,
97+ title : DEFAULT_PROCESSES_TITLE . to_string ( ) ,
8598 }
8699 }
87100}
0 commit comments