You are not logged in.

#551 2010-10-09 12:34:56

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Ranger, a textbased filemanager

Jelly

Your works sounds really promising...cant wait to test out the results

thx for the effort!

Zeltak

Offline

#552 2010-10-09 13:40:03

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

Re: Ranger, a textbased filemanager

I appreciate your effort but I want to clarify that this was just a joke-screenshot.
And I don't know any way to display feh inside terminals. (This was mplayer actually)

hut wrote:

Does anybody want to implement this? smile
vNXF1ZA


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

Offline

#553 2010-10-09 19:52:23

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: Ranger, a textbased filemanager

hut wrote:

Why don't you write a script that converts large volumes of mail into a tree structure on the file system and use ranger to browse it?

Based on this idea, i've written a small python script, that creates a tree structure of your rss-feeds and uses ranger to browse them. It creates a directory for every news-feed and every entry in this feed is a html file. This file has a summary of the news as a comment (for readability in the preview) and when opened in a browser, it redirects the browser to the page of the news. There's still a lot to do but it is usable.
Since it can't remember, which news you have read you can give it the option to only show news that are younger than X hours. I can provide a PKGBUILD for it, if there's interest.

rssranger

201010092336351440x900s.th.png

Offline

#554 2010-10-09 20:27:01

zeltak
Member
From: New England
Registered: 2010-08-07
Posts: 168

Re: Ranger, a textbased filemanager

Hi again

i have two short related question that i guess im to stupid to figure out smile

first im trying to open some images in gimp as a new copy..the command that works in the CLI is gimp -a FILENAME. im issuing this:

:shell -d gimp -a %s

on selected file(s) but it always opens them as the original not a copy (disregarding the -a option)

what am i doing wrong?

also how does one preform a shell command on a bunch of file for example i usually issue this command in a folder of png's:

for i in *.svg; do inkscape -f "$i" -e "${i%%.svg*}.png" -w 128; done

whats the best way to create a ranger alias that issues that command on a bunch of files?

thx alot in advance

best

Zeltak


PS..although i am not a programmer i am more then wiling to help in other areas if needed since i really love ranger

Offline

#555 2010-10-09 20:43:50

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

Re: Ranger, a textbased filemanager

knopwob wrote:
hut wrote:

Why don't you write a script that converts large volumes of mail into a tree structure on the file system and use ranger to browse it?

Based on this idea, i've written a small python script, that creates a tree structure of your rss-feeds and uses ranger to browse them. It creates a directory for every news-feed and every entry in this feed is a html file. This file has a summary of the news as a comment (for readability in the preview) and when opened in a browser, it redirects the browser to the page of the news. There's still a lot to do but it is usable.
Since it can't remember, which news you have read you can give it the option to only show news that are younger than X hours. I can provide a PKGBUILD for it, if there's interest.

rssranger

201010092336351440x900s.th.png

Nice. The world definitely needs a universal "XYZ to files" converter so everything can be browsed with ranger (or your other favourite file browser).
Btw. You could use tags to differentiate between new and old news.


zeltak wrote:

:shell -d gimp -a %s

what am i doing wrong?

I dunno. Actually this works for me.

zeltak wrote:

for i in *.svg; do inkscape -f "$i" -e "${i%%.svg*}.png" -w 128; done

whats the best way to create a ranger alias that issues that command on a bunch of files?

Does this for-command work with ranger? If yes, just map it to a key:

map('x', fm.execute_console('shell -d for i in *.svg; do inkscape -f "$i" -e "${i%%.svg*}.png" -w 128; done'))

If not, there are lots of alternatives: convert the for statement to a find/grep/xargs chain, create a shell script and run it instead, write a command in python,...

zeltak wrote:

PS..although i am not a programmer i am more then wiling to help in other areas if needed since i really love ranger

Well, you could just share the ranger-related stuff that you come up with (ideas, hacks, tools, ...), perhaps in the mailing list to not flood the arch linux forum smile

EDIT:
To the guys who want colored previews:
Checkout the branch "cp+preview" instead, it supports loading previews in the background. "preview" is obsolete.
+ I experienced cases where ranger keeps loading previews forever. You can press ^C or wdd abort it. fixed

Last edited by hut (2010-10-10 05:59:36)


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

Offline

#556 2010-10-12 15:11:42

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

Re: Ranger, a textbased filemanager

The code for custom previews is in the ranger-git AUR package now.

A few screenshots:
screenshot0thumb.png screenshot2thumb.png

It requires two steps to get it to work:

1. Copy the preview script from ranger/data/scope.sh to ~/.config/ranger/scope.sh.
This is done automatically if you type

ranger --copy-config=scope

Go ahead and edit it to your likings.
If you got an older version, please use the new one since some bugs were fixed.

2. install the programs that generate the preview. They're all optional, get only the ones you want.

  • archives: atool

  • code: highlight

  • html: elinks or lynx

  • images: img2txt from caca-utils

  • pdf: pdftotext

  • audio: haven't found a decent music to text converter yet...

Of course you can edit scope.sh and add any other program.


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

Offline

#557 2010-10-12 17:18:58

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

Re: Ranger, a textbased filemanager

Nice! But it doesn't seem to work here... Without the scope.sh in ~/.config/ranger ranger crashes with the following error message, when I'm on a text file

% ranger
Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/pager.py", line 201, in _get_line
    return self.lines[n]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 86, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 194, in loop
    ui.redraw()
  File "/usr/lib/python3.1/site-packages/ranger/gui/ui.py", line 213, in redraw
    self.draw()
  File "/usr/lib/python3.1/site-packages/ranger/gui/ui.py", line 234, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.1/site-packages/ranger/gui/displayable.py", line 268, in draw
    displayable.draw()
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/browserview.py", line 101, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.1/site-packages/ranger/gui/displayable.py", line 268, in draw
    displayable.draw()
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/browsercolumn.py", line 139, in draw
    self._draw_file()
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/browsercolumn.py", line 168, in _draw_file
    Pager.draw(self)
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/pager.py", line 76, in draw
    for line, i in zip(line_gen, range(self.hei)):
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/pager.py", line 222, in _generate_lines
    line = self._get_line(i).expandtabs(4)
  File "/usr/lib/python3.1/site-packages/ranger/gui/widgets/pager.py", line 206, in _get_line
    if len(l) > self.max_width:
TypeError: unorderable types: int() > NoneType()

Ranger crashed.  Please report this (including the traceback) at:
http://savannah.nongnu.org/bugs/?group=ranger&func=additem

With the script in ~/.config/ranger there are no previews, ranger also doesn't show anything when I press F3. All I get is a "[Errno 13] Permission denied" when I'm on a file (filetype doesn't matter) The permissions of the config files are right

% pwd
/home/army/.config/ranger
% ls -la
total 44
drwxr-xr-x  2 army users  148 Oct 12 19:16 ./
drwxr-xr-x 16 army users 4096 Oct 11 22:47 ../
-rw-r--r--  1 army users 4604 Oct  6 10:47 apps.py
-rw-r--r--  1 army users 6181 Oct 12 19:07 apps.pyo
-rw-r--r--  1 army users   13 Oct 12 19:17 bookmarks
-rw-r--r--  1 army users    0 Oct 12 19:17 history
-rw-r--r--  1 army users   29 Apr 27 15:45 options.py
-rw-r--r--  1 army users  169 Oct 12 19:07 options.pyo
-rw-r--r--  1 army users 2147 Oct 12 19:09 scope.sh
-rw-r--r--  1 army users    0 Oct 12 19:07 tagged

Offline

#558 2010-10-12 18:11:47

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

Re: Ranger, a textbased filemanager

Ah. The first thing is a python3 issue, the second is that scope.sh needs execute permissions.
I fixed both, thank you for reporting
scope.sh is now automatically chmod u+x'ed when using --copy-config=scope. You'd still have to manually chmod it.

Last edited by hut (2010-10-12 18:18:22)


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

Offline

#559 2010-10-12 18:21:57

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

Re: Ranger, a textbased filemanager

Alright, works! Thanks! And this scope script is really nice, now it's very easy to implement "previews" for multimedia files using mediainfo. I'd suggest you put this into the script for audio and video files by default, because like you already said, there's no way to really preview sound or videos with texts.

Offline

#560 2010-10-12 18:55:49

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

Re: Ranger, a textbased filemanager

I should talk to a person capable of  synesthesia about whether it's feasable to arrange numbers and letters in a way that you can actually perceive the sound when looking at the preview.
For all the normal people I can add mediainfo too.


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

Offline

#561 2010-10-12 21:16:44

vasyabelkin
Member
Registered: 2009-09-10
Posts: 20

Re: Ranger, a textbased filemanager

I remember, some time ago I saw Ranger & thought to myself something in the line of "Who on Earth would want to use something strange like this? I'm not such a geek to even try". Wow, hut, I was so wrong. My curiosity & search for customizable file manager ( like Total Commander in Win' smile ) drove me to install it. Thank you, Ranger is unusual for me, for sure, but mind-blowing

Offline

#562 2010-10-12 21:47:24

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

Re: Ranger, a textbased filemanager

This is really cool, I changed the line for images to

jhead "$path" | head -n $maxln && img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;

Nice!
I'd like to try tiv (in xyne's repo) instead of img2txt, but somehow that doesn't work. Does anybody know how to do it? I tried

tiv -w "$width" "$path" && exit 4 || exit 1;;

and don't know why that doesn't work.

Offline

#563 2010-10-12 22:08:38

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

Re: Ranger, a textbased filemanager

It seems like tiv is using ansi escape codes that ranger doesn't handle.

It works if you use scope.sh standalone, right?

~/.config/ranger/scope.sh some_image.jpg $COLUMNS $ROWS

Last edited by hut (2010-10-12 22:10:13)


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

Offline

#564 2010-10-12 23:06:13

vasyabelkin
Member
Registered: 2009-09-10
Posts: 20

Re: Ranger, a textbased filemanager

hut, I' ve found the following exception, that is printed as is w/o any additional trace info:

close failed in file object destructor:
Error in sys.excepthook:

Original exception was:

Steps to reproduce: Ctrl+S to suspend the urxvt/xterm output while in Ranger, than try to kill it (I've yet found a way to describe it better, but I use "kill client" command in Awesome WM [Mod+Ctrl+C in default config], when "kill -9" does nothing & "kill -15" really kills it immediately). Than I got the message "Type Q or :quit<Enter> to exit Ranger", typed "Q" and got the exception.
Ranger version: 1.3.1 testing (latest from git, like 3 hours before)

Last edited by vasyabelkin (2010-10-12 23:10:14)

Offline

#565 2010-10-12 23:20:42

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

Re: Ranger, a textbased filemanager

What python version?
Do you get more information if you start ranger with the --debug option?

Btw. I can't reproduce it. If i suspend (^S) and kill it, it's dead without giving any error message. I use urxvt and awesome too.

Last edited by hut (2010-10-12 23:24:02)


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

Offline

#566 2010-10-13 08:40:11

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

Re: Ranger, a textbased filemanager

hut wrote:

It seems like tiv is using ansi escape codes that ranger doesn't handle.

It works if you use scope.sh standalone, right?

~/.config/ranger/scope.sh some_image.jpg $COLUMNS $ROWS

Yes it does. But it seams like there's no way to use it in ranger, right? Or do you know some kind of workaround?

Offline

#567 2010-10-13 11:56:23

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

Re: Ranger, a textbased filemanager

I dunno, wanna try to patch it? I can't find any documentation on those ansi codes anyway. (pipe the output of tiv into a file to see them)


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

Offline

#568 2010-10-13 12:19:38

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

Re: Ranger, a textbased filemanager

I'm far from being capable for this. But I was rethinking this, in fact img2txt is MUCH faster than tiv, so for this purpose I think it actually suits better.

Last edited by Army (2010-10-13 12:29:59)

Offline

#569 2010-10-13 20:37:00

vasyabelkin
Member
Registered: 2009-09-10
Posts: 20

Re: Ranger, a textbased filemanager

hut wrote:

What python version?

2.6.5
Once again I've updated the ranger-git from aur an hour ago, renamed .config/ranger directory to run with defaults, used both "source /usr/bin/ranger /usr/bin/ranger" and "/usr/bin/ranger"

vasya@vahost ~ % which ranger
ranger: aliased to source /usr/bin/ranger /usr/bin/ranger
vasya@vahost ~/.config % ranger
close failed in file object destructor:
Error in sys.excepthook:

Original exception was:
vasya@vahost ~/.config % /usr/bin/ranger
close failed in file object destructor:
Error in sys.excepthook:

Original exception was:
vasya@vahost ~/.config % /usr/bin/ranger -d
close failed in file object destructor:
Error in sys.excepthook:

Original exception was:
vasya@vahost ~/.config %

The only difference in debug mode is that I don't get the message "Type Q or :quit..." & ranger just quits immediately with the same exception. 100% reproducible on my machine (Arch 64b with latest updates to all the software, no testing packages) when I try to kill it with Mod+Ctrl+C in Awesome 3.4.8 with almost default config. Note that it does not happen, if I resume scrolling with Ctrl+Q

Offline

#570 2010-10-14 02:39:35

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: Ranger, a textbased filemanager

Two questions,

(1) I want to use Alt + left and right arrow keys to move between tabs. How do I do this? (I assume the changes are added to a copy of keys.py.)

(2) Is it safe to run multiple instances of ranger at once? (No corrupted history, bookmarks, tagged?)

Thank you.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#571 2010-10-14 03:40:07

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Ranger, a textbased filemanager

@hut -- two small typos in scope.sh:
1. change 'fpdftotext' to 'pdftotext' on line 44
2. change --ansi to --out-format=ansi on line 56

Cool extension! Though the img2txt is so low-res on my laptop as to be unrecognizable. I'd like to see it on a big monitor, though!

Scott

Offline

#572 2010-10-14 13:37:45

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

Re: Ranger, a textbased filemanager

vasyabelkin wrote:

Once again I've updated the ranger-git from aur an hour ago, renamed .config/ranger directory to run with defaults, used both "source /usr/bin/ranger /usr/bin/ranger" and "/usr/bin/ranger"

Let's continue the discussion of this matter here: https://savannah.nongnu.org/bugs/?31328

Army wrote:

I'm far from being capable for this. But I was rethinking this, in fact img2txt is MUCH faster than tiv, so for this purpose I think it actually suits better.

At some point I'll need to add those 256-color codes anyway so stay tuned

fsckd wrote:

(1) I want to use Alt + left and right arrow keys to move between tabs. How do I do this? (I assume the changes are added to a copy of keys.py.)

In fact, I didn't think of that. At the moment, only alt+letters/numbers are recognized. I'm going to patch this soon.
If you don't know how to edit keybindings at all, try ranger --copy-config=keys and take a look at the ~/.config/ranger/keys.py file.

EDIT: It's patched. And alt+arrow keys now change tabs too.

fsckd wrote:

(2) Is it safe to run multiple instances of ranger at once? (No corrupted history, bookmarks, tagged?)

No problems. There's a differend degree of synchronization though. Bookmarks are synchronized immediately between all ranger instances. tags are updated once you do a tag operation (press t) and the history is synchronized on a restart.

firecat53 wrote:

1. change 'fpdftotext' to 'pdftotext' on line 44

done

firecat53 wrote:

2. change --ansi to --out-format=ansi on line 56

It's both the same for me yikes?

firecat53 wrote:

Cool extension! Though the img2txt is so low-res on my laptop as to be unrecognizable. I'd like to see it on a big monitor, though!

Since this extension makes ranger consume more resources, I tend to turn it off most of the time though. But it's cool in times I really need a preview. E.g. pressing i on archives and scrolling through its contents removes the need to pressing Enter on them.

Last edited by hut (2010-10-14 14:35:06)


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

Offline

#573 2010-10-16 12:39:30

hurleyef
Member
Registered: 2010-06-22
Posts: 72

Re: Ranger, a textbased filemanager

Awesomeness, thanks for the excellent file manager.  smile

Only issue I have is that it sometimes freezes while loading previews for large files, especially pdfs.

Offline

#574 2010-10-16 20:28:58

archman-cro
Member
From: Croatia
Registered: 2010-04-04
Posts: 943
Website

Re: Ranger, a textbased filemanager

Is anyone getting this error when cutting folders and files:

bad operand type for unary +: 'list'

What might be the problem?

Offline

#575 2010-10-17 04:58:18

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

Re: Ranger, a textbased filemanager

archman-cro wrote:

Is anyone getting this error when cutting folders and files:

bad operand type for unary +: 'list'

What might be the problem?

I think that was fixed a while ago, try upgrading.
If this doesn't help, you can turn the "neutral hut" into a "happy hut" by allowing me to see the traceback. (ranger --debug)

In IRC you asked me if you can use UTF chars for input and I couldn't answer.
Apparently that works only with python2.6, and you gotta add this line at the top of your keys.py if it's not already there:

# -*- coding: utf-8 -*-

If you wanna install ranger with python2.6, edit the PKGBUILD, it gives you some hints.


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

Offline

Board footer

Powered by FluxBB