Created
March 17, 2013 14:15
-
-
Save aforemny/5181693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| aforemny@nixos (master) % nix-env -q \*|grep ghc ~ | |
| ghc-7.6.2-wrapper | |
| haskell-xmonad-contrib-ghc7.6.2-0.11 | |
| haskell-xmonad-extras-ghc7.6.2-0.11 | |
| haskell-xmonad-ghc7.6.2-0.11 | |
| aforemny@nixos (master) % cat ~/.xmonad/xmonad.hs ~ | |
| module Main where | |
| import Control.Applicative | |
| import Control.Concurrent | |
| import Control.Monad | |
| import Data.IORef | |
| import System.IO | |
| import System.Process | |
| import XMonad | |
| import XMonad.Hooks.DynamicLog | |
| import XMonad.Layout.LayoutHints | |
| import XMonad.Layout.NoBorders | |
| import XMonad.Util.CustomKeys | |
| import XMonad.Util.Run | |
| myLayoutHook = smartBorders . layoutHints $ Tall 1 (30/1280) (794/1280) | |
| ||| Full | |
| ||| Mirror (Tall 1 (14/800) (664/800)) | |
| myKeys = customKeys delKeys insKeys | |
| where | |
| insKeys XConfig {modMask = modMask} = | |
| [ ((modMask, xK_p), safeSpawn dmenu args) ] | |
| where | |
| dmenu = "dmenu_run" | |
| args = [ "-nb", "#111111", "-nf", "#babdb6" | |
| , "-sb", "#111111", "-sf", "#93d44f" ] | |
| delKeys = const [] | |
| myPP xRef = defaultPP { ppCurrent = xmobarColor yellow "" . wrap "[" "]" | |
| , ppTitle = xmobarColor green "" . shorten 40 | |
| , ppVisible = wrap "(" ")" | |
| , ppUrgent = xmobarColor red yellow | |
| , ppExtras = [liftIO (Just <$> readIORef xRef)] | |
| } | |
| where | |
| yellow = "#eab93d" | |
| green = "#93d44f" | |
| red = "#ff6565" | |
| main :: IO () | |
| main = do | |
| xRef <- newIORef "" | |
| forkIO $ do | |
| (hin, hout, herr, p) <- runInteractiveProcess i3status [] Nothing | |
| Nothing | |
| forever $ writeIORef xRef =<< hGetLine hout | |
| waitForProcess p | |
| mapM_ hClose [hin, hout, herr] | |
| (xmonad =<<) . xmobar xRef $ defaultConfig | |
| { layoutHook = myLayoutHook | |
| , focusedBorderColor = "#ff6565" | |
| , normalBorderColor = "#111111" | |
| , keys = myKeys | |
| , focusFollowsMouse = False | |
| } | |
| where | |
| i3status = "/home/aforemny/.nix-profile/bin/i3status" | |
| xmobar xRef = statusBar "xmobar" (myPP xRef) toggleStrutsKey | |
| toggleStrutsKey XConfig{modMask = modMask} = (modMask, xK_b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment