Created
September 22, 2017 14:30
-
-
Save jackinloadup/95dbedc8271040adac7d19e6a50ea2ad 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 | |
# Xorg window id | |
ID=$(xdpyinfo | grep focus | cut -f4 -d " ") | |
# SHELL id | |
PID=$(xprop -id $ID | grep -m 1 PID | cut -d " " -f 3) | |
# TERM id | |
TERM_ID=$(pgrep -P $PID) | |
#echo "ID: $ID" | |
#echo "PID: $PID" | |
#echo "TERM_ID: $TERM_ID" | |
#if [ -e "/proc/$TERM_ID/cwd" ] | |
#then | |
# echo $(readlink /proc/$TERM_ID/cwd) & | |
#else | |
# echo "not fouhnd" | |
#fi | |
# | |
#exit | |
if [ -e "/proc/$TERM_ID/cwd" ] | |
then | |
urxvt -cd $(readlink /proc/$TERM_ID/cwd) & | |
else | |
urxvt | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment