You are not logged in.

#26 2010-02-18 04:39:13

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

If it's possible, pcfm should check to see whether it's running under GNU screen, and then chose the input method automatically. You could at least check to see if there's a running screen process.

Shouldn't you use switch / case instead of chains of elif? And couldn't you just check for $vim once? Like, instead of

    elif [ $vim = 1 -a $key = j ];
    elif [ $vim = 1 -a $key = k ];
    elif [ $vim = 0 -a $findasyoutype = 1 ];

etc, couldn't you do

if [ $vim = 1 ]; do case "$key" in
    j)
    k)
    default) #not a vim key, use default keymap
elif [ $findasyoutype = 1 ];
fi

I don't know bash, but you get what I mean.

When I open an executable, could I get a prompt, sort of like nautilus - run, edit, always do selected ? I always edit the runner function to comment out the 'elif isexec' line, change the last elif to an else, and add noconfirm=1 to it.

vifm doesn't ask for confirmation on dd, since, the second d is the confirmation; could pcfm stop asking for confirmation on this? Maybe this should be generalized, so that each command gives you the option of confirm/noconfirm.

'a' doesn't work right if the name doesn't have an extension.

Last edited by aeosynth (2010-02-18 04:44:14)

Offline

#27 2010-02-18 23:45:41

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

wget 'http://paste.pocoo.org/raw/179927/' -O ~/bin/pcfm; chmod +x ~/bin/pcfm
Compare Pastes

Good idea about the key table. It looks much better now. ";;&" made some complex things work, I didn't know how it worked before.

aeosynth wrote:

Maybe this should be generalized, so that each command gives you the option of confirm/noconfirm.

Do you mean adding bindings like Shift+F8? That could be a bit dangerous though. I did make -view and -edit use noconfirm

And I added an [e]dit and [v]iew vim binding.

There are now two variables that say what to do with unknown files (ignore/edit) or executables (run/edit) when you press enter, by default they are unset. There is a dialog when the variable is unset and one of the options is writing to the script to set it as default.

I noticed the xsel UTF8 paste method printing xsel("UTF8-text") interfered with erase, so I made it not print anything. The paste itself seems not to show up with erase (it used to appear before PS1)

And I changed the header a bit.

Offline

#28 2010-02-19 01:12:46

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

([e]dit,[r]un,always [E]dit,always [R]un):

This is kind of hard to parse (why so stingy on spaces?) - at first I thought it read

([e]dit, [r]un always, [E]dit always, [R]un):

This might be better:

([e]dit, [r]un, [E]dit always, [R]un always):
Procyon wrote:

Do you mean adding bindings like Shift+F8? That could be a bit dangerous though.

Not if you have an undo button - vifm moves the 'deleted' files to a temporary trash folder (at least I think that's how it works), so that if you accidently hit dd, you can restore the file by hitting p - very vim like. this lets you do cool stuff like moving files around different folders without having to use the command line. Maybe you could implement a trash thing?

Last edited by aeosynth (2010-02-19 01:14:17)

Offline

#29 2010-02-19 10:49:04

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

Ah yeah, with things like that I tend to just do the first thing that comes to mind and not give it a second thought. I should spend some time cleaning the source code.

I am trying out some scrollbar things like putting ^ and v in the header and footer, and I think it would be nice to use UTF8.

About trash, there are some complex things like not moving files off the current filesystem, maybe an external application is better for this, AUR seems to have one maintained app, trash-cli, and it seems to work great for this.

So you could have something like:
undo) recent=$(trash-list | sort | tail -n 1 | cut -d' ' -f3-); trash-restore "$recent"; return="cd $(basedir "$recent")"; noconfirm=1. And a session file hack to make it selected too.

Offline

#30 2010-02-20 00:52:16

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

wget 'http://paste.pocoo.org/raw/180318/' -O ~/bin/pcfm; chmod +x ~/bin/pcfm
Compare Pastes

I added both u to undo and trash-restore the most recent file to its original place, and p to put the restored file in the current directory. So it works like copy pasting. It's not on by default, the switch is -r.

With that I made dd without -r rm with confirmation again, so there shouldn't be any accidents. The UI will also say Trash mode.

F8 will also use the trash (actually dd will change the key to F8), and Ctrl+F8 and T in vim-mode will show trash items, and can do the put and undo stuff too, but it looks a bit awkward, and you can empty the trash there.

In the dmenu-like stdin-reading pcfm (i.e. bookmarks mode), you can now tag multiple files, which was needed for the above when you want to restore multiple files. It won't work with the other menus though.

I removed all the long options, because someone might try -sr to set both -s and -r, and then it will only do -s without complaining.

And I made mc and vim mode have different colors. Try it out with Ctrl+V.

Screenshot with the new scrollbar:
pcfmscreenshot.th.png

Offline

#31 2010-02-20 03:38:54

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

In folders without child folders, the last file isn't displayed.

If I use pcfm in an unmaximized terminal, the color sometimes doesn't reset

tM2x6Mw

showing trash disables vim mode?

[request]
how about v for visual mode? so we can delete / move groups of files.

Last edited by aeosynth (2010-02-20 03:40:31)

Offline

#32 2010-02-20 11:35:18

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

All three problems may be related to the footer (overwriting the last line, not getting cleared on exit, and not writing the color reset), but I can't reproduce it, so can you post another bash -x log?

If it is that though, it may be fixed with a shorter cut off length and putting the color reset outside of it. So try that out first: wget 'http://paste.pocoo.org/raw/180431/' -O ~/bin/pcfm

I tried out xterm and xdotool with type --window doesn't work. In Xdefaults you need to set allowSendEvents to true. (it is false by default)

The default blue is quite unreadable or is that just me?

Visual mode is working. It ends with Enter/v/Esc. And vim mode is preserved in sub-menus.

Offline

#33 2010-02-20 13:00:01

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

The update fixes the trash and color reset bugs, but it still doesn't display the last file, and there's a new bug with vim mode - the total number of files isn't displayed.

log: http://omploader.org/vM200YQ

I'm using urxvt, and allowSendEvents does nothing.

Yes, that blue is pretty much unreadable, lol, it's not used that often or I would have already changed it in my Xdefaults.

Visual mode does work, cancelling visual mode doesn't untag the files, though - is there a way to untag all?

[request]
redo - to undo undos. i've always wanted a file manager that could undo / redo.

one more thing - symlinks aren't displayed as such (no color or @).

Last edited by aeosynth (2010-02-20 13:06:16)

Offline

#34 2010-02-20 15:43:19

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

urxvt allows send events by default. It was just a note for xterm users.

In your output it looks like the last line is wrongly cut off from ls --color=yes. It is expected to contain just a color remover, which is slightly annoying behavior by ls. Collecting the data and checking for a useless last line on the same output might help. I don't get how the behavior would be different for practically the same ls command though (and it works fine here). Maybe you can also add
echo "$CMD" | hexdump -C; read
or in this version
echo "$CMD_pre" | hexdump -C; read
after it is initialized, to see what that last line really is.

"At: filenr/total" should have always been displayed unless it was cut off. It's also in your bash -x paste.

Leaving visual mode through Enter/v should keep the tags, right? Then Esc may as well always untag all. (- and _ also untag all)

I added a small check for symlinks. It will fail with "' --> '" in filenames and it just puts the @ after other IDs.

EDIT: wget 'http://paste.pocoo.org/raw/180515/' -O ~/bin/pcfm
(the previous bugfix-2 had a wrong IFS, I'm not sure how this works, but it seems to give some troubles with command $arguments)

I don't know how redo would work. Maybe writing the reverse of u operations to the session file. So something like
undo) undo-stuff on $recent...; echo "redo:trash-put $recent" >> $SESSION
redo) return=$(sed -n '/^redo/p' | tail -n 1 | cut -d: -f2-); "remove last redo line"
I don't think it would be very useful because it will do only one file at a time, it could be a bit dangerous too considering they are stored beyond sessions and happen for every undo. Maybe with another sub-menu.

Last edited by Procyon (2010-02-20 16:02:47)

Offline

#35 2010-02-22 08:08:38

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

Did that fix it?

Offline

#36 2010-02-22 21:04:50

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

All files show up now.

The filenr/total showed up in my bash paste because I was in mc mode, because running `bash -x "pcfm -v"` didn't work. I enabled vim mode in the source this time; the bug still shows up - http://omploader.org/vM216MQ.

I'm not exactly sure where you want me to add the hexdump, so I added it on line 592, right after CMD_pre=  - http://omploader.org/vM216NA

Esc -> untag all would be nice.

Offline

#37 2010-02-22 22:32:41

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Prompt Command File Manager: tiny bash FM

wget 'http://paste.pocoo.org/raw/181296/' -O ~/bin/pcfm; chmod +x ~/bin/pcfm
Compare pastes

Yeah, I set the cut-off length to "screen width -5", but that is way too safe. There are 10 control characters and 1 scrollbar character that is either 1 or 3 bytes depending on UTF8. (so that makes "columns used/screen width" +10/+12)

If all files show up then the hexdump is not needed. I'm not sure what fixed it now, I changed $IFS which has influence on `cmd $args` where $args has $IFS delimited arguments, and there is a newline at the end now thanks to echo instead of things operating straight from ls without newline. It was probably that line based utilities ignore a non-newline-terminated last line in some cases.

Esc -> untag, is now fixed (the array wasn't cleared with just "marked=" )

And there was a bug with ^P trying to make a sub-menu passing vim mode as 1/0 instead of -v/+v

Offline

#38 2013-04-30 12:47:49

HoleyHat
Member
From: Russia
Registered: 2013-04-30
Posts: 9

Re: Prompt Command File Manager: tiny bash FM

Echtor2oo3 wrote:

Nice..
but take a look at bashc

bashc1.png

Sorry for offtopic, but I so amazed by that picture. How to make such cute console?


If someone introduced himself as a linuxoid, though combed neatly, does not jerk his feet and talking clearly, then he is impostor.

Offline

#39 2013-04-30 12:49:26

aeosynth
Member
From: California
Registered: 2010-02-06
Posts: 115
Website

Re: Prompt Command File Manager: tiny bash FM

dat necrobump

Offline

#40 2013-04-30 13:01:51

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

Re: Prompt Command File Manager: tiny bash FM

Welcome to the forums HoleyHat. Please take a look at the post you quoted. If you have further questions about how to get that look, start a new thread. Thanks, our policy. Closing. Reopened as this is a Community Contributions thread.


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

Offline

Board footer

Powered by FluxBB