@@ -24,6 +24,7 @@ public partial class MainWindow : Window
2424{
2525 private PlatformID platform ;
2626 private bool isCloseConfirm ;
27+ private TextBlock TitleLabel ;
2728 private Button maximizeButton ;
2829 private ButtonContent maximizeIconContent = new ( ) { Item = new IconItem ( ) { Icon = Assets . WindowRestore } , ColorSet = new ( ) { Color = Style . TEXT_LIGHT . Opacity ( 0.6 ) } } ;
2930
@@ -43,6 +44,9 @@ public MainWindow()
4344 Background = Style . BACK . ToBrush ( ) ;
4445 Content . Margin = new ( 1 , 0 ) ;
4546
47+ TitleLabel = new ( ) { Text = "" , FontSize = 12 , VerticalAlignment = Avalonia . Layout . VerticalAlignment . Center , Foreground = Style . TEXT_LIGHT . ToBrush ( ) } ;
48+ TitleLabel . Bind ( TextBlock . TextProperty , new Avalonia . Data . Binding { Path = "Title" , Source = this } ) ;
49+
4650 var binimizeButton = new Button ( ) { Width = 48 , Height = 40 }
4751 . AddContent ( new ( ) { Item = new BorderItem ( ) { CornerRadius = 0 } , ColorSet = new ( ) { HoveredColor = Colors . White . Opacity ( 0.2 ) , PressedColor = Colors . White . Opacity ( 0.2 ) } } )
4852 . AddContent ( new ( ) { Item = new IconItem ( ) { Icon = Assets . WindowMin } , ColorSet = new ( ) { Color = Style . TEXT_LIGHT . Opacity ( 0.7 ) } } ) ;
@@ -58,14 +62,16 @@ public MainWindow()
5862 . AddContent ( new ( ) { Item = new IconItem ( ) { Icon = Assets . WindowClose } , ColorSet = new ( ) { Color = Style . TEXT_LIGHT . Opacity ( 0.7 ) } } ) ;
5963 closeButton . Clicked += ( ) => Close ( ) ;
6064
61- WindowControl . Children . Add ( binimizeButton ) ;
62- WindowControl . Children . Add ( maximizeButton ) ;
63- WindowControl . Children . Add ( closeButton ) ;
64-
65+ bool UseSystemTitle = System . Runtime . InteropServices . RuntimeInformation . IsOSPlatform ( System . Runtime . InteropServices . OSPlatform . Linux ) ; //Is Only Linux have double title case X11?
66+ if ( ! UseSystemTitle ) {
67+ WindowControl . Children . Add ( binimizeButton ) ;
68+ WindowControl . Children . Add ( maximizeButton ) ;
69+ WindowControl . Children . Add ( closeButton ) ;
70+ TitleBar . Children . Add ( TitleLabel ) ;
71+ }
72+
6573 this . AttachWindowStateHandler ( ) ;
6674
67- TitleLabel . Foreground = Style . TEXT_LIGHT . ToBrush ( ) ;
68-
6975 mEditor = new Editor ( ) ;
7076 mEditor . Document . ProjectNameChanged . Subscribe ( UpdateTitle ) ;
7177 mEditor . Document . StatusChanged += UpdateTitle ;
0 commit comments