Created
December 15, 2011 11:43
-
-
Save yvon/1480820 to your computer and use it in GitHub Desktop.
Awesome (window manager) configuration opening terminal in focused client working directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
I was trying to hack together something similar but did not have much of a success. Your solution looks neat, but (un)fortunately
awful.util.pread
was deprecated, since it is a blocking call.Have you got a working version without the usage of
awful.util.pread
? The asynchronous function, likeawful.spawn.easy_async
make it bit weird to work with.