[xmonad] XMonad.Prompt.File (attached)

Gwern Branwen gwern0 at gmail.com
Fri Mar 18 03:21:49 CET 2011


On Wed, Mar 16, 2011 at 10:45 PM, John J Foerch <jjfoerch at earthlink.net> wrote:
> I had need in my config for a filename prompt.  XMonad-Contrib contains
> XMonad.Prompt.Directory, so I just copied it and made the appropriate
> substitutions to make XMonad.Prompt.File.  It would be great if this
> could be added to xmonad-contrib so it will be there for the next person
> who needs this functionality.

Well, as you say, it's basically just a copy-paste with one small change:

36,38c36,38
< getFileCompl :: String -> IO [String]
< getFileCompl s = (filter notboring . lines) `fmap`
<                  runProcessWithInput "/bin/bash" [] ("compgen -A
file " ++ s ++ "\n")
---
> getDirCompl :: String -> IO [String]
> getDirCompl s = (filter notboring . lines) `fmap`
>                 runProcessWithInput "/bin/bash" [] ("compgen -A directory " ++ s ++ "\n")

As it stands, I would be adamantly  against inclusion; such copy-paste
is not the Haskell way. Surely there is a better approach? I can't
help but suspect that this functionality may already be supplied by
another module (perhaps the Shell prompt meets your needs).

(On a side-note, I'm a little horrified by the 'notboring' function.
Is there really no library function for that? I quickly looked in
System.Filepath and System.Directory but turned up nothing named along
the lines of 'isHidden'.)

-- 
gwern
http://www.gwern.net



More information about the xmonad mailing list