Skip to content

Instantly share code, notes, and snippets.

@nvlled
Forked from yvon/rc.lua
Created April 7, 2018 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvlled/e736fbc17e4416e0ce0c88df85f50271 to your computer and use it in GitHub Desktop.
Save nvlled/e736fbc17e4416e0ce0c88df85f50271 to your computer and use it in GitHub Desktop.
Awesome (window manager) configuration opening terminal in focused client working directory
awful.key({ modkey, }, "Return",
function ()
pid = client.focus.pid
cpid = string.gsub(awful.util.pread('pgrep -P ' .. pid), "[\r\n]+$", "")
cwd = string.gsub(awful.util.pread('readlink /proc/' .. cpid .. '/cwd'), "[\r\n]+$", "")
if string.len(cwd) > 0 then
awful.util.spawn(terminal .. ' -cd ' .. cwd)
else
awful.util.spawn(terminal)
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment