blob: 281d2cf7b9cf86ab1fb0db55e591da8a7a247eb6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Prompt.Directory
-- Copyright : (C) 2007 Andrea Rossato, David Roundy
-- License : BSD3
--
-- Maintainer : droundy@darcs.net
-- Stability : unstable
-- Portability : unportable
--
-- A directory prompt for XMonad
--
-----------------------------------------------------------------------------
module XMonad.Prompt.Directory (
-- * Usage
-- $usage
directoryPrompt
) where
import XMonad
import XMonad.Prompt
import XMonad.Util.Run ( runProcessWithInput )
-- $usage
-- For an example usage see "XMonad.Layout.WorkspaceDir"
data Dir = Dir String
instance XPrompt Dir where
showXPrompt (Dir x) = x
directoryPrompt :: XPConfig -> String -> (String -> X ()) -> X ()
directoryPrompt c prom job = mkXPrompt (Dir prom) c getDirCompl job
getDirCompl :: String -> IO [String]
getDirCompl s = (filter notboring . lines) `fmap`
runProcessWithInput "/bin/bash" [] ("compgen -A directory " ++ s ++ "\n")
notboring :: String -> Bool
notboring ('.':'.':_) = True
notboring ('.':_) = False
notboring _ = True
|