Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 28 lines (23 sloc) 538 Bytes
#!/bin/sh -e
#
# Window title can look like:
#
# user@host: ~/path/to/dir
# user@host: /path/to/dir
# file (~/path/to/dir) - VIM
# file (/path/to/dir) - VIM
#
# This program extracts the directory path from the title.
#
title() {
echo "Terminal - i3cwd (~/dotfiles-old/bin) - VIM"
}
path=$(i3-focused-window-title)
path=$(echo "$path" | sed 's,[^~/]*\([~/]\),\1,')
path=$(echo "$path" | sed 's,[) ].*,,')
path=$(echo "$path" | sed "s,^~,$HOME,")
if ! [ -d "$path" ]; then
echo "$HOME"
exit
fi
echo "$path"
You can’t perform that action at this time.