a quick and dirty fix for yakuake’s “open new tab in same directory” issue

I love yakuake. I simply can’t stand terminal windows being scattered around my desktops anymore.

Yakuake (as delivered by the package managers of ubuntu-ish distributions and OpenSUSE) just has one issue that I cannot tolerate: When you open a new tab, you always start in your home directory and don’t inherit the current working directory from the last active tab. This is sad.

There is a quick and dirty fix. You simply append the following code to your /home/$USER/.bashrc

if [ $(basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat | cut -d \  -f 4) | tail -1 | sed 's/^.* //')) == "yakuake" ]; then
# go to last active cwd
  if [ -e /dev/shm/$USER-yakuake-cwd ]; 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)'
fi

enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s