@@ -6,6 +6,7 @@ import Gtk from "./types/Gtk-3.0"
6
6
export class AppWindow {
7
7
window : Gtk . ApplicationWindow
8
8
dock : Dock
9
+ hidden = true
9
10
10
11
constructor ( application : Gtk . Application ) {
11
12
const win = new Gtk . ApplicationWindow ( {
@@ -66,8 +67,10 @@ export class AppWindow {
66
67
}
67
68
68
69
updateSize ( ) {
70
+ if ( this . hidden ) this . autoHide ( )
71
+
69
72
// Hide window when dock is hidden
70
- if ( this . dock . toolbar . get_visible ( ) ) this . window . show ( )
73
+ if ( ! this . hidden && this . dock . show ) this . window . show ( )
71
74
else {
72
75
this . window . hide ( )
73
76
return
@@ -135,7 +138,7 @@ export class AppWindow {
135
138
}
136
139
137
140
autoHide ( ) {
138
- const active = this . window . get_screen ( ) . get_active_window ( )
141
+ const active = this . dock . screen . get_active_window ( )
139
142
if ( active && this . window ) {
140
143
const [ ax1 , ay1 , aw , ah ] = active . get_geometry ( )
141
144
const [ bx1 , by1 ] = this . window . get_position ( )
@@ -152,14 +155,16 @@ export class AppWindow {
152
155
// no vertical overlap
153
156
else if ( ay1 >= by1 + bh || by1 >= ay1 + ah ) show = true
154
157
155
- if ( show && ! this . window . is_visible ( ) ) {
158
+ if ( show && this . hidden ) {
156
159
log ( "[no-overlap] showing dock" )
157
160
this . window . show ( )
161
+ this . hidden = false
158
162
}
159
163
160
- if ( ! show && this . window . is_visible ( ) ) {
161
- log ( `[overlap] overlapping. Hiding dock` )
164
+ if ( ! show && ! this . hidden ) {
165
+ log ( `[overlap] overlapping with ${ active . get_name ( ) } . Hiding dock` )
162
166
this . window . hide ( )
167
+ this . hidden = true
163
168
}
164
169
}
165
170
return true
0 commit comments