Last active
December 15, 2018 17:47
-
-
Save vilhalmer/bd096cc30193158994ea8d7ad5720c77 to your computer and use it in GitHub Desktop.
Open new terminals in the directory of the currently focused one, if any
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
#!/usr/bin/env bash | |
pid=$(cat /proc/*/stat 2>/dev/null | awk '{if ($4 == focused_pid) { print $1 }}' focused_pid="$(swaymsg -t get_tree | jq 'recurse(.nodes[]?) | select(.focused).pid')") | |
directory=$(readlink "/proc/$pid/cwd") | |
swaymsg "exec 'cd $directory; exec \$term'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bind this to your terminal key in sway instead of $term, but leave $term set as usual. Like so: