huijunchen9260 / dmenufm

A simple file manager using dmenu
GNU General Public License v3.0
227 stars 15 forks source link

TODO and Feature request #19

Open huijunchen9260 opened 4 years ago

huijunchen9260 commented 4 years ago

Wish list?

camnw commented 4 years ago

I'll work on the compression action bit, letting you know so we don't duplicate effort :smiley:

huijunchen9260 commented 4 years ago

Recently I just found out that we can adjust IFS so that we don't need to separate different item and add single quotes to the DIRs stuff. I hope that in the future, this can be the applied to all the dmenufm

camnw commented 4 years ago

Sounds good. Will be back from my... ehmmmm... "leave of absence because of my incompetence" soon :laughing: and will see about this if it hasn't gotten done yet

terminalforlife commented 4 years ago

You can also inject variables (environment, basically) into processes, without affecting the great beyond. Here's an example:

DISPLAY=':0' xfce4-terminal

Regarding duplication of effort, I'm going through the entire file (dmenufm) to:

My fork is over here if you are interested in seeing what I so far have pushed.

huijunchen9260 commented 4 years ago

You can also inject variables (environment, basically) into processes, without affecting the great beyond. Here's an example:

DISPLAY=':0' xfce4-terminal

What this command is doing? What is injecting variables means?

Regarding duplication of effort, I'm going through the entire file (dmenufm) to:

* Optimize

* Improve logic

* Check POSIX-compliance

* Improve the presentation (non-code stuff)

My fork is over here if you are interested in seeing what I so far have pushed.

Thank you! Feel free to add push request to this project. I might not be able to review them until Thursday, since I have my final ended in Thursday.

terminalforlife commented 4 years ago

Awesome, and you're more than welcome. I love what you've done so far. Also, best of luck to you on your finals.

Also, what do you think of supporting Cito? It's a Bourne POSIX installer for local or GitHub files., as it describes. It'd help me, and I'm hoping help dmenufm reach some more peeps. All that's needed, from what I'm seeing so far, is a #cito line, akin to the Vi-IMproved mode line.

huijunchen9260 commented 4 years ago

Is that your personal shell? If so, I would prefer this project to use standard POSIX shell so that it can applied to every Unix/Linux system.

terminalforlife commented 4 years ago

Oh no, it's not a shell, it's a POSIX-compliant program for installing local files or remote files stored on GitHub. Think of it like an easy-to-use package manager, without the packages. lol It's written in shell, using POSIX-compliant Bourne shell, and has very few dependencies.

For example, a user could install your dmenufm program with:

sudo cito -r huijunchen9260 dmenufm master dmenufm

Or, if you decide not to use a Cito line in it:

sudo cito -M 755 -O 0 -G 0 -T /usr/bin/dmenufm -r huijunchen9260 dmenufm master dmenufm
huijunchen9260 commented 4 years ago

So if implementing that, I can use Cito to check whether the user has all (or most) of the dependency that required by dmenufm, and installed for them?

terminalforlife commented 4 years ago

It's not meant as a dependency checker or anything. The idea of it is to be simple, but still provide some useful features, like extensive logging, md5sum support, and the ability to install local or remote files. You could use it to install multiple remote files in one execution though, so in that sense, you could ensure they've installed the right files.

Regarding checking for packages and dependencies, that can just be done within dmenufm. See my approach: https://github.com/terminalforlife/Extra/blob/master/source/cito

I've sourced from libtflbp-sh the function ChkDep() and then just neatly check dependencies (via commands found in PATH, not packages). Where ChkDep is in: https://github.com/terminalforlife/Extra/tree/dev/source/libtflbp-sh

huijunchen9260 commented 4 years ago

I have updated some commits today, and I believe that one of them is important.

Originally, I used : as the delimiter of different files/directories. Now I use \n as delimiter by playing with IFS. I also updated the BulkMode, BulkListAll and other functions that needs SELECTED variables so that now they directly use \n as their deliminator.

Now that we can allow using : in our file/directory name! I consider it as a big victory!

Thanks all your help, and I wish we can complete (or add more) todo together!

terminalforlife commented 4 years ago

Unfortunately, albeit unlikely, filenames can have newline characters. One approach is to use IFS= to delimit each filename by null value. You could use something like tr to translate all newlines to ?, but that could be confusing to the user.

It's still a huge improvement over : which was far too generic, so definitely a victory!

What you could do, and what'd I'd probably consider, is to omit invalid (non-POSIX) filenames, or put something similar in its place; hence the aforementioned ? approach.

While not strict to POSIX, I wrote FNSanityChk just now and added it to my libtflbp-sh collection; you're welcome to use it, provided it's with attribution. It just provides a return status indicating whether a string is valid for a filename (1=invalid, 0=valid), so you could do, for example FNSanityChk "$CurFile" || continue if looping over the filenames.

huijunchen9260 commented 4 years ago

I am now thinking whether it is possible to cd to the lastpath that you were, but also change the cursor to the last choice that you chosen.

For example, if I scroll through a directory that is full of random named picture, I either open one of the picture or exit. Whenever I open it again, the cursor is at the top of the file rather than the one that I selected/chosen. I am wondering whether it is possible for dmenufm to go back to the cursor where the user was.

terminalforlife commented 4 years ago

AFAIK, you can't pre-select something like that.

huijunchen9260 commented 4 years ago

My thought is that maybe it is possible to rebuild the Menu so that separated with respect to the chosen file?

For example: Original menu is

file1
file2
file3
file4

After I choose file3, it becomes

file3
file4
file1
file2
huijunchen9260 commented 4 years ago

My thought is that maybe it is possible to rebuild the Menu so that separated with respect to the chosen file?

For example: Original menu is

file1
file2
file3
file4

After I choose file3, it becomes

file3
file4
file1
file2

Finished by newly implemented -r option

huijunchen9260 commented 4 years ago

Does anyone know how to write a vim script so that we can use dmenufm as a file picker? Reference

terminalforlife commented 4 years ago

That sounds cool, but not everyone uses vim; it would still be awesome as a feature available if vim is detected, or as an optional feature. I can vimscript, but I don't think I'm gonna have much time for this stuff over the next couple of weeks, unfortunately.

I've not had a chance to check in on dmenufm, but I recommend holding off on adding new features like that and focus on things like bugs and cleaning up the code where possible. It already has the core concept, but the last time I used it, it seemed like it could've done with some ironing out.

huijunchen9260 commented 4 years ago

Thank you for the advice!

I am also thinking about separating dmenufm into different files so that it is easier to maintain.

terminalforlife commented 4 years ago

I usually favor just the one file, but since it's around 1000 lines, maybe splitting it up into two or three be a good idea. Don't go overboard (this is just IMO) because it can be a pain in the ass shuffling between a ton of files for just a few lines of code.

One example, IMO, of a good split, would be if you have a program which has a user configuration file, like my new Perl program, git-tudu, which is in master now, and has some cool features; you might find it useful actually. Anyway, if the configuration file setup and maybe generation becomes rather extensive, having it work separately would be awesome, because they are probably two things (main code and it) not often needed to be seen at the same time.

Speaking of a configuration file, I wonder if dmenufm could benefit from it in the future.

Regarding your imagine preview todo item, I think something like feh could work, but you'd have to exit the menu to get view the image, which would be so tedious. I'm honestly not sure that's even a viable goal at this point.

Honestly, I think using a different menu system might be better, like rofi. Obviously that's not ideal, because that'd mean damn near starting again. lol But I think you're gonna run into a lot of limitations. Maybe someone forked dmenu and did some cool stuff making it more scriptable.

huijunchen9260 commented 4 years ago

I have tried on separating one scripts into multiple scripts by adding a branch MultiScripts. I separated each action and corresponding function into individual files. Hope this can prevent too-long code and increase the readability of the code.

huijunchen9260 commented 4 years ago

Working progress:

Most of the items on the TODO list has been (partially) completed. I am so glad that I can come up with a workable idea with FM_EYE action (preview function).

Now I believe that the combination of -r option and FM_EYE function did a good combination to fulfill the purpose to overview the files hastily, although may resulting in one more dependency, wmctrl. I use wmctrl to close the windows, while I don't know why xdotool seems not work well with preview purposes.

I have already releases the v1.0 release, hope that there are more people can contribute to this project!

huijunchen9260 commented 4 years ago

@VebbNix is it possible for you to help me with the aur package and vim plugin stuff? Also, can you verify the FM_EYE mode for me?

Thank you!

camnw commented 4 years ago

@huijunchen9260 Sorry, have been busy recently.

I have no experience with packaging for the AUR, and have not been on arch in a while, so I feel like I am not the best person to assist with this.

About vim plugin, I am not sure that is best suited for a todo list on this repository. As in since this would certainly be a separate repository I am not sure it is best to have it on a todo list here. That said, I may be willing to create this plugin. however my motivation to keep it updated so may be stifled by the fact I don't think I'd personally use it.

Update: Read newest comment. When I wrote this, I misspoke, I meant my motivation to continue supporting it if need be may be stifled NOT my will to create it.

camnw commented 4 years ago

I have made a simple vim plugin for Dmenufm file picking, which can be found here. If you would like me to give you write access to this repository just let me know and I will have no problem with that. Probably will have some features to add, but here it is in its basic form.

huijunchen9260 commented 4 years ago

Nick! I totally don't know how to write vim script LOL I will try it after midterm, probably Monday!

camnw commented 4 years ago

Should Vim plugin be ticked off the list now, or does my solution not suffice?

huijunchen9260 commented 4 years ago

Sorry for late reply, because I haven't known how to make a pull request XD The only thing I want to address now is to add -r -p options in the dmenufm -t part.

camnw commented 4 years ago

Ah alright. I have merged your commits, thanks for this!

huijunchen9260 commented 4 years ago

I need to commit something for me to learn it:

I will watch this video and learn how to make AUR package!!!!!!

https://www.youtube.com/watch?v=ls_hpopfsQU&t=321s

pauloo27 commented 4 years ago

Hello

dmenu support some parameters to change the color scheme:

bindsym $mod+d exec "dmenu_run -nf '#F8F8F2' -nb '#282A36' -sb '#6272A4' -sf '#F8F8F2' -fn 'monospace-10' -p 'dmenu%'"

(from https://github.com/dracula/i3/blob/master/.config/i3/config)

Can I do the same with dmenufm?

huijunchen9260 commented 4 years ago

You can see some color configuration from README.md.

crian commented 4 years ago

I need to commit something for me to learn it:

I will watch this video and learn how to make AUR package!!!!!!

https://www.youtube.com/watch?v=ls_hpopfsQU&t=321s

There are already two packages in the AUR. A release and a git version.

https://aur.archlinux.org/packages/?O=0&K=dmenufm

huijunchen9260 commented 4 years ago

I need to commit something for me to learn it: I will watch this video and learn how to make AUR package!!!!!! https://www.youtube.com/watch?v=ls_hpopfsQU&t=321s

There are already two packages in the AUR. A release and a git version.

https://aur.archlinux.org/packages/?O=0&K=dmenufm

Wow! Thank you so much!

May I ask what's the difference bewteen release and git version? Based on my release package and git commit?

crian commented 4 years ago

Release version is based on your github releases and the git version is based on your commits.

huijunchen9260 commented 4 years ago

Release version is based on your github releases and the git version is based on your commits.

Will it auto update whenever I upload commits or make such releases?

Thank you!

crian commented 4 years ago

Release version is based on your github releases and the git version is based on your commits.

Will it auto update whenever I upload commits or make such releases?

Thank you!

Yes. The packages will fetch your latest release or commit.

camnw commented 4 years ago

Should we close this issue? All goals have been met (hooray!) so I don't see a reason to keep this here. Unless you plan to use this issue to house all future long-term work in progress issues.

huijunchen9260 commented 4 years ago

Should we close this issue? All goals have been met (hooray!) so I don't see a reason to keep this here. Unless you plan to use this issue to house all future long-term work in progress issues.

Yes, I intended to leave this comment for some possible TODO and maybe some discussion about dmenufm in this issue. I wish to leave it here.

GasparVardanyan commented 4 years ago

Fuzzy finder? Something like: find -L ~ -type f -not -path '/.' | sort | dmenu -p file: -i -l 10

huijunchen9260 commented 4 years ago

Fuzzy finder? Something like: find -L ~ -type f -not -path '/.' | sort | dmenu -p file: -i -l 10

Why not just use fzf?

dmenufm can store all your commands. See CMD.

GasparVardanyan commented 4 years ago

Wow, dmenufm is awesome!

huijunchen9260 commented 4 years ago

Wow, dmenufm is awesome!

Feel free to look my other project like dmenubib. or tabbed-hjc

huijunchen9260 commented 4 years ago

@VebbNix I am so surprised that it didn't take me much work to change dmenu in dmenufm to fzf. Most of the functions (probably except FM_EYE) works and is much faster.

camnw commented 4 years ago

I thought of this, possibly supporting different programs as the interface. I use bemenu so I did think at some point this may be a good idea to try to support other programs of similar nature. If you would like we can work on another branch that aims to streamline support for most programs like fzf, peco, bemenu, etc. Would mostly involve stripping out hardcoded dmenu specific options and instead only using them if dmenu is being used.

huijunchen9260 commented 4 years ago

I just tried out upload my current work to fzffm branch.

Maybe you can try it out?

(To avoid name conflict I also change the file names.)

camnw commented 4 years ago

Will try it! I think what I will do is try to get as many dmenu-alike programs working with it without completely breaking it and pull request progress where it is made.

huijunchen9260 commented 4 years ago

Dear @VebbNix :

In the most recent update, I tried my best to replace if statements with case statements, and I think the code is much cleaner now. I commented the original code so that if something goes wrong, we can go back to old code.

Could you try the newest version for me? I wonder whether there is any bug.

Thanks!

camnw commented 4 years ago

Sure! I'll take a look tomorrow as I am about to go to bed, I'll see if anything goes wrong.

dretechtips commented 3 years ago

Is it possible to use dmenufm as a file selection prompt. The file selection prompt should output the path of the file into the shell instead of opening the file through xdg-open. I'm currently building a password management dmenu script called dmenukeepass and I'm thinking of using dmenufm as a file selection tool.