aboutsummaryrefslogtreecommitdiff
path: root/plugins/openselected.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/openselected.lua')
-rw-r--r--plugins/openselected.lua33
1 files changed, 23 insertions, 10 deletions
diff --git a/plugins/openselected.lua b/plugins/openselected.lua
index c2cb3a4..7df4dba 100644
--- a/plugins/openselected.lua
+++ b/plugins/openselected.lua
@@ -7,17 +7,30 @@ local config = require "core.config"
local contextmenu = require "plugins.contextmenu"
-config.plugins.openselected = {}
-if not config.plugins.openselected.filemanager then
- if PLATFORM == "Windows" then
- config.plugins.openselected.filemanager = "start"
- elseif PLATFORM == "Mac OS X" then
- config.plugins.openselected.filemanager = "open"
- else
- config.plugins.openselected.filemanager = "xdg-open"
- end
+local platform_filelauncher
+if PLATFORM == "Windows" then
+ platform_filelauncher = "start"
+elseif PLATFORM == "Mac OS X" then
+ platform_filelauncher = "open"
+else
+ platform_filelauncher = "xdg-open"
end
+config.plugins.openselected = common.merge({
+ filelauncher = platform_filelauncher,
+ -- The config specification used by the settings gui
+ config_spec = {
+ name = "Open Selected Text",
+ {
+ label = "File Launcher",
+ description = "Command used to open the selected path or link externally.",
+ path = "filelauncher",
+ type = "string",
+ default = platform_filelauncher
+ }
+ }
+}, config.plugins.openselected)
+
command.add("core.docview", {
["open-selected:open-selected"] = function()
local doc = core.active_view.doc
@@ -38,7 +51,7 @@ command.add("core.docview", {
core.log("Opening %s...", text)
- system.exec(config.plugins.openselected.filemanager .. " " .. text)
+ system.exec(config.plugins.openselected.filelauncher .. " " .. text)
end,
})