achristmascarl / rainfrog

🐸 a database management tui for postgres
https://crates.io/crates/rainfrog
MIT License
1.64k stars 32 forks source link

fix X11 clipboard timeout on linux #83

Open achristmascarl opened 4 days ago

achristmascarl commented 4 days ago

bug description

first reported in https://github.com/achristmascarl/rainfrog/issues/77, it seems like arboard's clipboard creation takes to long with X11. This reported on ubuntu 20 and reproduced in ubuntu 22 and also arch

technical details

this was patched in https://github.com/achristmascarl/rainfrog/pull/81, but falling back to the textarea buffer means the data doesn't make it to the user's actual clipboard. it looks like extending the timeout for creating the Clipboard instance might help (https://github.com/1Password/arboard/pull/147), but will need to test that out to verify

system info

expected behavior

arboard works on linux

LucasGarciaSI commented 1 day ago

Possível Solução

Você pode implementar a sugestão de aumentar o tempo limite na criação da área de transferência:


func CreateClipboardInstance() error {
    timeout := 500 * time.Millisecond // Aumentar o timeout conforme necessário
    clipboardInstance, err := NewClipboard(timeout)
    if err != nil {
        return fmt.Errorf("falha ao criar a instância da área de transferência: %v", err)
    }
    return nil
}