Created
December 8, 2015 15:36
-
-
Save zsteva/648fd4d72bcdc55a6073 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| CURR_WIN_ID=$(xprop -root _NET_ACTIVE_WINDOW | sed -e 's/.*# //') | |
| XPID="" | |
| XSUBPID="" | |
| XCWD="" | |
| test -n "${CURR_WIN_ID}" && XPID=$(xprop -notype -id "$CURR_WIN_ID" _NET_WM_PID | sed -e 's/^.* = //') | |
| test -n "${XPID}" && XSUBPID=$(pgrep -P "${XPID}" | head -1) | |
| test -e "/proc/${XSUBPID}/" && XCWD=$(readlink /proc/${XSUBPID}/cwd) | |
| test -z "${XCWD}" -a -e "/proc/${XPID}/" && XCWD=$(readlink /proc/${XPID}/cwd) | |
| test -z "${XCWD}" && XCWD="$HOME" | |
| exec /usr/bin/termite -d "$XCWD" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment