I'm using the Ranger file manager on a daily basis but there is one thing that I wish I could modify.

Namely, having multiple ranger windows open, this is what the window titles look like (I'm using i3wm in a stacked mode):

enter image description here

It would really improve my productivity if I was able to label each window with a specific name or at least have it display the specific directory that it's pointing to. Something like this:


Is there a way I could achieve this effect either through the available configuration or with some type of script/plugin?


I use this to set the tmux title (put it into your ranger plugin folder):

import ranger.api
import os
import sys

old_hook_init = ranger.api.hook_init

def hook_init(fm):
    def on_cd():
        if fm.thisdir:
            title = os.path.basename(fm.thisdir.path)

    fm.signal_bind('cd', on_cd)
    return old_hook_init(fm)

ranger.api.hook_init = hook_init
  • For me this worked sys.stdout.write('\33]0;'+title+'\a') instead of your string. Also, I wanted full path so I used title = fm.thisdir.path . Thanks! – Radivarig Jan 15 '20 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.