I'm currently using DWM as my window manager, and for convenience I'd like to be able to open a seperate instance of my terminal (ST) that automatically opens ranger for me.

I mapped a custom command in DWM that runs the following command: "st ranger".

I noticed however, that no matter what I try, ranger (only when opened in this way) will only open itself in my ST directory (which is $HOME/st) as if it were the starting directory. If I were to open ranger within an already existing terminal instance, it starts up and behaves exactly as one would expect.

I tried all sorts of modifications to this command to try to force ranger to open in my $HOME directory, such as "st ranger $HOME" and "st ranger --cmd='cd $HOME'" and a slew of other variations. Whenever I apply these commands through my DWM keybind my terminal quickly opens and closes with a brief error message saying that my $HOME directory is undefined. It will only open if my ST directory is in my home folder. If I move the ST directory elsewhere it gives me a similar error.

Can anyone explain why this is happening and how I could possibly fix it?

  • 1
    Yes, when I echo $HOME, I get "/home/dkmestre" – LiveAndLetLove Dec 6 '18 at 21:48
  • Strange. I'll do some more research. – Ben M. Dec 6 '18 at 21:50
  • Thanks, I've been doing some digging myself, and I can't quite pin down if it's a ranger issue, dwm issue, or an ST issue (although I honestly doubt it's ST). – LiveAndLetLove Dec 6 '18 at 21:53
  • I also doubt it's to do with ST. I use ST and Ranger myself, though not dwm. If I had to put money on it, I'd go with a ranger issue. Still haven't been able to recreate the issue or turn up anything, unfortunately. – Ben M. Dec 8 '18 at 5:32

Your Answer

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

Browse other questions tagged or ask your own question.