Skip to content

Instantly share code, notes, and snippets.

@jackinloadup
Created September 22, 2017 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackinloadup/95dbedc8271040adac7d19e6a50ea2ad to your computer and use it in GitHub Desktop.
Save jackinloadup/95dbedc8271040adac7d19e6a50ea2ad to your computer and use it in GitHub Desktop.
#!/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