You are not logged in.

#1426 2012-08-09 00:57:51

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Ranger, a textbased filemanager

Is this a bug, then?  I'm using ranger from the repos (1.5.4 I believe) and libreoffice also from the repos.  After a little testing, I've found that libreoffce BASE (the database one) specifically doesn't detach properly (Writer does detach properly though).  I've added

if f.extension == 'odb':
    c.flags += 'd'
    return self.either(c, 'libreoffice')

to apps.py, but it still doesn't seem to work.

EDIT: I'm using terminal (xfce, from repos) as my emulator.  I find that starting ranger with

terminal -x ranger

causes libreoffice base to not detach properly, whereas starting ranger from inside terminal allows base to detach properly.  Should I attach some logs or something?

Offline

#1427 2012-08-09 01:23:39

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

did you try setsid?

c.flags += "d"
return "setsid", "libreoffice", c

"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1428 2012-08-09 05:11:15

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Ranger, a textbased filemanager

hut wrote:

did you try setsid?

c.flags += "d"
return "setsid", "libreoffice", c

That works, but I'm more worried of it being a kludgy workaround.  I shouldn't have to explicitly call setsid when 'd' flag should do that itself.  Should I file a bug or is this a "feature"?  (And why does it work when I start ranger in terminal as opposed to terminal -x ranger (and why does it onlyg affect libreoffice base and possibly gimp?))

Offline

#1429 2012-08-09 10:14:39

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Hi hut, latest ranger-git crashes with the following output

% ranger
ranger version: 1.5.4, executed with python 3.2.3
Locale: en_US.UTF-8
Current file: None
Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 115, in main
    fm.initialize()
  File "/usr/lib/python3.2/site-packages/ranger/core/fm.py", line 114, in initialize
    self.ui.initialize()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 87, in initialize
    self.setup()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 225, in setup
    self.browser = BrowserView(self.win, self.settings.column_ratios)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 33, in __init__
    self.change_ratios(ratios)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 76, in change_ratios
    self.resize(self.y, self.x, self.hei, self.wid)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 274, in resize
    self.columns[i].resize(pad, left - 1, hei - pad * 2, 1)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browsercolumn.py", line 46, in resize
    Widget.resize(self, y, x, hei, wid)
  File "/usr/lib/python3.2/site-packages/ranger/gui/displayable.py", line 156, in resize
    raise ValueError("Starting point below zero!")
ValueError: Starting point below zero!

Offline

#1430 2012-08-09 11:32:55

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

darkfeline wrote:
hut wrote:

did you try setsid?

c.flags += "d"
return "setsid", "libreoffice", c

That works, but I'm more worried of it being a kludgy workaround.  I shouldn't have to explicitly call setsid when 'd' flag should do that itself.  Should I file a bug or is this a "feature"?

I don't really want to mess with the implementation of flags in 1.5.4 anymore. As mentioned, the file opening system was overhauled in ranger-git, and 1.6 will come out soon-ish, so I don't want to invest time into coding and testing for a legacy version. But I will add the setsid workaround to apps.py entries of the affected programs, since apparently it works and has no negative side effects.

darkfeline wrote:

(And why does it work when I start ranger in terminal as opposed to terminal -x ranger (and why does it onlyg affect libreoffice base and possibly gimp?))

It has to do with the way ranger is killed, though I don't know the details myself.


Army wrote:

Hi hut, latest ranger-git crashes with the following output

% ranger
ranger version: 1.5.4, executed with python 3.2.3
Locale: en_US.UTF-8
Current file: None
Traceback (most recent call last):
  File "/usr/lib/python3.2/site-packages/ranger/core/main.py", line 115, in main
    fm.initialize()
  File "/usr/lib/python3.2/site-packages/ranger/core/fm.py", line 114, in initialize
    self.ui.initialize()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 87, in initialize
    self.setup()
  File "/usr/lib/python3.2/site-packages/ranger/gui/ui.py", line 225, in setup
    self.browser = BrowserView(self.win, self.settings.column_ratios)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 33, in __init__
    self.change_ratios(ratios)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 76, in change_ratios
    self.resize(self.y, self.x, self.hei, self.wid)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browserview.py", line 274, in resize
    self.columns[i].resize(pad, left - 1, hei - pad * 2, 1)
  File "/usr/lib/python3.2/site-packages/ranger/gui/widgets/browsercolumn.py", line 46, in resize
    Widget.resize(self, y, x, hei, wid)
  File "/usr/lib/python3.2/site-packages/ranger/gui/displayable.py", line 156, in resize
    raise ValueError("Starting point below zero!")
ValueError: Starting point below zero!

Not for me. When does this happen? Under which conditions?

EDIT:
can you message me in IRC so we can work this out?

Last edited by hut (2012-08-09 11:44:14)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1431 2012-08-09 12:01:58

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

Ok, with an empty ~/.config/ranger it works. I'll investigate what causes this. The last working version I used was ranger-git-20120803-1-any.pkg.tar.xz

edit: Okay, it was caused by my custom options.py. In it, I have

padding_right = False

With this option, ranger crashes, without (or set to True) it works.

Can you confirm this?

Here's the whole options.py

preview_files = False
mouse_enabled = False
padding_right = False

Last edited by Army (2012-08-09 12:12:55)

Offline

#1432 2012-08-09 12:32:25

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

Army wrote:

Ok, with an empty ~/.config/ranger it works. I'll investigate what causes this. The last working version I used was ranger-git-20120803-1-any.pkg.tar.xz

edit: Okay, it was caused by my custom options.py. In it, I have

padding_right = False

With this option, ranger crashes, without (or set to True) it works.

Can you confirm this?

Here's the whole options.py

preview_files = False
mouse_enabled = False
padding_right = False

Yes, that was it. I pushed a fix, thank you.

EDIT: I had to add something to the fix. If it doesn't work yet, try pulling again.

Last edited by hut (2012-08-09 12:42:33)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1433 2012-08-09 12:42:56

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: Ranger, a textbased filemanager

confirmed smile thanks!

Offline

#1434 2012-08-09 12:47:54

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

darkfeline wrote:
hut wrote:

did you try setsid?

c.flags += "d"
return "setsid", "libreoffice", c

That works, but I'm more worried of it being a kludgy workaround.  I shouldn't have to explicitly call setsid when 'd' flag should do that itself.  Should I file a bug or is this a "feature"?  (And why does it work when I start ranger in terminal as opposed to terminal -x ranger (and why does it onlyg affect libreoffice base and possibly gimp?))

For me, it actually happens with every program.
If I run urxvt, start ranger, open a program with d-flag, then kill the urxvt with my window manager (dwm too), the program that was launched by ranger dies too, no matter which one.
Since for you this happens only with libreoffice and gimp, maybe I misunderstood you? Can you describe exactly what you do and what happens?

And by the way, this can be avoided by closing ranger gently with Q.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1435 2012-08-09 19:45:14

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Ranger, a textbased filemanager

Here's my apps.py: http://pastebin.com/PdyxUMFd

Using terminal -x ranger, writer detachs properly, but base doesn't.

When I start terminal and run ranger, if I close gently (with q), both writer and base detach properly, but if I close forcefully (Meta-Shift-C in dwm), only writer detaches properly.

It seems that certain programs detach (fork) when they're run, while others ranger only cedes control if it's closed naturally, so if you force close it, it doesn't detach properly.  I haven't yet tested which programs do which, except that the writer portion of libreoffice forks properly and base doesn't.

Offline

#1436 2012-08-09 20:42:01

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

Ok, I patched it on the stable branch of ranger. Can you test it and see if everything works?

git clone https://github.com/hut/ranger.git -b stable

"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1437 2012-08-09 23:39:47

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Ranger, a textbased filemanager

Yes, it indeed works now.  I took a peek at your fix; very good sir!  Will this change be merged into master branch/ranger-git on AUR?

Offline

#1438 2012-08-10 00:05:50

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

darkfeline wrote:

Yes, it indeed works now.  I took a peek at your fix; very good sir!  Will this change be merged into master branch/ranger-git on AUR?

Good. It will be merged in ranger-git too, though file opening already works properly there since apps.py was replaced with the rifle file opener.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1439 2012-08-10 08:02:06

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Ranger, a textbased filemanager

Sorry, one last thing.  Can you add .odb to the new rifle.py?  It's the OpenOffice database extension.

ext od[btspfg]|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"

Offline

#1440 2012-08-10 10:15:37

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

darkfeline wrote:

Sorry, one last thing.  Can you add .odb to the new rifle.py?  It's the OpenOffice database extension.

ext od[btspfg]|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"

done smile


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1441 2012-08-15 02:34:59

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

TheLemonMan wrote:
starstuff wrote:

btw, why is your owl have only one foot?

It's a Hoothoot, never played Pokémon Silver/Gold ? tongue
Anyway, yesterday I copied an huge amount of data between disks and it was painful not having an indication of the progress.
I'd say to use rsync or cp with -v switch and parsing the output to be shown in the task window, maybe as a progressbar.

I dug up some old code from v1.2.3 where ranger had its own implementation of copying/moving. It turned out to be rather simple to add progressbar support to that implementation, though it has some drawbacks too. [see https://github.com/hut/ranger/commit/19 … 84bbd2e3b1]

There is a progressbar at the bottom which displays an average of all the progress bars of the currently running tasks, you can view individual progressbars and tasks in the task view (press w). In the task view you can move (j/k), reassign priorities (J/K) and kill tasks (dd). Only one task will run at a time.

There is also a new option:

# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
draw_progress_bar_in_status_bar = True

EDIT: I should mention that you (if you use ranger-git anyway) should be extra careful and confirm yourself that after the upgrade, copying and moving works as expected on your machine before you copy/move around important files, since it is not thoroughly tested yet.

Last edited by hut (2012-08-15 02:38:42)


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1442 2012-08-16 08:20:18

lkraav
Member
Registered: 2011-04-08
Posts: 36

Re: Ranger, a textbased filemanager

sup all

any thoughts on how to open a directory with ranger from an external application? for example if you right click on an item in firefox download list and select "Open containing directory", what would be a sensible approach to give it something. i think some sort of a launcher strategy (perhaps a script? but even if it's just instructions) should be bundled with ranger, instead of everyone figuring out their own approach i.e. "urxvt -e ranger" or something. perhaps i'm wrong here, please let me know about that too.

Offline

#1443 2012-08-16 11:02:12

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

lkraav wrote:

sup all

any thoughts on how to open a directory with ranger from an external application? for example if you right click on an item in firefox download list and select "Open containing directory", what would be a sensible approach to give it something. i think some sort of a launcher strategy (perhaps a script? but even if it's just instructions) should be bundled with ranger, instead of everyone figuring out their own approach i.e. "urxvt -e ranger" or something. perhaps i'm wrong here, please let me know about that too.

plain and simple `urxvt -e ranger "$path"` should work.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1444 2012-08-16 20:07:46

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Ranger, a textbased filemanager

hut, I just wanted to say I love ranger!  I installed it a few days ago out of curiosity, and I haven't used a GUI file manager at all since then.  It's easy to use and configure, and I love that I can write my own commands for it.  Keep up the good work!

Offline

#1445 2012-08-17 11:55:09

PotatoesMaster
Member
From: France
Registered: 2010-08-26
Posts: 54

Re: Ranger, a textbased filemanager

@hut:
I wonder if changing mimetypes checking (using the file command instead of python mimetype library, this commit) was a good thing.

In most case, the file command seems to analyze the file content to guess its type, without caring about its extension.
From my experience, it guesses badly quite frequently: mp3 and mkv recognized as 'applications/octet-stream', html files as 'text/x-python' (or other languages), wma (audio) as 'video/x-ms-asf', xbm (image) as text/plain…

Until now, I followed this procedure to customize file associations in ranger:

  1. For each "unknown" file extension, add a line in ~/.mime.types (something like 'image/x-tga tga' or 'audio/x-gbs gbs').

  2. Restart ranger.

  3. The file was colored depending on its type (like other pictures or audio files) and the mimetype detected by rifle was the one just defined above.

  4. Rifle.conf did not need editing in some cases (e.g.: for 'image/tga', feh was already defined for images).

Now, the file command is used by rifle to find the mime type. The rules in /etc/mime.types and ~/.mime.types are useful only for filename coloring in ranger.
So, it is preferable to have extension based rules in rifle.conf and to keep mime type based ones as a fallback.

As a recap:

  • file command pros:

    • behavior consistent across multiple systems and distributions

  • python mimetype library pros:

    • mimetype detection based on extensions (file content as fallback) → IMO a saner behaviour

    • allows custom mimetypes in ~/.mime.types

Offline

#1446 2012-08-20 20:26:56

hut
Member
From: Hanover, Germany
Registered: 2010-03-12
Posts: 561
Website

Re: Ranger, a textbased filemanager

PotatoesMaster wrote:

@hut:
I wonder if changing mimetypes checking (using the file command instead of python mimetype library, this commit) was a good thing.

In most case, the file command seems to analyze the file content to guess its type, without caring about its extension.
From my experience, it guesses badly quite frequently: mp3 and mkv recognized as 'applications/octet-stream', html files as 'text/x-python' (or other languages), wma (audio) as 'video/x-ms-asf', xbm (image) as text/plain…

Until now, I followed this procedure to customize file associations in ranger:

  1. For each "unknown" file extension, add a line in ~/.mime.types (something like 'image/x-tga tga' or 'audio/x-gbs gbs').

  2. Restart ranger.

  3. The file was colored depending on its type (like other pictures or audio files) and the mimetype detected by rifle was the one just defined above.

  4. Rifle.conf did not need editing in some cases (e.g.: for 'image/tga', feh was already defined for images).

Now, the file command is used by rifle to find the mime type. The rules in /etc/mime.types and ~/.mime.types are useful only for filename coloring in ranger.
So, it is preferable to have extension based rules in rifle.conf and to keep mime type based ones as a fallback.

As a recap:

  • file command pros:

    • behavior consistent across multiple systems and distributions

  • python mimetype library pros:

    • mimetype detection based on extensions (file content as fallback) → IMO a saner behaviour

    • allows custom mimetypes in ~/.mime.types

Yeah, I'm not happy how it turned out either. I guess `file` is not as awesome as I thought. I added mimetypes module again and `file` as a fallback.


"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users

Offline

#1447 2012-08-24 21:36:37

barkbombardier
Member
Registered: 2012-08-24
Posts: 9

Re: Ranger, a textbased filemanager

"SOLVED"
Hello all
I'm running crunchbang unstable,you guys over here are very much into ranger. And I have used the wiki here,I'm thinking I can get a little help so here it goes. I have just upgraded a new install from stable to sid. I always have ranger file-manager and nvlc open,divided up from the same terminator window. On my old machine,I could select a audio/video file in ranger and it would play in the already open window of nvlc. This time it will not,it will either ignore the already open nvlc window and open the vlc gtk interface or play the file from the backround aka no interface.

Is there something I can do to get this back,it was so nice and convenient to have it work that way? From what I can remember it did this automatically the last time.
Thanks for any help,hope this is understandable took me a minute to write it out so I did.

Not sure how to mark this as solved but it is. It had to do with vlc needing to be set to only one instance.
thanks

Last edited by barkbombardier (2012-08-25 01:36:08)

Offline

#1448 2012-08-31 15:51:09

ibrunton
Member
From: Canada
Registered: 2011-05-05
Posts: 270

Re: Ranger, a textbased filemanager

How do I configure apps.py to have ranger open ONLY the currently selected image in sxiv?  I.e., rather than whatever it does now so that (e.g.,) clicking on the sxiv window changes to the next image in the list.

Last edited by ibrunton (2012-08-31 15:52:37)

Offline

#1449 2012-09-02 14:03:29

anekos
Member
Registered: 2012-07-09
Posts: 3

Re: Ranger, a textbased filemanager

How to make "mkdir and select_file" command?

I wrote the below code, but it does not works well.
https://gist.github.com/57f944441aac480feea6

self.fm.select_file(dirname) does not work on this code.
Immediately after mkdir, <dirname> does not exist on ranger...

Offline

#1450 2012-09-03 10:32:33

Veedrac
Member
Registered: 2011-07-19
Posts: 81

Re: Ranger, a textbased filemanager

anekos wrote:

How to make "mkdir and select_file" command?

I wrote the below code, but it does not works well.
https://gist.github.com/57f944441aac480feea6

self.fm.select_file(dirname) does not work on this code.
Immediately after mkdir, <dirname> does not exist on ranger...

I was hoping for a nicer solution, but there seems to be no way to force loading a directory now, so here's my solution.
It's very badly tested, but it seems to work OK.

class mkseldir(Command):
  """
  :mkseldir <dirname>

  Creates a directory with the name <dirname>, and select it.
  """

  def execute(self):
    from os.path import join, expanduser, lexists
    dirname = join(self.fm.thisdir.path, expanduser(self.rest(1)))
    if not lexists(dirname):
      self.fm.mkdir(dirname)
      item = ranger.fsobject.directory.Directory(dirname, path_is_abs=True)
      item.load()
      self.fm.thisdir.files.append(item)
      self.fm.select_file(dirname)
    else:
      self.fm.notify("file/directory exists!", bad=True)

Anyway, the idea is to reload the directory after you've changed it. However, that don' work. Thus, I just manually add the new directory to the Ranger. If making the directory fails, this might crash or summin', tho.

Last edited by Veedrac (2012-09-03 10:34:22)

Offline

Board footer

Powered by FluxBB