File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 11use crate :: logs:: * ;
22use crate :: { DEFAULT_LOGFILE , DEFAULT_SOCKET } ;
33use hyprland:: Result ;
4+ use std:: cmp:: max;
45use std:: fs:: File ;
56use std:: io:: prelude:: * ;
67use std:: net:: Shutdown ;
@@ -81,17 +82,24 @@ pub fn get_config(socket: Option<&str>, raw: bool) -> Result<()> {
8182
8283 let get_centered_conf = || {
8384 let table_width = max_titles + max_commands + max_options + 6 ;
85+
86+ let c = if table_width <= conf. len ( ) {
87+ conf. split ( "/" ) . last ( ) . unwrap_log ( file ! ( ) , line ! ( ) )
88+ } else {
89+ conf
90+ } ;
91+
8492 let center_fix = if table_width % 2 == 0 {
85- conf . len ( ) + conf . len ( ) % 2
93+ c . len ( ) + c . len ( ) % 2
8694 } else {
87- conf . len ( ) - 1
95+ c . len ( ) - 1
8896 } ;
8997
9098 format ! (
9199 "{}\x1b [0;35m{}\x1b [0;0m{}" ,
92- " " . repeat( table_width / 2 - conf . len( ) / 2 ) ,
93- conf ,
94- " " . repeat( ( table_width - center_fix) / 2 )
100+ " " . repeat( max ( table_width / 2 - c . len( ) / 2 , 0 ) ) ,
101+ c ,
102+ " " . repeat( max ( ( table_width - center_fix) / 2 , 0 ) )
95103 )
96104 } ;
97105
@@ -158,6 +166,7 @@ pub fn print_logs(raw: bool) -> Result<()> {
158166}
159167
160168pub fn print_full_raw ( socket : Option < & str > ) -> Result < ( ) > {
169+ println ! ( "Hyprscratch v{}" , env!( "CARGO_PKG_VERSION" ) ) ;
161170 println ! ( "### LOGS ###\n " ) ;
162171 print_logs ( true ) ?;
163172 println ! ( "\n ### CONFIGURATION ###\n " ) ;
You can’t perform that action at this time.
0 commit comments