0

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:

Projects
--------------------------------------------------------
Images
--------------------------------------------------------
Scripts
--------------------------------------------------------
Notes
--------------------------------------------------------
Videos
--------------------------------------------------------

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

1 Answer 1

2

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)
            sys.stdout.write("\033k"+title+"\033\\")
            sys.stdout.flush()

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

ranger.api.hook_init = hook_init
1
  • 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, 2020 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .