diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-03-02 10:59:24 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-03-02 10:59:24 +0100 |
commit | ae0a1957566e162f20ab652f1ec82485320bd97a (patch) | |
tree | 5e0c0ea83c9821e722741ffb1a36b03854925565 | |
parent | 1085043f0ceb4a3f76e7fed3f9ddd0f2b59cb6c5 (diff) | |
download | XMonadContrib-ae0a1957566e162f20ab652f1ec82485320bd97a.tar.gz XMonadContrib-ae0a1957566e162f20ab652f1ec82485320bd97a.tar.xz XMonadContrib-ae0a1957566e162f20ab652f1ec82485320bd97a.zip |
Shell: add support for UTF-8 locales
darcs-hash:20080302095924-32816-62d05666cf2d7c3897055aa20afff0f0c31eda1f.gz
-rw-r--r-- | XMonad/Prompt/Shell.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/XMonad/Prompt/Shell.hs b/XMonad/Prompt/Shell.hs index 1f79e13..358cc49 100644 --- a/XMonad/Prompt/Shell.hs +++ b/XMonad/Prompt/Shell.hs @@ -54,7 +54,7 @@ instance XPrompt Shell where shellPrompt :: XPConfig -> X () shellPrompt c = do cmds <- io $ getCommands - mkXPrompt Shell c (getShellCompl cmds) spawn + mkXPrompt Shell c (getShellCompl cmds) (spawn . encodeOutput) -- | See safe and unsafeSpawn. prompt is an alias for safePrompt; -- safePrompt and unsafePrompt work on the same principles, but will use @@ -73,20 +73,20 @@ shellPrompt c = do prompt, unsafePrompt, safePrompt :: FilePath -> XPConfig -> X () prompt = unsafePrompt safePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run - where run = safeSpawn c + where run = safeSpawn c . encodeOutput unsafePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run - where run a = unsafeSpawn $ c ++ " " ++ a + where run a = unsafeSpawn $ c ++ " " ++ encodeOutput a getShellCompl :: [String] -> String -> IO [String] getShellCompl cmds s | s == "" || last s == ' ' = return [] | otherwise = do - f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file " ++ s ++ "\n") + f <- fmap lines $ runProcessWithInput "bash" [] ("compgen -A file " ++ encodeOutput s ++ "\n") files <- case f of [x] -> do fs <- getFileStatus x if isDirectory fs then return [x ++ "/"] else return [x] _ -> return f - return . uniqSort $ files ++ commandCompletionFunction cmds s + return . map decodeInput . uniqSort $ files ++ commandCompletionFunction cmds s commandCompletionFunction :: [String] -> String -> [String] commandCompletionFunction cmds str | '/' `elem` str = [] |