@@ -24,7 +24,10 @@ use std::{
2424use x11:: {
2525 xinerama,
2626 xlib:: {
27- self , Atom , Cursor , GCForeground , XAllocColor , XButtonPressedEvent , XClearWindow , XColor , XCreateFontCursor , XDefaultColormap , XDefaultRootWindow , XDefaultScreen , XFlush , XGCValues , XGetWindowProperty , XInternAtom , XParseColor , XSetWindowBackground , XUnmapWindow , XWindowAttributes
27+ self , Atom , Cursor , GCForeground , XAllocColor , XButtonPressedEvent , XClearWindow , XColor ,
28+ XCreateFontCursor , XDefaultColormap , XDefaultRootWindow , XDefaultScreen , XFlush , XGCValues ,
29+ XGetWindowProperty , XInternAtom , XParseColor , XSetWindowBackground , XUnmapWindow ,
30+ XWindowAttributes ,
2831 } ,
2932} ;
3033
@@ -516,8 +519,16 @@ impl GridWM {
516519
517520 // if above fails
518521 unsafe {
519- let net_wm_name = XInternAtom ( self . display , CString :: new ( "_NET_WM_NAME" ) . unwrap ( ) . as_ptr ( ) , 0 ) ;
520- let utf8 = XInternAtom ( self . display , CString :: new ( "UTF8_STRING" ) . unwrap ( ) . as_ptr ( ) , 0 ) ;
522+ let net_wm_name = XInternAtom (
523+ self . display ,
524+ CString :: new ( "_NET_WM_NAME" ) . unwrap ( ) . as_ptr ( ) ,
525+ 0 ,
526+ ) ;
527+ let utf8 = XInternAtom (
528+ self . display ,
529+ CString :: new ( "UTF8_STRING" ) . unwrap ( ) . as_ptr ( ) ,
530+ 0 ,
531+ ) ;
521532
522533 let mut actual_type: Atom = std:: mem:: zeroed ( ) ;
523534 let mut actual_format: i32 = std:: mem:: zeroed ( ) ;
@@ -538,7 +549,9 @@ impl GridWM {
538549 & mut nitems,
539550 & mut bytes_after,
540551 & mut data,
541- ) == 0 && !data. is_null ( ) {
552+ ) == 0
553+ && !data. is_null ( )
554+ {
542555 let win_title = std:: ffi:: CStr :: from_ptr ( data as * const i8 )
543556 . to_string_lossy ( )
544557 . into_owned ( ) ;
@@ -547,7 +560,10 @@ impl GridWM {
547560 }
548561 }
549562
550- Err ( GridWMError :: Other ( format ! ( "failed to get name for window {}" , window) ) )
563+ Err ( GridWMError :: Other ( format ! (
564+ "failed to get name for window {}" ,
565+ window
566+ ) ) )
551567 }
552568
553569 fn get_focused ( & self ) -> Option < Window > {
@@ -845,14 +861,32 @@ impl GridWM {
845861 ( 0 ..n)
846862 . map ( |i| {
847863 let i = i as i32 ;
848- if self . config . bar . enable {
864+ if self . config . bar . enable && ! self . config . general . window_bars {
849865 WindowInfo {
850866 x : ( i % cols) * w,
851867 y : ( ( i / cols) * h) + self . config . bar . height as i32 ,
852868 w,
853869 h,
854870 }
871+ } else if self . config . bar . enable && self . config . general . window_bars {
872+ WindowInfo {
873+ x : ( i % cols) * w,
874+ y : ( ( i / cols) * h)
875+ + self . config . bar . height as i32
876+ + ( ( ( i / cols) + 1 ) * self . config . general . window_bar_height as i32 ) ,
877+ w,
878+ h,
879+ }
880+ } else if !self . config . bar . enable && self . config . general . window_bars {
881+ WindowInfo {
882+ x : ( i % cols) * w,
883+ y : ( ( i / cols) * h)
884+ + ( ( ( i / cols) + 1 ) * self . config . general . window_bar_height as i32 ) ,
885+ w,
886+ h,
887+ }
855888 } else {
889+ // bar disabled and window bars disabled
856890 WindowInfo {
857891 x : ( i % cols) * w,
858892 y : ( i / cols) * h,
0 commit comments