Post

Here and there

This post is an automatic translation from French. You can read the original version here.

Today, a short post to share a handy trick with you.

As many of you know, i3 has long been my favorite window manager. What a joy to be able to make xterms appear or disappear at lightning speed!

But if you’re like me, a fundamentally single-tasking being, you must find yourself constantly retyping litanies of “cd /blah/bah/blah” to reposition these new terminals in the right working directory.

Over time, I ended up setting up two aliases in my bashrc file that save me many keystrokes. I named them h (for “here”) and t (for “there”):

alias h='mkdir -p /dev/shm/"$USER"/i3 && echo `pwd` > /dev/shm/"$USER"/i3/current_path'
alias t='cd `cat /dev/shm/"$USER"/i3/current_path`'

As you may have guessed, h saves the current working path to the file /dev/shm/rancune/i3/current_path.

I then simply type ‘t’ in each new terminal to teleport directly to the right location.

Simple, trivial even, but devastatingly effective …

Rancune

This post is licensed under CC BY 4.0 by the author.