Xmonad/Config archive/thoughtpolice's xmonad.hs
From HaskellWiki
< Xmonad | Config archive(Difference between revisions)
(mk compile) |
|||
| Line 8: | Line 8: | ||
import XMonad | import XMonad | ||
import System.Exit | import System.Exit | ||
| + | import Control.Monad.State | ||
| + | import Control.Concurrent (forkIO) | ||
import qualified XMonad.StackSet as W | import qualified XMonad.StackSet as W | ||
import qualified Data.Map as M | import qualified Data.Map as M | ||
import qualified XMonad.Actions.Submap as SM | import qualified XMonad.Actions.Submap as SM | ||
import qualified XMonad.Actions.Search as S | import qualified XMonad.Actions.Search as S | ||
| + | import XMonad.Hooks.UrgencyHook | ||
import XMonad.Hooks.ManageDocks | import XMonad.Hooks.ManageDocks | ||
import XMonad.Hooks.DynamicLog | import XMonad.Hooks.DynamicLog | ||
| Line 22: | Line 25: | ||
import XMonad.Util.Run | import XMonad.Util.Run | ||
| - | + | import qualified System.IO.UTF8 as UTF8 | |
| + | statusbar = "dzen2 -ta l" | ||
| + | |||
main :: IO () | main :: IO () | ||
main = do pipe <- spawnPipe statusbar | main = do pipe <- spawnPipe statusbar | ||
| - | xmonad defaultConfig { | + | xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig { |
terminal = "urxvt +sb -fg white -bg black" | terminal = "urxvt +sb -fg white -bg black" | ||
, workspaces = ["web/irc","code", "reading"] ++ map show [4..9] | , workspaces = ["web/irc","code", "reading"] ++ map show [4..9] | ||
| Line 35: | Line 40: | ||
, className =? "Xpdf" --> doF (W.shift "reading") | , className =? "Xpdf" --> doF (W.shift "reading") | ||
, className =? "Xchm" --> doF (W.shift "reading")] | , className =? "Xchm" --> doF (W.shift "reading")] | ||
| - | , logHook = dynamicLogWithPP defaultPP { ppCurrent = dzenColor "black" "grey" | + | , logHook = dynamicLogWithPP defaultPP { ppCurrent = dzenColor "black" "grey" |
| - | , ppHidden = dzenColor "grey" "black" | + | , ppHidden = dzenColor "grey" "black" |
| - | , ppUrgent = dzenColor "red" "yellow" | + | , ppUrgent = dzenColor "red" "yellow" |
, ppSep = " ||| " | , ppSep = " ||| " | ||
, ppWsSep = " * " | , ppWsSep = " * " | ||
, ppTitle = shorten 90 | , ppTitle = shorten 90 | ||
, ppOrder = reverse | , ppOrder = reverse | ||
| - | , ppOutput = hPutStrLn pipe | + | , ppOutput = UTF8.hPutStrLn pipe } } |
where layouts = smartBorders $ (Mirror $ Tall 1 (3/100) (1/2)) | where layouts = smartBorders $ (Mirror $ Tall 1 (3/100) (1/2)) | ||
||| simpleTabbed | ||| simpleTabbed | ||
||| Full | ||| Full | ||
| - | + | ||
xpc :: XPConfig | xpc :: XPConfig | ||
xpc = defaultXPConfig { bgColor = "black" | xpc = defaultXPConfig { bgColor = "black" | ||
| Line 77: | Line 82: | ||
, ("M-." , sendMessage (IncMasterN (-1))) -- decrease number of windows in master pane | , ("M-." , sendMessage (IncMasterN (-1))) -- decrease number of windows in master pane | ||
, ("M-b" , sendMessage ToggleStruts) -- toggle status bar gap, uses ManageDocks | , ("M-b" , sendMessage ToggleStruts) -- toggle status bar gap, uses ManageDocks | ||
| - | , ("M- | + | , ("M-C-q" , broadcastMessage ReleaseResources |
>> restart "xmonad" True) -- restart xmonad | >> restart "xmonad" True) -- restart xmonad | ||
, ("C-S-q" , io (exitWith ExitSuccess)) -- exit xmonad | , ("C-S-q" , io (exitWith ExitSuccess)) -- exit xmonad | ||
| Line 86: | Line 91: | ||
| (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) | | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) | ||
, (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] | , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] | ||
| - | + | ||
where searchSite = S.promptSearchBrowser xpc "ff3" | where searchSite = S.promptSearchBrowser xpc "ff3" | ||
search = SM.submap . mkKeymap c $ | search = SM.submap . mkKeymap c $ | ||
| Line 95: | Line 100: | ||
,("y", searchSite S.youtube) | ,("y", searchSite S.youtube) | ||
,("w", searchSite S.wikipedia)] | ,("w", searchSite S.wikipedia)] | ||
| + | |||
</haskell> | </haskell> | ||
Current revision
~/.xmonad/xmonad.hs:
-- -- The horrible thing about the Two Minutes Hate was not that -- one was obliged to act a part, but that it was impossible -- to avoid joining in. -- import XMonad import System.Exit import Control.Monad.State import Control.Concurrent (forkIO) import qualified XMonad.StackSet as W import qualified Data.Map as M import qualified XMonad.Actions.Submap as SM import qualified XMonad.Actions.Search as S import XMonad.Hooks.UrgencyHook import XMonad.Hooks.ManageDocks import XMonad.Hooks.DynamicLog import XMonad.Layout.NoBorders import XMonad.Layout.Tabbed import XMonad.Prompt import XMonad.Prompt.Shell import XMonad.Prompt.Ssh import XMonad.Util.EZConfig import XMonad.Util.Run import qualified System.IO.UTF8 as UTF8 statusbar = "dzen2 -ta l" main :: IO () main = do pipe <- spawnPipe statusbar xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig { terminal = "urxvt +sb -fg white -bg black" , workspaces = ["web/irc","code", "reading"] ++ map show [4..9] , keys = myKeys , layoutHook = avoidStruts layouts , manageHook = composeAll [ manageDocks -- manage xmobar/dzen2, uses ManageDocks , className =? "Firefox" --> doF (W.shift "web/irc") , className =? "Xpdf" --> doF (W.shift "reading") , className =? "Xchm" --> doF (W.shift "reading")] , logHook = dynamicLogWithPP defaultPP { ppCurrent = dzenColor "black" "grey" , ppHidden = dzenColor "grey" "black" , ppUrgent = dzenColor "red" "yellow" , ppSep = " ||| " , ppWsSep = " * " , ppTitle = shorten 90 , ppOrder = reverse , ppOutput = UTF8.hPutStrLn pipe } } where layouts = smartBorders $ (Mirror $ Tall 1 (3/100) (1/2)) ||| simpleTabbed ||| Full xpc :: XPConfig xpc = defaultXPConfig { bgColor = "black" , fgColor = "grey" , promptBorderWidth = 0 , position = Bottom , height = 15 , historySize = 256 } myKeys c = mkKeymap c $ -- keys; uses EZConfig [ ("M-S-<Return>", spawn $ XMonad.terminal c) -- spawn terminal , ("M-p" , shellPrompt xpc) -- spawn menu program, uses Shell , ("M-s" , search) -- search websites, uses Search & Submap , ("M-S-s" , sshPrompt xpc) -- spawn ssh, uses Ssh , ("M-S-c" , kill) -- kill window , ("M-<Space>" , sendMessage NextLayout) -- next layout , ("M-S-<Space>" , setLayout $ XMonad.layoutHook c) -- default layout , ("M-n" , refresh) -- resize to correct size , ("M-j" , windows W.focusDown) -- move focus; next window , ("M-k" , windows W.focusUp) -- move focus; prev. window , ("M-m" , windows W.focusMaster) -- focus on master , ("M-<Return>" , windows W.swapMaster) -- swap current with master , ("M-S-j" , windows W.swapDown) -- swap focused with next window , ("M-S-k" , windows W.swapUp) -- swap focused with prev. window , ("M-h" , sendMessage Shrink) -- shrink master area , ("M-l" , sendMessage Expand) -- expand master area , ("M-t" , withFocused $ windows . W.sink) -- put window back on tiling layer , ("M-," , sendMessage (IncMasterN 1)) -- increase number of windows in master pane , ("M-." , sendMessage (IncMasterN (-1))) -- decrease number of windows in master pane , ("M-b" , sendMessage ToggleStruts) -- toggle status bar gap, uses ManageDocks , ("M-C-q" , broadcastMessage ReleaseResources >> restart "xmonad" True) -- restart xmonad , ("C-S-q" , io (exitWith ExitSuccess)) -- exit xmonad ] ++ -- mod-[1..9], Switch to workspace N -- mod-shift-[1..9], Move client to workspace N [(m ++ k, windows $ f w) | (w, k) <- zip (XMonad.workspaces c) (map show [1..9]) , (m, f) <- [("M-",W.greedyView), ("M-S-",W.shift)]] where searchSite = S.promptSearchBrowser xpc "ff3" search = SM.submap . mkKeymap c $ [("g", searchSite S.google) ,("h", searchSite S.hoogle) ,("a", searchSite S.amazon) ,("i", searchSite S.imdb) ,("y", searchSite S.youtube) ,("w", searchSite S.wikipedia)]
~/.xsession:
# executed by xdm at login export LANG=en_US.UTF8 $HOME/bin/xmobar & $HOME/bin/xmonad
