~/.bashrc
toggle_same_dir() {
if [ -e /dev/shm/$USER-yakuake-cwd-f ]; then
rm /dev/shm/$USER-yakuake-cwd-f
else
touch /dev/shm/$USER-yakuake-cwd-f
fi
}
if [ "$(basename $(readlink -f /proc/${PPID}/exe))" == "yakuake" ]; then
# go to last active cwd
if [[ ( -e /dev/shm/$USER-yakuake-cwd ) && ( -e /dev/shm/$USER-yakuake-cwd-f) ]]; then
cd "$(cat /dev/shm/$USER-yakuake-cwd)"
fi
# on each stroke of the return key, save cwd in a shared memory
export PS1=$PS1'$(pwd > /dev/shm/$USER-yakuake-cwd)'
#request to open in same dir when pressing F1
bind -x '"^[OP":"toggle_same_dir"'
fi
No comments:
Post a Comment