Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO and Feature request #19

Open
15 of 16 tasks
huijunchen9260 opened this issue Dec 5, 2019 · 54 comments
Open
15 of 16 tasks

TODO and Feature request #19

huijunchen9260 opened this issue Dec 5, 2019 · 54 comments

Comments

@huijunchen9260
Copy link
Owner

huijunchen9260 commented Dec 5, 2019

  • Optimize if statement and change those if statement into case statement if possible.
  • Support other menu/fuzzy finder system
  • Mac OS or other system support
  • Vim plugin that use dmenufm as file picker
  • Arch linux support (aur?)
  • Image preview...? LOL
  • Sudo mode
  • Compression (zip) action
  • Makefile to install dmenufm (and maybe other dependency?)
  • Prevent user from naming special characters (like ~ or /) for directories and files
  • Check whether the dependency is installed, if not, send notification
  • When leaving the item, not only cd to lastpath, but also the dmenu stopped at last selected item (or the cursor position)
  • Separate dmenufm script into multiple scripts
  • Multi-selection mode
  • Rename action
  • Extraction action

Wish list?

@camnw
Copy link
Contributor

camnw commented Dec 5, 2019

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

@huijunchen9260
Copy link
Owner Author

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
Copy link
Contributor

camnw commented Dec 10, 2019

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

@ghost
Copy link

ghost commented Dec 10, 2019

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:

  • 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.

@huijunchen9260
Copy link
Owner Author

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.

@ghost
Copy link

ghost commented Dec 10, 2019

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
Copy link
Owner Author

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.

@ghost
Copy link

ghost commented Dec 10, 2019

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
Copy link
Owner Author

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?

@ghost
Copy link

ghost commented Dec 10, 2019

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
Copy link
Owner Author

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!

@ghost
Copy link

ghost commented Dec 15, 2019

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
Copy link
Owner Author

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.

@ghost
Copy link

ghost commented Dec 15, 2019

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

@huijunchen9260
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

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

@ghost
Copy link

ghost commented Dec 16, 2019

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
Copy link
Owner Author

Thank you for the advice!

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

@ghost
Copy link

ghost commented Dec 16, 2019

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
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
Owner Author

@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
Copy link
Contributor

camnw commented Feb 20, 2020

@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
Copy link
Contributor

camnw commented Feb 20, 2020

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
Copy link
Owner Author

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

@camnw
Copy link
Contributor

camnw commented Mar 2, 2020

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

@huijunchen9260
Copy link
Owner Author

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
Copy link
Contributor

camnw commented Mar 4, 2020

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

@huijunchen9260
Copy link
Owner Author

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
Copy link

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
Copy link
Owner Author

You can see some color configuration from README.md.

@crian
Copy link
Contributor

crian commented Mar 31, 2020

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
Copy link
Owner Author

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
Copy link
Contributor

crian commented Mar 31, 2020

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

@huijunchen9260
Copy link
Owner Author

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
Copy link
Contributor

crian commented Mar 31, 2020

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
Copy link
Contributor

camnw commented Apr 4, 2020

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
Copy link
Owner Author

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
Copy link

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

@huijunchen9260
Copy link
Owner Author

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
Copy link

Wow, dmenufm is awesome!

@huijunchen9260
Copy link
Owner Author

huijunchen9260 commented May 9, 2020

Wow, dmenufm is awesome!

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

@huijunchen9260
Copy link
Owner Author

@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
Copy link
Contributor

camnw commented May 13, 2020

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
Copy link
Owner Author

huijunchen9260 commented May 13, 2020

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
Copy link
Contributor

camnw commented May 13, 2020

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
Copy link
Owner Author

huijunchen9260 commented Jun 21, 2020

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
Copy link
Contributor

camnw commented Jun 21, 2020

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

@saandre15
Copy link

saandre15 commented Jun 21, 2021

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.

@camnw
Copy link
Contributor

camnw commented Jun 21, 2021

@saandre15 Hi, you can use the -t or --termpath option to do this. Upon selecting a file (or ./ for directories) instead of being opened as it usually would, dmenu will quit and output the selected file's path.

@saandre15
Copy link

Is there an option for selecting directory only or file only?

@huijunchen9260
Copy link
Owner Author

dmenufm -t -d for directory, dmenufm -t -f for file.

See dmenufm -h for more information.

@camnw
Copy link
Contributor

camnw commented Jun 21, 2021

If you still want to be able to access directories (the -f option will hide directories from the list), you could use [ -d "$the_output"] to check whether or not it is a directory, and based on that either quit with an error or bring the user back to dmenu. I think this should be more the job of your script than dmenufm.

Quick example

chooseFile () {
    chosen_file=$(dmenufm $1) # pass first arg to dmenufm.
    [ -d "$chosen_file" ] && chooseFile "$chosen_file" # call this function again with chosen dir as path.
} 

You could implement this in a lot of ways to fit your needs, that is just one idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants