You are not logged in.

#651 2010-11-09 06:32:02

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Ranger, a textbased filemanager

hut wrote:
ngoonee wrote:

Sorry, hut, I must be blind, but I can't see anything referring mimeopen in apps.py. Also, ranger --copy-config doesn't exist smile.

Okay, you didn't tell me what version you use so I just guessed smile

Then just add this at the bottom of the function:

return tup("xdg-open", *c)

Sorry hut, I really feel stupid, but it doesn't seem to 'work'. I tried with ranger (wouldn't even start), so upgraded to ranger-git, after line 188 I added this:-

    def app_mimeopen(self, c):
        if c.mode is 0:
            return tup("xdg-open", *c)
        if c.mode is 1: 
            # Will ask user to select program
            # aka "Open with..."
            return tup("xdg-open", "--ask", *c)

Doesn't seem to work though, pressing 'Enter' still goes to command mode with :open_with


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#652 2010-11-09 14:02:27

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

Re: Ranger, a textbased filemanager

killua wrote:

Ranger rocks!  Thanks for your great job,hut ^_^ Ranger is the only one file manager i have installed.
Just one question: is it possible to map key to do combined actions,for example,can i map J to firstly move down and then enter ? ( J = j+l )

Yep, but it's a bit tricky. You need to define your own function, basically. Either anonymous (like the "um<bg>" mapping) or named (like the "gn" mapping) functions. Take a look at those mappings and adapt them to your needs.

Edit: try something like this:

@map("x")
def downright(arg):
    arg.fm.move(down=1)
    arg.fm.move(right=1)
ngoonee wrote:
hut wrote:
ngoonee wrote:

Sorry, hut, I must be blind, but I can't see anything referring mimeopen in apps.py. Also, ranger --copy-config doesn't exist smile.

Okay, you didn't tell me what version you use so I just guessed smile

Then just add this at the bottom of the function:

return tup("xdg-open", *c)

Sorry hut, I really feel stupid, but it doesn't seem to 'work'. I tried with ranger (wouldn't even start), so upgraded to ranger-git, after line 188 I added this:-

    def app_mimeopen(self, c):
        if c.mode is 0:
            return tup("xdg-open", *c)
        if c.mode is 1: 
            # Will ask user to select program
            # aka "Open with..."
            return tup("xdg-open", "--ask", *c)

Doesn't seem to work though, pressing 'Enter' still goes to command mode with :open_with

This is weird. Make sure that the configuration is at the right place ($XDG_CONFIG_HOME/ranger/apps.py or ~/.config/ranger/apps.py overrides /path/to/ranger/defaults/apps.py), test the custom application definition by typing :open_with mimeopen, remove the @depends_on('mimeopen') line above the function if it's still there (because ranger won't run it if the dependencies are not installed.)

Last edited by hut (2010-11-09 14:08:06)


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

Offline

#653 2010-11-09 15:49:14

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: Ranger, a textbased filemanager

hut wrote:
ngoonee wrote:
hut wrote:

Okay, you didn't tell me what version you use so I just guessed smile

Then just add this at the bottom of the function:

return tup("xdg-open", *c)

Sorry hut, I really feel stupid, but it doesn't seem to 'work'. I tried with ranger (wouldn't even start), so upgraded to ranger-git, after line 188 I added this:-

    def app_mimeopen(self, c):
        if c.mode is 0:
            return tup("xdg-open", *c)
        if c.mode is 1: 
            # Will ask user to select program
            # aka "Open with..."
            return tup("xdg-open", "--ask", *c)

Doesn't seem to work though, pressing 'Enter' still goes to command mode with :open_with

This is weird. Make sure that the configuration is at the right place ($XDG_CONFIG_HOME/ranger/apps.py or ~/.config/ranger/apps.py overrides /path/to/ranger/defaults/apps.py), test the custom application definition by typing :open_with mimeopen, remove the @depends_on('mimeopen') line above the function if it's still there (because ranger won't run it if the dependencies are not installed.)

Yes, removing that line makes things work. Thanks much smile. Why would it not, in the first place?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#654 2010-11-09 16:06:14

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

Re: Ranger, a textbased filemanager

Thats rangers way to figoure out what program to use. In app_default there are lots of self.either(...) calls which look for the first installed application in the given list. And how is ranger supposed to know if a program is installed? By passing along a list of dependencies with @depends_on()


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

Offline

#655 2010-11-13 13:48:03

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

Re: Ranger, a textbased filemanager

Army wrote:

Hi Hut, I have some new stuff for you to fix big_smile

I wanted to rename a file. The new name included a german umlaut (äöü), but ranger doesn't do this right. I think I remember that it used to work. Could you please fix that?


Fixed! big_smile
It still has problems with wide chars, like, the cursor is displayed at the wrong place, but it's usable.


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

Offline

#656 2010-11-13 14:24:39

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Ranger, a textbased filemanager

Hut, when i rename directories, sometimes a trailing / is appended to the folder name when i press I or A, but not always. Any idea why this is?


ᶘ ᵒᴥᵒᶅ

Offline

#657 2010-11-13 14:32:39

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

Re: Ranger, a textbased filemanager

litemotiv wrote:

Hut, when i rename directories, sometimes a trailing / is appended to the folder name when i press I or A, but not always. Any idea why this is?

No idea, never seen this...
Is this effect dependent on the directory name?
What python version + ranger version?


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

Offline

#658 2010-11-14 20:37:50

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

Re: Ranger, a textbased filemanager

hut wrote:
Army wrote:

Hi Hut, I have some new stuff for you to fix big_smile

I wanted to rename a file. The new name included a german umlaut (äöü), but ranger doesn't do this right. I think I remember that it used to work. Could you please fix that?


Fixed! big_smile
It still has problems with wide chars, like, the cursor is displayed at the wrong place, but it's usable.

Okay, works smile It's usable, yes. The only thing that keeps me from switching to python3 is, that with python3 ranger doesn't update the terminal's title. I like that feature, I don't really need it, but ... I like it wink

Offline

#659 2010-11-15 02:14:06

vanvalium
Member
From: Austria
Registered: 2010-10-09
Posts: 86

Re: Ranger, a textbased filemanager

nice fm, overall I still prefer using the shell for most things but it's very useful for copying and sorting large collections
I haven't tried it out, but would it be possible to copy in one ranger instance and pasting it in another?

Offline

#660 2010-11-16 02:29:10

phaedrus
Member
From: Wellington, New Zealand
Registered: 2010-06-18
Posts: 20

Re: Ranger, a textbased filemanager

thanks hut! am loving this fm, while i still use the shell for most things ranger now autostarts fullscreen on my media pc and is proving to be an excellent file manager for my needs smile

Offline

#661 2010-11-16 06:37:49

Sirsurthur
Member
Registered: 2009-02-02
Posts: 124

Re: Ranger, a textbased filemanager

Hello hut,

Not sure it is normal but if I delete a file/folder in a shell and if I was at the same time on this file/folder in ranger then ranger crash with the following output :

Traceback (most recent call last):
  File "/usr/lib/python3.1/site-packages/ranger/core/main.py", line 85, in main
    fm.loop()
  File "/usr/lib/python3.1/site-packages/ranger/core/fm.py", line 198, 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/statusbar.py", line 83, in draw
    ctime = self.env.cf.stat.st_ctime
AttributeError: 'NoneType' object has no attribute 'st_ctime'

Sirsurthur

Offline

#662 2010-11-16 08:16:47

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Ranger, a textbased filemanager

hut wrote:
litemotiv wrote:

Hut, when i rename directories, sometimes a trailing / is appended to the folder name when i press I or A, but not always. Any idea why this is?

No idea, never seen this...
Is this effect dependent on the directory name?
What python version + ranger version?

I'm not sure, i can't reproduce it structurally.. It's been like this since i started using ranger, so it doesn't seem version dependent. I'll have a lookout if python3 behaves differently in this regard.


ᶘ ᵒᴥᵒᶅ

Offline

#663 2010-11-16 08:18:12

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: Ranger, a textbased filemanager

litemotiv wrote:
hut wrote:
litemotiv wrote:

Hut, when i rename directories, sometimes a trailing / is appended to the folder name when i press I or A, but not always. Any idea why this is?

No idea, never seen this...
Is this effect dependent on the directory name?
What python version + ranger version?

I'm not sure, i can't reproduce it structurally.. It's been like this since i started using ranger, so it doesn't seem ranger-version dependent. I'll have a lookout if python3 behaves differently in this regard.

Last edited by litemotiv (2010-11-16 19:05:09)


ᶘ ᵒᴥᵒᶅ

Offline

#664 2010-11-16 18:35:15

groundnuty
Member
Registered: 2010-11-16
Posts: 17

Re: Ranger, a textbased filemanager

Hey,
I just wanted to share something I coded for myself.

http://pastie.org/1303121

I added custom preview to work with extended files attributes.
Atm there is :tagmode (it toogles the mode) command that changes the small preview on the right side to output extended file attributes of selected file.

There is support for tagging:
- alt-insert, tag selected file with "iLike" tag
- alt-del, delete "iLike" tag

It is mainly coded as a "proof of concept" and depends on too many internals of FM class. Nethertheless I've been using it for a month now and its working like a charm with ranger-git in AUR.

By using mocp (in deamon mode) to play music files I can use ranger as comfortable music-tagger.

Thx for writing ranger!

Last edited by groundnuty (2010-11-16 18:40:58)

Offline

#665 2010-11-17 01:15:25

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

Re: Ranger, a textbased filemanager

vanvalium wrote:

nice fm, overall I still prefer using the shell for most things but it's very useful for copying and sorting large collections
I haven't tried it out, but would it be possible to copy in one ranger instance and pasting it in another?

Yep, try the commands :save_copy_buffer and :load_copy_buffer, which save/load the list of copied files, allowing to transfer it between ranger instances.

Sirsurthur wrote:

Not sure it is normal but if I delete a file/folder in a shell and if I was at the same time on this file/folder in ranger then ranger crash with the following output :

Yes, that's normal, ranger doesn't like it if you pull away the ground below its feet
Edit: Fixed

groundnuty wrote:

Hey,
[...]
It is mainly coded as a "proof of concept" and depends on too many internals of FM class. Nethertheless I've been using it for a month now and its working like a charm with ranger-git in AUR.

Cool. And sorry for not providing some "official" interface. It's planned. The devel version even has a plugin system, but I have no time to finish it... Also, calling fm.reset() just to reload the preview looks kind of brutal, it definitely needs an own command/function/key
Edit: The newest version has: self.fm.update_preview(self.fm.env.cf.path)

Last edited by hut (2010-11-17 19:17:40)


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

Offline

#666 2010-11-17 01:18:29

vanvalium
Member
From: Austria
Registered: 2010-10-09
Posts: 86

Re: Ranger, a textbased filemanager

hut wrote:
vanvalium wrote:

nice fm, overall I still prefer using the shell for most things but it's very useful for copying and sorting large collections
I haven't tried it out, but would it be possible to copy in one ranger instance and pasting it in another?

Yep, try the commands :save_copy_buffer and :load_copy_buffer, which save/load the list of copied files, allowing to transfer it between ranger instances.

thanks, nice to know

Offline

#667 2010-11-17 04:31:25

killua
Member
Registered: 2010-04-12
Posts: 8

Re: Ranger, a textbased filemanager

hi hut, is it possible to paste soft symbol link in ranger? or can you add this feature?

Offline

#668 2010-11-17 10:24:19

golwin
Member
From: Germany, Aachen
Registered: 2009-03-12
Posts: 35

Re: Ranger, a textbased filemanager

I think I just came across a tiny bug.
Scenario: I have three open tabs. The path in tab 1 is very short, so everything can be displayed in the top bar. In tab 2 and 3 the path is longer, so the three tab names get pushed to the right side. Now if I want to select a tab by clicking on it's title, I have to click at the position it would have had when displayed in tab 1 (where everything could be displayed) and not it's shifted position in tab 2 or 3, that I currently see. So being in tab 3, I see the title of tab 1, click it, and end up in tab 2.


arch64 | awesome | screen | ranger | vim | cmus | weechat | bitlbee

Offline

#669 2010-11-17 12:02:07

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

Re: Ranger, a textbased filemanager

killua wrote:

hi hut, is it possible to paste soft symbol link in ranger? or can you add this feature?

type pl (absolute) or pL (relative)

golwin wrote:

I think I just came across a tiny bug.[...]

Thanks


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

Offline

#670 2010-11-17 21:28:33

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

Re: Ranger, a textbased filemanager

We needed a wiki,
we got a wiki: http://ourproject.org/moin/projects/ranger


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

Offline

#671 2010-11-17 23:00:14

Texas
Member
From: Dallas, Texas
Registered: 2010-09-10
Posts: 131

Re: Ranger, a textbased filemanager

I am just finding / trying ranger.  It looks great so far.  Wiki is a good idea.

Offline

#672 2010-11-18 00:35:32

killua
Member
Registered: 2010-04-12
Posts: 8

Re: Ranger, a textbased filemanager

I got it ,thanks for your reply,hut smile

Offline

#673 2010-11-19 00:25:22

3])
Member
From: Netherlands
Registered: 2009-10-12
Posts: 215

Re: Ranger, a textbased filemanager

Before I tried ranger, I thought 'hey, a terminal based file manager? going to  be very slow', yet, I liked the way how you handled it.  Just the design of how you go through the different directories while not losing track of which directory you are is genius. However, will keep Pcmanfm as 'backup' till I get very comfortable with ranger. 

Great job Mr.Hut. Also, I must say that it looks much better with a black background and colored foreground, but that could be me.


“There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies.”-- C.A.R. Hoare

Offline

#674 2010-11-20 17:01:46

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

Re: Ranger, a textbased filemanager

Hey -- I'm using this code in apps.py, but using the '11l' option, it only show the pictures that are on the current screen (like if 38 are visible on the screen but there are 150 in the directory) -- not all the pictures in the directory. Can anyone see what the issue is?

Thanks!
Scott

class CustomApplications(DefaultApps):
    @depends_on('feh')
    def app_feh(self, c):
        arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}

        c.flags += 'd'

        if c.mode in arg: # mode 1, 2 and 3 will set the image as the background
            return tup('feh', arg[c.mode], c.file.path)
        if c.mode is 11 and len(c.files) is 1: # view all files in the cwd
            images = (f.basename for f in self.fm.env.cwd.files if f.image)
            return tup('feh', '-F', '-d', '--start-at', c.file.basename, *images)
        return tup('feh', '-F', '-d', *c)

Last edited by firecat53 (2010-11-20 17:03:18)

Offline

#675 2010-11-20 17:36:02

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

Re: Ranger, a textbased filemanager

firecat53 wrote:

Hey -- I'm using this code in apps.py, but using the '11l' option, it only show the pictures that are on the current screen (like if 38 are visible on the screen but there are 150 in the directory) -- not all the pictures in the directory. Can anyone see what the issue is?

Thanks!
Scott

class CustomApplications(DefaultApps):
    @depends_on('feh')
    def app_feh(self, c):
        arg = {1: '--bg-scale', 2: '--bg-tile', 3: '--bg-center'}

        c.flags += 'd'

        if c.mode in arg: # mode 1, 2 and 3 will set the image as the background
            return tup('feh', arg[c.mode], c.file.path)
        if c.mode is 11 and len(c.files) is 1: # view all files in the cwd
            images = (f.basename for f in self.fm.env.cwd.files if f.image)
            return tup('feh', '-F', '-d', '--start-at', c.file.basename, *images)
        return tup('feh', '-F', '-d', *c)

The problem was that it only picks the file objects for which file.image is true. file.image is a lazy attribute, which means it's only determined when needed, to save processing power. But it seems that it was too lazy, you had to actually view the file on the screen for it to be determined... I fixed that in git, thanks.
I wonder why I didn't notice this, even though I frequently use this function


"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