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 3 years ago

@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 commented 3 years ago

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

huijunchen9260 commented 3 years ago

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

See dmenufm -h for more information.

camnw commented 3 years ago

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.