You are not logged in.

#901 2011-04-12 00:18:13

anon27
Member
Registered: 2010-11-10
Posts: 18

Re: Ranger, a textbased filemanager

Thanks for the quick answer.

2. Well, the first argument is -FY, not a file

Yeah but how should the syntax be? I don't know the first thing about python or programming for that matter.

Offline

#902 2011-04-12 00:32:07

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

Re: Ranger, a textbased filemanager

Hi hut,how can i define a key to paste selection to a directory without entering the directory?

Last edited by killua (2011-04-12 00:33:17)

Offline

#903 2011-04-12 01:38:46

anon27
Member
Registered: 2010-11-10
Posts: 18

Re: Ranger, a textbased filemanager

1. Army did that already, see here: (the entry of mupdf)
https://bbs.archlinux.org/viewtopic.php … 62#p869262
and don't forget to add the fix in the following post.

This worked for everything I tried except smplayer. It crashes with the error "Mplayer has finished unexpectedly. Exit code: 1"

MPlayer interrupted by signal 1 in module: sleep_timer
ID_SIGNAL=1
- MPlayer crashed. This shouldn't happen.
  It can be a bug in the MPlayer code _or_ in your drivers _or_ in your
  gcc version. If you think it's MPlayer's fault, please read
  DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and
  won't help unless you provide this information when reporting a possible bug.

Offline

#904 2011-04-12 08:34:55

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

Re: Ranger, a textbased filemanager

hut wrote:

1. Army did that already, see here: (the entry of mupdf)
https://bbs.archlinux.org/viewtopic.php … 62#p869262
and don't forget to add the fix in the following post.

And it works pretty well smile With one excepction, mplayer. I have the following in my apps.py

if f.video:
 c.flags += 'sd'
 return tup('nohup', 'mplayer', *c)

but mplayer is being killed when ranger is being closed. Everything's fine with

nohup mplayer file.mkv > /dev/null &

I don't understand why it works with every program except mplayer. I also tested it with ffplay to have a similar example, but with ffplay it works just fine.

Any ideas?

edit: Crap, I didn't read the last post. I guess it's the same issue.

Last edited by Army (2011-04-12 08:35:40)

Offline

#905 2011-04-12 11:47:42

Revelation60
Member
From: The Netherlands
Registered: 2009-03-19
Posts: 158
Website

Re: Ranger, a textbased filemanager

Could ranger get bash-like completion? For example when I type :shell mplayer -chan and then press tab, that I get -channels?

Offline

#906 2011-04-12 14:20:56

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

Re: Ranger, a textbased filemanager

killua wrote:

Hi hut,how can i define a key to paste selection to a directory without entering the directory?

You know how binding keys works in general?
Just bind this command to a key:

shell cp %c "$(grep '^a' ~/.config/ranger/bookmarks | cut -b3-)"

this will cp the copied stuff to bookmark "a"


@Revelation60:
I could write a plugin for that some time, it should be possible.

@mplayer thingie:
Sorry, no idea.. make sure to post here if you find a solution!

anon27 wrote:

It works fine by itself  but if I add arguments I get the error “first argument is not a file”. This is what I have in apps.py:

class CustomApplications(Applications):
    def feh_cycle(self, c):
        return tup(‘feh-cycle’, ‘-FY’, *c)

    def app_default(self, c):
        f = c.file
        if f.image:
            return self.feh_cycle(c)

And this is the script in question just in case it has nothing to do with me sucking at python:

#!/bin/bash

shopt -s nullglob

if [[ ! -f $1 ]]; then
    echo “$0: first argument is not a file” >&2
    exit 1
fi

file=$(basename -- “$1”)
dir=$(dirname -- “$1”)
arr=()
shift

cd -- “$dir”

for i in *; do
    [[ -f $i ]] || continue
    arr+=(“$i”)
    [[ $i == $file ]] && c=$((${#arr[@]} - 1))
done

exec feh “$@” -- “${arr[@]:c}” “${arr[@]:0:c}”                 

Your shell script requires the first argument to be a filename, so lets do that:

    def feh_cycle(self, c):
        return ('feh-cycle', c.file.path, '-FY')

by the way, ranger already includes code that does this. You simply need to open an image with mode 11. (type 11<enter> or 11l). I got this in my apps.py to use this by default:

    def app_feh(self, c):
        if c.mode is 0: c.mode = 11
        return DefaultApps.app_feh(self, c)

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

Offline

#907 2011-04-12 23:04:22

anon27
Member
Registered: 2010-11-10
Posts: 18

Re: Ranger, a textbased filemanager

Thank you, now it works. Didn't notice the same functionality was built-in.

Offline

#908 2011-04-12 23:18:28

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

Re: Ranger, a textbased filemanager

Try closing ranger by typing :quit or Q, mplayer will still be there (with default ranger settings, without nohup or anything)


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

Offline

#909 2011-04-12 23:26:41

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

Re: Ranger, a textbased filemanager

hut wrote:

Try closing ranger by typing :quit or Q, mplayer will still be there (with default ranger settings, without nohup or anything)

There are two ways to start ranger:
1. I open a terminal, e.g. urxvt and then type ranger<Enter>. That way mplayer isn't being killed.
2. I open ranger via a key combination which I configured to execute "/usr/bin/urxvtc -e /usr/bin/ranger". This way mplayer is being killed when ranger is quit with Q or :quit.

I open ranger like 2., that's the whole problem (I think I mentioned it when I first came up with what lead to using nohup)

Offline

#910 2011-04-13 13:29:01

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

Re: Ranger, a textbased filemanager

hut wrote:
killua wrote:

Hi hut,how can i define a key to paste selection to a directory without entering the directory?

You know how binding keys works in general?
Just bind this command to a key:

shell cp %c "$(grep '^a' ~/.config/ranger/bookmarks | cut -b3-)"

this will cp the copied stuff to bookmark "a"

Thanks~
It works like:

map('PP', fm.execute_console('shell cp -r %c $(grep ^a ~/.config/ranger/bookmarks | cut -b3-)'))

Actually what i want is to move selection to current directory without entering it, so i read some code, and then define:

map('PP', fm.execute_console('shell -s mv %c %f'))

I tried "shell -d " mode, but it's quite slow, 2-3s to respond , so silent mode instead.Is it possible to be faster to use detach mode?

Offline

#911 2011-04-13 14:09:37

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

Re: Ranger, a textbased filemanager

killua wrote:
hut wrote:
killua wrote:

Hi hut,how can i define a key to paste selection to a directory without entering the directory?

You know how binding keys works in general?
Just bind this command to a key:

shell cp %c "$(grep '^a' ~/.config/ranger/bookmarks | cut -b3-)"

this will cp the copied stuff to bookmark "a"

Thanks~
It works like:

map('PP', fm.execute_console('shell cp -r %c $(grep ^a ~/.config/ranger/bookmarks | cut -b3-)'))

Actually what i want is to move selection to current directory without entering it, so i read some code, and then define:

map('PP', fm.execute_console('shell -s mv %c %f'))

I tried "shell -d " mode, but it's quite slow, 2-3s to respond , so silent mode instead.Is it possible to be faster to use detach mode?

When you detach it, ranger will redraw before it finished moving so you see the old situation. Just press any key to redraw again. If I come up with a good way to do this automatically, I'll patch it. Thanks for pointing it out smile


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

Offline

#912 2011-04-19 13:42:14

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

Re: Ranger, a textbased filemanager

I'm having a bit of a strange problem lately. I'm using autofs to mount a couple of remote servers with sshfs (/media/ssh/servername) and while a normal ls or cd into their directories works fine, using ranger often causes a timeout/hang that lasts 20-30 seconds to several minutes. During this time all sshfs traffic is stalled, so other open connections also stop working. Once the freeze is over, all traffic is and stays back normal. This only happens on the first 'connect' to a directory managed by autofs.

Any idea where to start debugging this..?


ᶘ ᵒᴥᵒᶅ

Offline

#913 2011-04-19 15:56:22

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

Re: Ranger, a textbased filemanager

I think its because ranger accesses too many files to generate its preview but it could be anything... look what kind of traffic is generated, what files are accessed. I'm working on general optimizations but I don't know if it helps with your problem.

EDIT
Try upgrading now and see if it helps

Last edited by hut (2011-04-19 16:16:11)


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

Offline

#914 2011-04-19 16:18:44

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

Re: Ranger, a textbased filemanager

hut wrote:

look what kind of traffic is generated, what files are accessed.

How could i best determine this?

P.s., if i have multiple remote servers like this:

/media/ssh/server1
/media/ssh/server2
etc.

and from / i use ranger to :cd /media/ssh/server1, i guess there isn't any chance that ranger is trying to access server2 as well is there?

edit: will upgrade first smile

edit2: i'm doing a simple test with the latest ranger:

:cd /media/ssh/server1

This results in an immediate timeout that lasts several minutes, cpu usage and load are both 0 during the timeout.

Last edited by litemotiv (2011-04-19 16:37:15)


ᶘ ᵒᴥᵒᶅ

Offline

#915 2011-04-19 16:40:15

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

Re: Ranger, a textbased filemanager

litemotiv wrote:
hut wrote:

look what kind of traffic is generated, what files are accessed.

How could i best determine this?

P.s., if i have multiple remote servers like this:

/media/ssh/server1
/media/ssh/server2
etc.

and from / i use ranger to :cd /media/ssh/server1, i guess there isn't any chance that ranger is trying to access server2 as well is there?

edit: will upgrade first smile

The earlier version in fact did an os.listdir('/media/ssh/server2'). After the latest patch it will only do os.stat('/media/ssh/server2') to determine what kind of file/directory it is, but shouldn't use ssh...


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

Offline

#916 2011-04-19 17:06:29

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

Re: Ranger, a textbased filemanager

Right, actually when i do :cd /media/ssh/servernam[tab], netstat does only list a connection to the servername that it should complete, yet it's still stalling for quite some time (minutes).


ᶘ ᵒᴥᵒᶅ

Offline

#917 2011-04-19 18:30:41

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

Re: Ranger, a textbased filemanager

litemotiv wrote:

Right, actually when i do :cd /media/ssh/servernam[tab], netstat does only list a connection to the servername that it should complete, yet it's still stalling for quite some time (minutes).

And when you :cd into the directory by typing the full name and pressing enter? Same thing?


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

Offline

#918 2011-04-19 18:48:59

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

Re: Ranger, a textbased filemanager

hut wrote:

And when you :cd into the directory by typing the full name and pressing enter? Same thing?

Yes same thing. Doing the same from a terminal (either cd or ls) works straight away.


ᶘ ᵒᴥᵒᶅ

Offline

#919 2011-04-19 20:30:27

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

Re: Ranger, a textbased filemanager

Hmm. If you look at cd.tab() in commands.py, all it does is os.walk(dirname) and some logic. Can you run this script and see if it has the same effect?

import os
next(os.walk('/media/ssh/servername'))

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

Offline

#920 2011-04-20 06:57:45

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

Re: Ranger, a textbased filemanager

hut wrote:

Hmm. If you look at cd.tab() in commands.py, all it does is os.walk(dirname) and some logic. Can you run this script and see if it has the same effect?

import os
next(os.walk('/media/ssh/servername'))

Ok, i first ran that script, it finished immediately and ended in:

49:unix  2      [ ACC ]     STREAM     LISTENING     79942  /home/ollie/.ssh/cm_socket/user@server1.AIdei9FFSLSEAQNe

Then i fired up ranger and cd'd to server2:

49:unix  2      [ ACC ]     STREAM     LISTENING     79942  /home/ollie/.ssh/cm_socket/user@server1.AIdei9FFSLSEAQNe
53:unix  2      [ ACC ]     STREAM     LISTENING     89149  /home/ollie/.ssh/cm_socket/user@server2.A0h1X9xKtVN6xCKP

But the ranger interface hang for about a minute until it displayed the contents of the directory..


ᶘ ᵒᴥᵒᶅ

Offline

#921 2011-04-20 08:59:24

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

Re: Ranger, a textbased filemanager

hut, i got some problem when previewed some files which always are temp files generated by some download manager of windows.When previewing it ,ranger stops working, and high %CPU & %MEM happens, especially %MEM, above 50% sad But everything is ok, if i turn off preview option.
So is it possible to prevent such situation happening?

Offline

#922 2011-04-20 11:49:38

niksfirefly
Member
Registered: 2011-02-23
Posts: 9

Re: Ranger, a textbased filemanager

is there a way in ranger to search for filename
and if results >0 display:
one list with all files in all subdirs recursively??
or using "n" key like in search jump to every found file?

Offline

#923 2011-04-20 12:13:31

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Ranger, a textbased filemanager

My Ranger seems to have a memory leak, or something. I have only narrowed it down to Ranger. It seems when I leave Ranger open it slowly builds up memory usage within Urxvt. At the start Urxvt uses about .4% memory. After leaving Ranger open for a while the usage creeps up. I have had it use over 10% of 4gb memory! After closing ranger the usage drops back down to .4% for Urxvt.

Any reason for this?

Offline

#924 2011-04-20 12:17:27

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: Ranger, a textbased filemanager

niksfirefly wrote:

is there a way in ranger to search for filename
and if results >0 display:
one list with all files in all subdirs recursively??
or using "n" key like in search jump to every found file?

I also would like something like this.
Sometimes you're looking for a file that's buried a few more levels of directories deep, so if you want to look for it, you need to go into directories, to list their contents, go out of them again, do the next, etc. this is very cumbersome.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#925 2011-04-20 22:34:07

ramboman
Member
Registered: 2010-01-23
Posts: 35

Re: Ranger, a textbased filemanager

Before Ranger, I used to use Thunar.

In Thunar, I was able to add custom command in a bash script style :

e.g : [command file name] %f

associated to a particular file type based on the extension in the file name. When I accessed the context menu through a right-click I was able to access a list of custom command specific to a particular type.

Is there a similar feature in Ranger ?

e.g : showing a list of custom commands for a particular file type that can be executed by typing a shortcut character, in a similar way to the Ranger's bookmark feature.

Offline

Board footer

Powered by FluxBB