mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
This patch takes runProcessWithInput out of Dmenu, runProcessWithInputAndWait out of Dzen, and runInXTerm out of RunInXTerm and collects them in one central module called Run. This way, other modules may include Run instead of Dmenu to get what they want without giving the impression of making use of dmenu.
44 lines
1.3 KiB
Haskell
44 lines
1.3 KiB
Haskell
-----------------------------------------------------------------------------
|
|
-- |
|
|
-- Module : XMonadContrib.DirectoryPrompt
|
|
-- Copyright : (C) 2007 Andrea Rossato, David Roundy
|
|
-- License : BSD3
|
|
--
|
|
-- Maintainer : droundy@darcs.net
|
|
-- Stability : unstable
|
|
-- Portability : unportable
|
|
--
|
|
-- A directory prompt for XMonad
|
|
--
|
|
-----------------------------------------------------------------------------
|
|
|
|
module XMonadContrib.DirectoryPrompt (
|
|
-- * Usage
|
|
-- $usage
|
|
directoryPrompt
|
|
) where
|
|
|
|
import XMonad
|
|
import XMonadContrib.XPrompt
|
|
import XMonadContrib.Run ( runProcessWithInput )
|
|
|
|
-- $usage
|
|
-- For an example usage see "XMonadContrib.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
|