diff --git a/window.go b/window.go index 9e52c6a..0630daf 100644 --- a/window.go +++ b/window.go @@ -32,6 +32,7 @@ type window struct { modalParent *window hasModal bool shy bool + visible bool metrics struct { bounds image.Rectangle @@ -265,14 +266,21 @@ func (window *window) Paste (callback func (data.Data, error), accept ...data.Mi // TODO } -func (window *window) Show () { - window.xWindow.Map() - if window.shy { window.grabInput() } +func (window *window) SetVisible (visible bool) { + if this.visible == visible { return } + window.visible = visible + + if this.visible { + window.xWindow.Map() + if window.shy { window.grabInput() } + } else { + window.xWindow.Unmap() + if window.shy { window.ungrabInput() } + } } -func (window *window) Hide () { - window.xWindow.Unmap() - if window.shy { window.ungrabInput() } +func (window *window) Visible () bool { + return this.visible } func (window *window) Close () {