Open huijunchen9260 opened 4 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.
Is there an option for selecting directory only or file only?
dmenufm -t -d
for directory, dmenufm -t -f
for file.
See dmenufm -h
for more information.
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.
~
or/
) for directories and filesWish list?