Closed oblitum closed 6 years ago
Sounds like a good idea. I'll look into it ... unless you'd like to do a PR?
Nice idea, my only request: please don't hardcode the use of gio
, use the standard wrapper xdg-open
that is available everywhere - it will use gio
itself if it is appropriate.
This is an inspiring comment: https://github.com/github/hub/issues/1473#issuecomment-303656214
@maximbaz ah ok right, thanks for that comment link. I thought xdg-open
had been deprecated indeed due to that message. I'm on ArchLinux and I think that message was shown just temporarily, it has been some time I didn't see it anymore, so they should have been fixed it already and it was just left in my memory, wrongly.
I've added an extrakto_custom_tool
option that you can set to the tool of your choice:
set -g @extrakto_custom_tool "xdg-open"
If this works OK we can add this and open
(mac) as defaults.
ah... I was about to offer a pull request. If there's anything to use there yet, feel free to pick https://github.com/oblitum/extrakto/tree/open-functionality.
Awesome stuff guys!
Plain xdg-open
is almost perfect, but it produces some unnecessary output in STDOUT that I don't need to see. I suggest this as a default for Linux:
set -g @extrakto_custom_tool "xdg-open >/dev/null"
UPDATE: I see @oblitum decided to do the same in his fork 😉
@oblitum sorry - so why didn't you say that you'd do a PR? I'd definitely add your defaults!
+if [ -z "$open_tool" ]; then
+ case "`uname`" in
+ 'Linux') open_tool='xdg-open >/dev/null' ;;
+ 'Darwin') open_tool='open' ;;
+ *) ;;
+ esac
+fi
@laktak ¯\_(ツ)_/¯
@laktak why require configuration in the first place, why not just have the defaults always enabled?
What @oblitum originally had with if [ -z "$open_tool" ];
made sense for me.
@maximbaz I think this could use some more testing before enabling it by default. It now appears to work with relative paths. Can you guys test on your systems?
@laktak yes, it wasn't working when current working directory wasn't ~
, it's working now (also for ../foo.txt
, etc).
It happens that I don't have a GUI file manager installed, and thus I have no association with file paths at all on my system... so I all can say is that opening URLs works really well 😄
In that case @oblitum what are you using? I also have no gui apps besides firefox (but xdg-open opens json files there ;)
I'm just testing with .txt
files, I have GVim associated by default to open such files in the MIME database.
I would say that it seems to work good right now, and enabling this functionality by default will make more people using and testing this, and if something is not working correctly I'm sure we will hear about this soon :)
OK, you are probably right ;) It's now set as default.
@laktak nice. IMO it looks a bit inconsistent to have both ""
(for clip_tool
) and "auto"
(open_tool
) to mean the same: to use internal defaults.
@oblitum fixed
Loving this plugin. I wish, besides providing insertion and copy, that it provided open. It would work for files, URLs etc. There could be a simple configuration for the opening command, for example, for me, simply setting up gio
open <text selection>
as the command would work for most files and URLs.