Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Open Terminal action on directories

  • Loading branch information...
commit bb237636ca448a7e24fa4096c4f5ea5568df6e9c 1 parent 7a3c380
@engla authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 plugins/openterminal.lua
View
33 plugins/openterminal.lua
@@ -0,0 +1,33 @@
+
+require "clean"
+module(..., clean.seeall)
+
+require "posix"
+
+require "luancher.action"
+
+local OpenTerminal = luancher.action.Action {
+ name = "Open Terminal",
+ key = "<Alt>m",
+ icon_name = "terminal",
+ action = function (self, application)
+ if posix.fork() == 0 then
+ posix.chdir(application.url)
+ posix.execp("xdg-terminal")
+ os.exit(1)
+ end
+ end,
+ applies_to = function (self, application)
+ if type(application) == "table" and application.url then
+ local stat = posix.stat(application.url)
+ if stat and stat.type == "directory" then
+ return true
+ end
+ end
+ end
+}
+
+
+function get_actions()
+ return { OpenTerminal }
+end
Please sign in to comment.
Something went wrong with that request. Please try again.