You are not logged in.
I can't get dmenfm to run. It keeps telling me the program options. I'm just running dmenfm in the terminal... is there anything else I should be doing? I can't find a man page for this
[edit] Turns out that I just needed to patch dmenu with the dmenu-vertical patch; now everything is peachy. Wonderful program--love how it integrates so beautifully with dwm. [/edit]
Last edited by sfauzia (2009-06-26 23:56:34)
Offline
I converted .pyfmiirc to a bash script that does what you want.
It can take over all view, edit and exec tasks
#! /bin/bash #usage: ./autoprogramselector (view|edit|exec) filename if [ $1 = help -o $1 = "-h" -o $1 = "--help" ]; then grep -E '^(#|view|edit|exec)' $0; exit 0; fi if [ $# -ne 2 ]; then echo wrong usage; exit 1; fi #source if [[ $2 =~ \.([ch]|txt|sh|s)$ ]]; then view="gvim $2" edit="gvim $2" exec="" #man elif [[ $2 =~ \.[0-9](\.gz)?$ ]]; then view="xman $2" edit="gvim $2" exec="xman $2" #archive elif [[ $2 =~ \.(tar|gz|rar|zip|7z|lha|bz2|tgz)$ ]]; then view="atool -l $2" edit="" exec="atool -x $2" #video elif [[ $2 =~ \.(mkv|mpe?g|avi|mp4|wmv|rmvb|as[fx]|divx|vob|ogm|ra?m|flv|part|iso)$ ]]; then view="mplayer $2" edit="" exec="mplayer $2" #audio elif [[ $2 =~ \.(mp3|wav|ogg)$ ]]; then view="mplayer $2" edit="" exec="mplayer $2" #torrent elif [[ $2 =~ \.torrent ]]; then view="" edit="" exec="" #pdf elif [[ $2 =~ \.(pdf|ps)$ ]]; then view="xpdf $2" edit="" exec="xpdf $2" #image elif [[ $2 =~ \.(jpe?g|png|gif|tiff|bmp|icon)$ ]]; then view="feh $2" edit="mtpaint $2" exec="feh $2" #html elif [[ $2 =~ \.(html?|swf)$ ]]; then view="firefox $2" edit="gvim $2" exec="firefox $2" #document elif [[ $2 =~ \.(doc|rtf)$ ]]; then view="" edit="" exec="abiword $2" #windows elif [[ $2 =~ \.exe$ ]]; then view="" edit="" exec="wine $2" #regular file else view="gvim $2" edit="gvim $2" exec="gvim $2" fi #executable (overrides) if [ -x "$2" ]; then exec="$2" fi #make it so if [ -n "${!1}" ]; then setsid setsid ${!1} fi
EDIT NB: the setsid setsid is not good for console, but it is good for using it from an X11 app.
I wanted to replace exo with your script, but your script is only working when I run it from the console, but not when I try to set it as my executor in my dmenfm/preferences file. I don't understand why at all...
Offline
Procyon wrote:
I converted .pyfmiirc to a bash script that does what you want.
It can take over all view, edit and exec tasks
I also am having trouble using that script from dmenfm. Works great from cli. I set it to be executable, made sure it's in the PATH and even tried adding the explicit path in dmenfm, but it still pops up with 'No executor found'.
Thanks,
Scott
Offline
There is a typo in Preferences -> Executor
[ "$opt" ] && editor="$opt"
should be
[ "$opt" ] && executor="$opt"
Oh, and
xmessage -maxWidth 80 -maxHeight 80 "$about"
is not how you set width and height.
Pretty sweet otherwise. Just curious, have you shown this to the dmenu developers at suckless?
Last edited by keenerd (2009-07-13 00:23:37)
Offline
Oh, snap. Sorry, it's been a while. I had picked DmenFM up again a while back ago, then ended up letting it gather dust again. I've got to start working on it again.
Looks like I am working on locale support right now, and I was wondering if there's a better way to do it than:
lbl_colors=(
'aqua'
'black'
'blue'
'fuchsia'
'gray'
'green'
'lime'
'maroon'
'navy'
'olive'
'purple'
'red'
'silver'
'teal'
'white'
'yellow'
)
lbl_home='Home'
lbl_prefs='Preferences'
lbl_openin='Open in %1'
lbl_open='Open'
lbl_edit='Edit'
lbl_copy='Copy'
lbl_move='Move'
lbl_rename='Rename'
lbl_delete='Delete'
lbl_copyto='Copy <%1> to:'
lbl_moveto='Move <%1> to:'
lbl_renameto='Rename <%1> to:'
lbl_replace='Replace <%1>?'
lbl_copyto_confirm='Copy <%1> to <%2>:'
lbl_moveto_confirm='Move <%1> to <%2>:'
lbl_delete_confirm='Delete <%1>?'
lbl_defaults_confirm='Really set defaults?'
lbl_ok='OK'
lbl_cancel='Cancel'
lbl_yes='Yes'
lbl_no='No'
lbl_noexecutor="Set an executor in $lbl_prefs."
lbl_noeditor="Set an editor in $lbl_prefs."
lbl_pref_showhidden='Show hidden files'
lbl_pref_showbackup='Show backup files'
lbl_pref_opendirs='Always open dirs'
lbl_pref_openfiles='Always open files'
lbl_pref_openlast='Open last used dir'
lbl_pref_caseinsens='Case-insensitive'
lbl_pref_onbottom='Display on bottom'
lbl_pref_bg='Background'
lbl_pref_fg='Foreground'
lbl_pref_sbg='Selected background'
lbl_pref_sfg='Selected foreground'
lbl_pref_fn='Font'
lbl_pref_executor='Executor'
lbl_pref_editor='Editor'
lbl_pref_fm='File manager'
lbl_pref_term='Terminal'
lbl_pref_deaults='Set defaults'
lbl_pref_about='About'
lbl_prefschanged='Dmenu settings changed.'
lbs_prefserror='Error in Dmenu settings. Reverted.'
...and using a lot of messy sed pipes.
I'll work in your fixes, too, and I think someone sent me some patches to fix/clean up some other issues. I know my Bash is hella-messy.
I'm thinking about learning Lua or something and re-writing it in that...
Last edited by Wintervenom (2009-07-13 01:09:55)
Offline
Your bash is fine. Very straightforward.
Might I recommend a language instead of Lua?
http://plausible.org/nasal/
Lua is around 1 meg to install. Nasal is about 80K.
It feels like a cross between Javascript and Python (but without the libraries). Very powerful and simple language. I've been porting my complicated bash scripts and simple python scripts to it.
It is actively developed, and the CVS version has many worthwhile features. I'll throw my pkgbuild on the AUR tonight.
Offline
One other bug: setting the executor does not save. In function saveconfig:
executor='exo'
should probably be
executor=\"$executor\"
Dmenfm really does not want to use the autoprogramselector script!
One feature request: support for running a recursive search query from the selected directory. Trivial for a plug in, I'll probably hack it myself. I am thinking use find to get a list of all files, use sed to strip off the common $PWD from the paths, pipe this list into dmenu. On my slow laptop, it takes 0.4 seconds to list all files under /home, not an unreasonable pause.
Offline
Plugin code:
#! /bin/sh
# Search for files in nested directories.
# place in "$XDG_CONFIG_HOME/dmenfm/plugins/browser"
# requires dmenfm "no_scan" patch
# does not respect show_hidden, show_backup, always_open
length=${#PWD}
if [ "$PWD" != "/" ]; then
let length=$length+2
fi
file=`find $PWD \( ! -regex '.*/\..*' \) 2>/dev/null | cut -n -b "$length-" | $menu -p "Searching $PWD: "`
if [ -n "$file" ]; then
if [ "$PWD" != "/" ]; then
file="$PWD/$file"
fi
no_scan="1"
else
unset file
fi
unset length
I needed to patch dmenfm to get the plugin to act as a native selector.
80c80,84
< file=$((echo -e '..\n.'; ls $([[ "$show_hidden" == '1' ]] && echo '-A') $([[ "$show_backup" == '1' ]] && echo '-B'); echo -e "[Preferences]\n[Open in $filemanager]"; ls -B "$plugins_dir/browser") | $menu -p "$(basename $(pwd))")
---
> if [ -z "$no_scan" ]; then
> file=$((echo -e '..\n.'; ls $([[ "$show_hidden" == '1' ]] && echo '-A') $([[ "$show_backup" == '1' ]] && echo '-B'); echo -e "[Preferences]\n[Open in $filemanager]"; ls -B "$plugins_dir/browser") | $menu -p "$(basename $(pwd))")
> else
> unset no_scan
> fi
There is probably a better way of doing that, it feels hackish.
Offline
Hello
Great project I like Dmem FM , great work
I got one question about Dmem FM
I'm using pendrive and I use HAL to mount it (I open panel in PcmanFm I click on mount device and I got Pendrive mounted).
Then what should I do in DmemFM?
Thanks for answers
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
There is no mount feature yet, but it can be added as a plug-in.
Offline
There is no mount feature yet, but it can be added as a plug-in.
Please tell me how?
Last edited by SpeedVin (2009-08-09 09:10:06)
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
Can I know when we can enjoy version 0.1.3 becouse I can't find any inforamtion's about DmemFm on your site Vintervenom
Last edited by SpeedVin (2009-09-01 11:18:12)
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
I solved my problem with mount feature I mount my pendrive manually ;D
But I have one problem for now.
When I got dmemfm open I can't run apps by dmenu (becouse it runs dmenfm) , but are here any solution for that issue?
And someone use in dmenfm vim (in urxvt or another terminal) as he's editor succesfully?
I use dmenfm as my main fm now with coreutils and bash
Last edited by SpeedVin (2009-09-01 11:29:10)
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
It can -- or at least should be able to -- launch them, but key shortcuts (for example) to launuch one won't work, because dmenu grabs the keyboard. I can't fix that. As for using Vim, setting the launcher to urxvt -e vim should do it.
Last edited by Wintervenom (2009-09-01 13:59:52)
Offline
It can -- or at least should be able to -- launch them, but key shortcuts (for example) to launuch one won't work, because dmenu grabs the keyboard. I can't fix that. As for using Vim, setting the launcher to urxvt -e vim should do it.
Hmm when I run dmemfm from dmenu I can't even run dmenu
About Vim as editor I got in preferences file editor="urxvt -e vim" and edit option doesen't work
Shell Scripter | C/C++/Python/Java Coder | ZSH
Offline
This script looks very useful and handy. Since this topic is inactive since very long, I wonder is it because there are out there more known tools with similar functionality? Or maybe this style of file browsing doesn't fit for most users?
bing different
Offline
Couldn't find a git repository for this script at author's GitHub, so I'm posting here a beta 0.2.0 version in case someone is interested. I have added bookmark support and recent files/directories support.
#!/bin/bash
about="
### Dmen File Manager #############################################
# Version 0.1.2 by Scott Garrett <wintervenom [(a)] archlinux.us> #
###################################################################"
### Changelog #####################################################
# 0.1.0 # * Initial version #
# 0.1.1 # + Option 'Open last used dir' #
# # + Options 'Always open dirs' and 'Always open files' #
# 0.1.2 # + Config moved to $XDG_CONFIG_HOME #
# # + Options for dmenu styling #
# # + Option to change executor #
# # + Option to open file manager in current directory #
# # + Plugins support #
# 0.2.0 # ( Modified by nbd [ nbdspcl <at> gmail.com ] ) #
# # + Bookmark support #
# # + Recent directories support #
# # + Recent files support #
###################################################################
function defaults {
show_hidden=0
show_backup=0
always_open_files=0
always_open_dirs=0
open_last=1
dmenu_caseinsens=1
dmenu_onbottom=1
dmenu_bg='#000000'
dmenu_fg='#9999CC'
dmenu_sbg='#000066'
dmenu_sfg='#FFFFFF'
executor='exo-open'
editor='geany'
filemanager='thunar'
}
function saveconfig {
echo "show_hidden=$show_hidden
show_backup=$show_backup
always_open_dirs=$always_open_dirs
always_open_files=$always_open_files
open_last=$open_last
dmenu_caseinsens=$dmenu_caseinsens
dmenu_onbottom=$dmenu_onbottom
dmenu_bg='$dmenu_bg'
dmenu_fg='$dmenu_fg'
dmenu_sbg='$dmenu_sbg'
dmenu_sfg='$dmenu_sfg'
editor=\"$editor\"
executor='exo'
filemanager=\"$filemanager\"
last_dir=\"$(pwd)\"
" > "$config"
}
setmenu() {
menu="$menu $([ "$dmenu_caseinsens" == '1' ] && echo '-i') $([ "$dmenu_onbottom" == '1' ] && echo '-b') -nb $dmenu_bg -nf $dmenu_fg -sb $dmenu_sbg -sf $dmenu_sfg"
}
write_bookmarks() {
> "$config_dir/bookmarks.$$"
for b in ${!bookmarks[@]}; do echo $b >> "$config_dir/bookmarks.$$" ; done
command mv "$config_dir/bookmarks.$$" "$config_dir/bookmarks"
}
display_dir() {
loc='..\n.'
dir=$(ls $([[ "$show_hidden" == '1' ]] && echo '-A') $([[ "$show_backup" == '1' ]] && echo '-B'))
plugs=$(ls -B "$plugins_dir/browser")
opts="[Preferences]\n[Bookmarks]\n[Open in $filemanager]\n[Recent dirs]\n[Recent files]"
file=$(echo -e "${loc}\n${dir}\n${opts}\n${plugs}" | $menu -p "$(basename $(pwd))")
[ -f "$file" ] && file="$(pwd)/$file"
}
display_opts() {
opts='Open'
[ -f "$file" ] && opts="${opts}\nEdit"
[ ${bookmarks["$file"]} ] && opts="${opts}\nUnbookmark" || opts="${opts}\nBookmark"
opts="${opts}\nCopy\nMove\nRename\nDelete"
opts="${opts}\n$(ls -B ${plugins_dir}/operations)"
opt=$(echo -e $opts | $menu -p "<$file>")
}
display_bookmarks() {
file="$($menu -l 10 -p "Bookmarks" < "$config_dir/bookmarks")"
}
display_recent_files() {
list="$(sort "$recfiles" | uniq -c | sort -r | colrm 1 8)"
file="$(echo "$list" | $menu -l 10 -p "Recent" )"
}
display_recent_dirs() {
list="$(sort "$recdirs" | uniq -c | sort -r | colrm 1 8)"
file="$(echo "$list" | $menu -l 10 -p "Recent" )"
}
write_recent_file() {
(echo "$file"; head -n 99 "$recfiles" ) > "${recfiles}.$$"
mv "${recfiles}.$$" "$recfiles"
}
write_recent_dir() {
(echo "$(pwd)"; head -n 99 "$recdirs" ) > "${recdirs}.$$"
mv "${recdirs}.$$" "$recdirs"
}
file=1
dispdir=1
config_file="preferences"
config_dir="$XDG_CONFIG_HOME/dmenfm"
config="$config_dir/$config_file"
recfiles="$config_dir/recent_files"
recdirs="$config_dir/recent_dirs"
plugins_dir="$XDG_CONFIG_HOME/dmenfm/plugins"
menu='dmenu'
[ ! -d "$config_dir" ] && mkdir "$config_dir"
[ ! -d "$plugins_dir" ] && mkdir "$plugins_dir"
[ ! -d "$plugins_dir/browser" ] && mkdir "$plugins_dir/browser"
[ ! -d "$plugins_dir/operations" ] && mkdir "$plugins_dir/operations"
[ ! -d "$plugins_dir/preferences" ] && mkdir "$plugins_dir/preferences"
defaults
touch "$config"
source "$config"
touch "$config_dir/bookmarks"
touch "$config_dir/recent_files"
touch "$config_dir/recent_dirs"
setmenu
# Reading bookmarks into an assoc. array
IFS=$'\n' GLOBIGNORE='*' : ; arr=($(cat "$config_dir/bookmarks"))
declare -A bookmarks
for e in "${arr[@]}"; do bookmarks["$e"]=1; done
# Checking launch parameters
if [ $# -gt 0 ]; then
opt="$1"
shift
case "$opt" in
'-s')
opt="$1"
shift
open_last=1
case "$opt" in
'bm')
last_dir=$($menu -p "$(basename $(pwd))" < "$config_dir/bookmarks")
;;
*)
last_dir="$opt"
;;
esac
;;
esac
fi
[[ "$last_dir" && "$open_last" == 1 ]] && cd "$last_dir"
while [ "$file" ]; do
[[ $dispdir == 1 ]] && display_dir || dispdir=1
if [ "$file" ]; then
if [ -e "$file" ]; then
if $([ -d "$file" ] && [[ "$always_open_dirs" != '1' && "$file" != "." && "$file" != ".." ]]) || $([ -f "$file" ] && [[ "$always_open_files" != '1' ]]); then
owd=$(pwd)
display_opts
else
opt='Open'
fi
case "$opt" in
'Open')
if [ -d "$file" ]; then
cd "$file"
else
write_recent_file
if [ "$executor" ] && which "$executor" &> /dev/null; then
exec "$executor" "$file" &
unset file
elif which exo-open &> /dev/null; then
exo-open "$file"
unset file
elif gnome-open &> /dev/null; then
gnome-open "$file"
unset file
else
notify-send 'No executor found. Set one in [Preferences].'
fi
fi
;;
'Edit')
write_recent_file
if [ "$editor" ] && which "$editor" &> /dev/null; then
exec "$editor" "$file" &
unset file
elif which geany &> /dev/null; then
exec geany "$file"
unset file
elif which gedit &> /dev/null; then
exec gedit "$file"
unset file
elif which kwrite &> /dev/null; then
exec kwrite "$file"
unset file
else
notify-send 'No editor found. Set one in [Preferences].'
fi
;;
'Copy')
cdir=1
while [ "$cdir" ]; do
cdir=$((echo -e '..\n.'; ls $([[ "$show_hidden" == 1 ]] && echo "-A") $([[ "$show_backup" == 1 ]] && echo "-B") -d */) | $menu -p "Copy <$file> to:")
if [[ "$cdir" ]]; then
opt=$(echo -e 'Open\nCopy' | $menu -p "Copy <$file> to <$cdir>:")
if [[ "$opt" == "Open" ]]; then
cd "$cdir"
elif [[ "$opt" == "Copy" ]]; then
echo "$file"
[ -e "$cdir/$file" ] && opt=$(echo -e "No\nYes" | $menu -p "Replace existing <$file>?")
[[ "$opt" == "Copy" || "$opt" == "Yes" ]] && cp -af "$file" "$cdir/$file"
unset cdir
fi
fi
done
;;
'Move')
cdir=1
while [ "$cdir" ]; do
cdir=$((echo -e '..\n.' && ls $([[ "$show_hidden" == 1 ]] && echo "-A") $([[ "$show_backup" == 1 ]] && echo "-B") -d */) | $menu -p "Move <$file> to:")
if [[ "$cdir" ]]; then
opt=$(echo -e 'Open\nMove' | $menu -p "Move <$file> to <$cdir>:")
if [[ "$opt" == "Open" ]]; then
cd "$cdir"
elif [[ "$opt" == "Move" ]]; then
echo "$file"
[ -e "$cdir/$file" ] && opt=$(echo -e "No\nYes" | $menu -p "Replace existing <$file>?")
[[ "$opt" == "Move" || "$opt" == "Yes" ]] && mv -f "$file" "$cdir/$file"
unset cdir
fi
fi
done
;;
'Rename')
opt=$(echo "" | $menu -p "Rename <$file> to:")
[ "$opt" ] && mv -f "$file" "$opt"
;;
'Delete')
opt=$(echo -e "No\nYes" | $menu -p "Really delete <$file>?")
[[ "$opt" == "Yes" ]] && rm -rf "$file"
;;
'Bookmark')
bookmarks["$file"]=1
write_bookmarks
;;
'Unbookmark')
unset bookmarks["$file"]
write_bookmarks
;;
*) [ "$opt" ] && [ -e "$plugins_dir/operations/$opt" ] && source "$plugins_dir/operations/$opt" ;;
esac
elif [[ "$file" =~ '[Open in' ]]; then
write_recent_dir
#which "$filemanager" &> /dev/null && exec "$filemanager" . &
which "$filemanager" &> /dev/null && "$filemanager"
unset file
elif [[ "$file" == '[Bookmarks]' ]]; then
unset file
display_bookmarks
[ -d "$file" ] && cd "$file"
elif [[ "$file" == '[Recent dirs]' ]]; then
unset file
display_recent_dirs
[ -d "$file" ] && cd "$file"
elif [[ "$file" == '[Recent files]' ]]; then
unset file
display_recent_files
dispdir=0
elif [[ "$file" == '[Preferences]' ]]; then
opt=1
while [ "$opt" ]; do
opt=$((echo "[$show_hidden] Show hidden files
[$show_backup] Show backup files
[$always_open_dirs] Always open dirs
[$always_open_files] Always open files
[$open_last] Open last used dir
[$dmenu_caseinsens] Case-insensitive
[$dmenu_onbottom] Display on bottom
[$dmenu_bg] Background
[$dmenu_fg] Foreground
[$dmenu_sbg] Selected background
[$dmenu_sfg] Selected foreground
[$executor] Executor
[$editor] Editor
[$filemanager] File manager
Set defaults
About"; ls -B "$plugins_dir/preferences") | $menu -p "Preferences")
case "$opt" in
*'hidden files') (('show_hidden=!show_hidden')) ;;
*'backup dirs') (('show_backup=!show_backup')) ;;
*'open dirs') (('always_open_dirs=!always_open_dirs')) ;;
*'open files') (('always_open_files=!always_open_files')) ;;
*'used dir') (('open_last=!open_last')) ;;
*'insensitive') (('dmenu_caseinsens=!dmenu_caseinsens')) ;;
*'on bottom') (('dmenu_onbottom=!dmenu_onbottom')) ;;
*'Background')
opt=$(echo -e "$dmenu_bg\n[Default]" | $menu -p "Background:")
[[ "$opt" == '[Default]' ]] && opt='000000'
[ "$opt" ] && dmenu_bg="$opt"
dmenu_test=1
;;
*'Foreground')
opt=$(echo -e "$dmenu_fg\n[Default]" | $menu -p "Foreground:")
[[ "$opt" == '[Default]' ]] && opt='9999CC'
[ "$opt" ] && dmenu_fg="$opt"
dmenu_test=1
;;
*'Selected background')
opt=$(echo -e "$dmenu_bg\n[Default]" | $menu -p "Selected background:")
[[ "$opt" == '[Default]' ]] && opt='000066'
[ "$opt" ] && dmenu_sbg="$opt"
dmenu_test=1
;;
*'Selected foreground')
opt=$(echo -e "$dmenu_bg\n[Default]" | $menu -p "Selected foreground:")
[[ "$opt" == '[Default]' ]] && opt='FFFFFF'
[ "$opt" ] && dmenu_sfg="$opt"
dmenu_test=1
;;
*'Executor')
opt=$(echo -e "$executor\n[Default]" | $menu -p "Executor:")
[[ "$opt" == '[Default]' ]] && opt='exo'
[ "$opt" ] && editor="$opt"
;;
*'Editor')
opt=$(echo -e "$editor\n[Default]" | $menu -p "Editor:")
[[ "$opt" == '[Default]' ]] && opt='geany'
[ "$opt" ] && editor="$opt"
;;
*'File manager')
opt=$(echo -e "$filemanager\n[Default]" | $menu -p "File manager:")
[[ "$opt" == '[Default]' ]] && opt='thunar'
[ "$opt" ] && filemanager="$opt"
;;
*'defaults')
opt=$(echo -e "No\nYes" | $menu -p "Really set defaults?")
[[ "$opt" == "Yes" ]] && defaults
;;
'About') xmessage -maxWidth 80 -maxHeight 80 "$about" ;;
*)
[ "$opt" ] && [ -e "$plugins_dir/preferences/$opt" ] && source "$plugins_dir/preferences/$opt"
;;
esac
done
menu="$menu $([ "$dmenu_caseinsens" == '1' ] && echo '-i') $([ "$dmenu_onbottom" == '1' ] && echo '-b') -nb $dmenu_bg -nf $dmenu_fg -sb $dmenu_sbg -sf $dmenu_sfg"
if [[ "$dmenu_test" == '1' ]]; then
if [[ "OK" != "$(echo 'OK' | $menu -p 'Dmenu settings changed.')" ]]; then
defaults
source "$config"
setmenu
echo 'OK' | $menu -p 'Error in Dmenu settings. Reverted.'
fi
fi
saveconfig
elif [ -e "$plugins_dir/browser/$file" ]; then
source "$plugins_dir/browser/$file"
fi
fi
done
saveconfig
bing different
Offline