-2

How do I make ranger start directly from my file manager, instead of first opening the terminal and then starting the application?

I have written this below code in my .desktop file:

#!/bin/bash
[Desktop Entry]
Name=Ranger
Exec=/bin/bash -c 'ranger'
Terminal=True
Type=Application

But, it doesn't seem to work. How do I fix it?

I tried adding bash at the end like this:

Exec="/bin/bash -c 'ranger';bash"

But, this doesn't seem to work either.

FedKad
  • 10,515
Nick
  • 43

2 Answers2

2

Remove

#!/bin/bash

from the beginning of file.

Change the Terminal line to:

Terminal=true

(lowercase true).

And

Exec=/bin/bash -c 'ranger'

to

Exec=/usr/bin/ranger

or whatever is the full path of the ranger command.

Another option would be to change the Exec command like this:

Exec=/usr/bin/gnome-terminal --active -- /usr/bin/ranger

If you need full screen terminal, you can try the --maximize and --full-screen options of gnome-terminal. Please, close all terminals before testing!

To find out the full path of gnome-terminal run the command:

whereis gnome-terminal
FedKad
  • 10,515
  • ok, this worked but it looks very ugly. :((

    This is how it looks like when executed from inside the terminal: https://i.stack.imgur.com/rTL1n.png

    and

    This is how it looks like when executed your way: https://i.stack.imgur.com/2CoUi.png

    So how do I get it to look like how it looks when executed from inside the terminal?

    – Nick Feb 02 '20 at 13:58
  • btw, my only mistake was using capital T in true, other things kept the same worked as well. :)) I just tried it. :) I am not sure which is a better approach though. – Nick Feb 02 '20 at 14:16
  • Can you change the Exec line like this? Exec=/usr/bin/gnome-terminal --active -- /usr/bin/ranger – FedKad Feb 02 '20 at 14:23
  • this one isn't working. :( – Nick Feb 02 '20 at 14:35
  • also, do you know how to start ranger in full screen by default whenever I click the shortcut? instead of having to make it full screen everytime I start it? – Nick Feb 02 '20 at 14:38
  • I just checked inside my usr/bin folder to see if I actually have gnome-terminal in there but there isn't any gnome-terminal file in my usr/bin. :( – Nick Feb 02 '20 at 14:41
  • 1
    I am using ElementaryOS, which is a flavor of ubuntu. – Nick Feb 02 '20 at 14:42
  • You can try the --maximize and --full-screen options of gnome-terminal. Please, close all terminals before testing! Try whereis gnome-terminal to find out the full path of gnome-terminal. – FedKad Feb 02 '20 at 14:42
  • I don't have gnome-terminal in my system. :(( – Nick Feb 02 '20 at 14:48
  • but I do have terminology, terminator, about 4-5 others. I can name them all if you need. – Nick Feb 02 '20 at 14:48
  • any idea how to start this in other terminals like Terminology or Terminator? – Nick Feb 02 '20 at 14:51
  • Since you do not have gnome-terminal, I presume you can use the other terminals (actually, the one that you are using regularly). I do not have these terminals installed, so I cannot help you further. But, you can easily make your own tests by first reading the relevant man page of your terminal. – FedKad Feb 03 '20 at 10:03
  • ok, thanks for your help. :) really appreciate it. – Nick Feb 03 '20 at 11:21
1
[Desktop Entry]

Name=Ranger

Exec=gnome-terminal -- ranger

Type=Application

works for me.

Credit: https://askubuntu.com/a/1183018/248158

DK Bose
  • 42,548
  • 23
  • 127
  • 221
  • sorry, this didn't work for me but the above answer worked. – Nick Feb 02 '20 at 14:02
  • well, but it looks very ugly and is not what I expected. so I am waiting on the other answer's owner to reply back on how to fix the ugliness. – Nick Feb 02 '20 at 14:09
  • if you could please see my reply to the first answer and tell me how to fix the ugliness, that would be really helpful. – Nick Feb 02 '20 at 14:17