Created
January 13, 2022 11:31
-
-
Save mwild1/1992cff46bf3092dfe4a797671f3c7bc to your computer and use it in GitHub Desktop.
Config snippet for Awesome WM to spawn terminal in current directory
This file contains 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
--[[ | |
This snippet works with rxvt-unicode. If you hit Mod+Return while | |
you have a terminal window focused, the new terminal window will | |
begin in the same directory instead of the default (your home directory). | |
--]] | |
awful.key({ modkey, }, "Return", function () | |
local extra_args = ""; | |
local curr_client = client.focus; | |
if curr_client and curr_client.class == "URxvt" then | |
local shell_pid = io.popen("ps h --ppid "..curr_client.pid.." -o pid"):read("*l"):gsub("%s+", ""); | |
extra_args = " -cd /proc/"..shell_pid.."/cwd"; | |
end | |
awful.util.spawn(terminal..extra_args) | |
end, { description = "open a terminal" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment