fix dialog close and add API.

This commit is contained in:
Miroslav Šedivý
2021-01-18 10:34:33 +01:00
parent 2b3bb6e21a
commit 8f60041b2d
4 changed files with 34 additions and 16 deletions

View File

@ -27,20 +27,24 @@ func (manager *DesktopManagerCtx) HandleFileChooserDialog(uri string) error {
return err
}
func (manager *DesktopManagerCtx) CloseFileChooserDialog() error {
mu.Lock()
defer mu.Unlock()
func (manager *DesktopManagerCtx) CloseFileChooserDialog() bool {
for i := 0; i < 5; i++ {
// TOOD: Use native API.
mu.Lock()
exec.Command(
"xdotool",
"search", "--name", "Open", "windowfocus",
"sleep", "0.2",
"key", "--clearmodifiers", "alt+F4",
).Output()
mu.Unlock()
// TOOD: Use native API.
cmd := exec.Command(
"xdotool",
"search", "--name", "Open", "windowfocus",
"sleep", "0.2",
"key", "--clearmodifiers", "alt+f4",
)
if !manager.IsFileChooserDialogOpen() {
return true
}
}
_, err := cmd.Output()
return err
return false
}
func (manager *DesktopManagerCtx) IsFileChooserDialogOpen() bool {