dotfiles

personal configuration files and scripts
git clone https://tongong.net/git/dotfiles.git
Log | Files | Refs | README

samedir (391B)


      1 #!/bin/sh
      2 # Open a terminal window in the same directory as the currently active window.
      3 # this was taken from LukeSmith's dofiles
      4 
      5 PID=$(xprop -id "$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')" | grep -m 1 PID | cut -d " " -f 3)
      6 PID="$(pstree -lpA "$PID" | tail -n 1 | awk -F'---' '{print $NF}' | sed -re 's/[^0-9]//g')"
      7 cd "$(readlink /proc/"$PID"/cwd)" || return 1
      8 st