aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2011-11-18 19:29:20 +0100
committerAdam Vogt <vogt.adam@gmail.com>2011-11-18 19:29:20 +0100
commit2228d08ff6c328db1d3b24ac6473ebd8162658f9 (patch)
tree32a7c45c1d57e3068be4db8f8860a6e517c8bc99 /XMonad
parent64d5e36232b03d23b6a2315e55fb7a0752ac35a3 (diff)
downloadxmonad-2228d08ff6c328db1d3b24ac6473ebd8162658f9.tar.gz
xmonad-2228d08ff6c328db1d3b24ac6473ebd8162658f9.tar.xz
xmonad-2228d08ff6c328db1d3b24ac6473ebd8162658f9.zip
Assume locale is utf8 for spawn.
Ignore-this: ea27391896e898f1288764ea40bc9661 This adds the utf8-string dependency so that users no longer need to encode strings they (possibly indirectly) pass to spawn. This is the expected behavior, since each Char in String should be an actual character. For systems that do not use utf8 this does not help. Fixing this by using iconv or similar libraries may be done later. darcs-hash:20111118182920-1499c-a28ab3ef902a76cd50fa190526c00ccb4c7b6437.gz
Diffstat (limited to '')
-rw-r--r--XMonad/Core.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index 5fe8688..b3593a0 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -32,6 +32,7 @@ module XMonad.Core (
import XMonad.StackSet hiding (modify)
import Prelude hiding ( catch )
+import Codec.Binary.UTF8.String (encodeString)
import Control.Exception.Extensible (catch, fromException, try, bracket, throw, finally, SomeException(..))
import Control.Applicative
import Control.Monad.State
@@ -384,12 +385,14 @@ catchIO f = io (f `catch` \(SomeException e) -> hPrint stderr e >> hFlush stderr
-- | spawn. Launch an external application. Specifically, it double-forks and
-- runs the 'String' you pass as a command to \/bin\/sh.
+--
+-- Note this function assumes your locale uses utf8.
spawn :: MonadIO m => String -> m ()
spawn x = spawnPID x >> return ()
-- | Like 'spawn', but returns the 'ProcessID' of the launched application
spawnPID :: MonadIO m => String -> m ProcessID
-spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", x] Nothing
+spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", encodeString x] Nothing
-- | A replacement for 'forkProcess' which resets default signal handlers.
xfork :: MonadIO m => IO () -> m ProcessID