You are not logged in.

#1901 2014-11-04 09:29:16

andya
Member
Registered: 2014-10-20
Posts: 10

Re: Ranger, a textbased filemanager

Hi, this is a wonderful file manager.
I'm wondering if it is possibile to easily feed selected files to a shell script... I mean, I have a script called "script.sh" that for example does this:

IFS=$'\n\t'
for file in "$@"; do
               convert -modulate 100,0 "$file" "black_$file"
done

I would like to select files in ranger and then feed them to it.
I tried running "./script.sh %s" but the (bash, zsh) shell tries to read literally "%s" as a filename. I tried "./script.sh $@" and nothing happened. I tried (as in rifle): "./script.sh -- $@", but it tried to read -- as a filename...

Offline

#1902 2014-11-04 09:45:23

loop
Member
Registered: 2011-05-06
Posts: 58

Re: Ranger, a textbased filemanager

Have you tried "./script.sh %%s"?

Offline

#1903 2014-11-04 09:59:37

andya
Member
Registered: 2014-10-20
Posts: 10

Re: Ranger, a textbased filemanager

loop wrote:

Have you tried "./script.sh %%s"?

It works! Thank'you very much!

Last edited by andya (2014-11-04 11:03:04)

Offline

#1904 2014-12-03 20:39:40

TheNineBaller
Member
Registered: 2014-12-03
Posts: 18

Re: Ranger, a textbased filemanager

Hey I absolutely love this file manager but I seem to be having a minor problem.

Whenever I start Ranger in a tty and use it to open a file with any external program it seems to reset the colors in the terminal upon closing the external program. I have tried each of these programs individually and can't seem to replicate this issue. It is only when these programs are opened through Ranger.

Any help would be greatly appreciated.

Offline

#1905 2014-12-15 18:05:24

PieterGen
Member
From: Groningen, NL, EU
Registered: 2012-01-18
Posts: 59

Re: Ranger, a textbased filemanager

@TheNineBaller - please pst your settings. 
- Also, what colors does your terminal have before and after?
- how do yo open a terminal? ctrl-alt-F1 ?  or do you use a terminal emulator  like LXTerminal or Guake or Xterm? Does the problem happen in all those situations?
- if you run ranger without X, does it happen as well?

Offline

#1906 2014-12-15 18:13:06

PieterGen
Member
From: Groningen, NL, EU
Registered: 2012-01-18
Posts: 59

Re: Ranger, a textbased filemanager

Can anybody give me a clue? I'd like an exta functionality for the up/down arrows. I think this asks for altering the source code, but I dpon't know where to start.

Suppose I'm in a directory that has 3 entries, say

file1.txt
file2.txt
subdirectory

What i'd like is that if I move the cursor down from file1.txt to file2.txt to subdirectory,  that it re-starts at the top when I push the down arrow one more time. 
And vice versa:  I use the up-arrow:  subdirectory ^  file2.txt ^ file1.txt   and when I push the up arrow once more, I am again at  the subdirectory       and so on

Hope I made myself clear. That way, especially with long lists, you can go quickly to the top or bottom.  Also, it feels logical, to go sort of in a circle: down, down and start at the top again.   Any hints?

Last edited by PieterGen (2014-12-15 18:14:02)

Offline

#1907 2014-12-15 19:19:03

Mercader1902
Member
Registered: 2014-09-01
Posts: 55

Re: Ranger, a textbased filemanager

I can't give you a real solution but typing Capital G will send you to the bottom of the directory and Ctrl-R to the top.

Last edited by Mercader1902 (2014-12-15 19:22:22)

Offline

#1908 2014-12-15 21:04:12

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

Re: Ranger, a textbased filemanager

Here is a quick solution.

Edit /usr/lib/python3.4/site-packages/ranger/ext/direction.py, add this in the move function, just above the return statement (l. 129 for me):

        if self.get('cycle'):
            return minimum + pos % (maximum + offset - minimum)

Also, beware of the indentation, use spaces (not tabulations) and align with the surrounding code. Python will complain elsewhere. smile

Then you can add (or redefine) this in your ~/.config/ranger/rc.conf :

map <DOWN>  move down=1 cycle=true
map <UP>    move up=1   cycle=true
copymap <down> j
copymap <up> k

This may be is worth a pull request: https://github.com/hut/ranger/pull/203.

Last edited by PotatoesMaster (2014-12-15 21:34:38)

Offline

#1909 2014-12-16 16:22:47

PieterGen
Member
From: Groningen, NL, EU
Registered: 2012-01-18
Posts: 59

Re: Ranger, a textbased filemanager

@Mercader1902 - I know, but thanks anyway !
@PotatoesMaster - merci beaucoup! I am not that good at Python, this really helps.  I'll try it out myself first and later make that pull request.

Edit: I see you have already made the pull request. Thanks PotatoesMaster!

Last edited by PieterGen (2014-12-16 16:27:02)

Offline

#1910 2015-01-28 10:35:43

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

Hi,

I would like to be able to "cd" in a insensitive way. For example cd /home/user/vid and hit Tab to auto complete would bring me to /home/user/Vidéos.

Is that possible in ranger ? Thanks !


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1911 2015-01-28 10:51:10

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: Ranger, a textbased filemanager

Hello,

It's already the case you can hit Shift + Tab to autocomplete the path.

Offline

#1912 2015-01-28 11:07:50

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

It doesn't do anything at all for me hmm

Can you share your config, maybe I'm missing something here.


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1913 2015-01-28 11:44:36

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: Ranger, a textbased filemanager

Don't know if it's a ranger internal feature.

here it is.

command.py :
http://sebsauvage.net/paste/?71b35506d3 … UREqs4w8s=

rc.conf:
http://sebsauvage.net/paste/?73a2eeb1a4 … ixMwcmdIM=

I'm under zsh.
Cheers

Offline

#1914 2015-01-28 11:55:19

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,412
Website

Re: Ranger, a textbased filemanager

It works for me (ranger-git) if you don't use slashes in the :cd command (TAB goes to the next completion, Shift+TAB to the previous one)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#1915 2015-01-28 12:37:45

mentat
Member
From: France
Registered: 2009-01-13
Posts: 138
Website

Re: Ranger, a textbased filemanager

For me TAB bring back to cd history.

Offline

#1916 2015-01-28 15:33:09

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

Alad wrote:

It works for me (ranger-git) if you don't use slashes in the :cd command (TAB goes to the next completion, Shift+TAB to the previous one)

I have the same behaviour,  unfortunately it's still case sensitive.

Last edited by Kolibry (2015-01-28 15:40:29)


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1917 2015-01-28 15:39:59

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

.

Last edited by Kolibry (2015-01-28 15:41:03)


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1918 2015-01-28 18:29:43

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

Re: Ranger, a textbased filemanager

I have overloaded the cd command of ranger: here.

The tab method is copied from ranger's original, with the block at lines 44 to 49 added.
Tab-completion is case-insensitive when no other match is found.

to use it, add this line at the top of your ~/.config/ranger/commands.py file (create it if needed):

from ranger.config.commands import cd

and paste the highlighted lines present in the page linked above.

Offline

#1919 2015-01-28 20:50:20

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

Thanks for the help, but it didn't do anything. I also tried to replace my commands.py with the one from your link and my auto completion was simply just gone hmm


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1920 2015-01-29 18:50:44

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

Re: Ranger, a textbased filemanager

Oh, you are using ranger-stable. smile

Here you go : same hack for ranger 1.6.1.

Offline

#1921 2015-01-31 08:01:17

Kolibry
Member
Registered: 2012-12-20
Posts: 110

Re: Ranger, a textbased filemanager

It works now ! Thanks you very much ! smile


Asus 1225B - 11,6" -  AMD E-60 Dual Core 1,3Ghz - 4 Go RAM - Disque dur SSD 128 Go -  Radeon HD6290
ArchLinux Openbox - My Github

Offline

#1922 2015-02-04 08:16:07

3xOSC
Member
Registered: 2013-03-18
Posts: 107

Re: Ranger, a textbased filemanager

Using two different terminals: one being termite and the other urxvt, when i start ranger (the same source of config files), termite displays all the text in a regular manner, but with urxvt, the text is in bold?

Does anyone have any ideas what is going on?

Offline

#1923 2015-02-09 19:24:32

kalda341
Member
Registered: 2015-02-09
Posts: 1

Re: Ranger, a textbased filemanager

A feature that I think would be incredibly useful, is to be able to mark a directory for copy, then select only specific subdirectories to be copied. I am currently trying to copy a bunch of music sorted by artist, then album, and wish I could do the entire copy in one go. What I want is a way to select albums to copy, but keep the folder hiearchy.
Does anyone have any idea if this is possible with Ranger?

Last edited by kalda341 (2015-02-09 19:24:55)

Offline

#1924 2015-02-09 23:59:03

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

Re: Ranger, a textbased filemanager

You could tag them with a specific tag, for example by typing "x, then use the --list-tagged-files=x option in a custom script to move them. Then clear the tags afterwards.

One script that worked for me was this:

ranger --list-tagged-files=x | xargs -d "\n" -n 1 bash -c 'source="$0"; target="/home/kalda/destination/${source#/home/kalda/source/}"; mkdir -p "$(dirname "$target")"; cp -av "$source" "$target"'

Make sure to replace /home/kalda/source/ with the directory you're copying from, and /home/kalda/destination/ with the target directory.

To clear all x tags, you could use

sed -i '/^x:/d' ~/.config/ranger/tagged

Last edited by hut (2015-02-09 23:59:45)


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

Offline

#1925 2015-03-15 11:09:00

Hund
Member
From: Sweden
Registered: 2010-03-22
Posts: 479
Website

Re: Ranger, a textbased filemanager

I'm not sure what I'm missing here. I added the code to my commands.py as the Wiki instructed me to do here: https://wiki.archlinux.org/index.php/Ranger#Compression

Creating a archive works. I also added my own shortcut for it: ":map Pc compress %s.zip". But extracting archives (:extracthere) does not work at all. I dont get any output or anything?

What am I doing wrong?

Offline

Board footer

Powered by FluxBB