betty icon indicating copy to clipboard operation
betty copied to clipboard

OS independent commands

Open lpanebr opened this issue 10 years ago • 2 comments

The translate does not work on ubuntu because the correct command would be xdg-open instead of open.

It would be great if the betty framework had a way of using OS-independent command. Those could be set-up on the config file.

Example on the translate.rb:

:command => "open https://translate.google.com/##{from}/#{to}/#{translate_string}",

What if we could:

:command => "#{OS-Command} https://translate.google.com/##{from}/#{to}/#{translate_string}",

For the future:

  • Add check and config in install script
  • Teach Betty to make runtime config changes $ betty config <this-command>=<this>

lpanebr avatar May 07 '14 17:05 lpanebr

Also I think Betty should stay in the shell whenever possible. So instead of opening a browser it would be preferable to just return the result so that it's usable in the shell: export translated_text=betty translate blah blah For that I can again recommend this:} https://ask.pannous.com/api?input=translate+yo+quiero+from+spanish+to+German&out=simple

pannous avatar May 07 '14 18:05 pannous

This comes back to the issue of contexts. It needs to be able to change based on OS.platform_name (the OS context).

Maybe there should be a /contexts directory, where you can define contexts. Then, depending on various things that the context can check (like the system, any applications open e.g. iTunes vs Spotify, etc), Betty would be able to do different things.

For the issue of opening a browser or staying in the shell, its also a contextual issue. When using Betty from a shell, it should stay in the shell unless otherwise instructed. I would also like to make a process that runs in the background and can detect voice, in which case the context would be doing things outside the command line.

pickhardt avatar May 11 '14 16:05 pickhardt