Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ~/.xmonad/xmonad.hs
- {-# LANGUAGE NoMonomorphismRestriction #-}
- -- Imports {
- import XMonad
- -- Prompt
- import XMonad.Prompt
- import XMonad.Prompt.RunOrRaise (runOrRaisePrompt)
- import XMonad.Prompt.AppendFile (appendFilePrompt)
- -- Hooks
- import XMonad.Operations
- import System.IO
- import System.Exit
- import XMonad.Util.Run
- import XMonad.Util.SpawnOnce
- import XMonad.Util.EZConfig
- import XMonad.Actions.CycleWS
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.ManageHelpers
- import XMonad.Hooks.SetWMName
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.UrgencyHook
- import XMonad.Hooks.FadeInactive
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Hooks.SetWMName
- import XMonad.Layout.NoBorders (smartBorders, noBorders)
- import XMonad.Layout.PerWorkspace (onWorkspace, onWorkspaces)
- import XMonad.Layout.Reflect (reflectHoriz)
- import XMonad.Layout.IM
- import XMonad.Layout.SimpleFloat
- import XMonad.Layout.Spacing
- import XMonad.Layout.ResizableTile
- import XMonad.Layout.NoBorders
- -- import XMonad.Layout.Gaps
- import XMonad.Layout.LayoutHints
- import XMonad.Layout.LayoutModifier
- import XMonad.Layout.Reflect
- import XMonad.Layout.Grid
- import Data.Ratio ((%))
- import Data.List (isInfixOf)
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- --}
- -- Configuration
- -- Define Terminal
- myTerminal = "terminal"
- -- Define modMask
- modMask' :: KeyMask
- modMask' = mod4Mask
- -- Define workspaces
- myWorkspaces = ["1:main","2:random","3:media","4:chat","5:web","6:doc","7:matlab","8:windows"]
- -- Dzen config
- myStatusBar = "dzen2 -x '0' -y '0' -h '24' -ta 'l' -fg '#FFFFFF' -bg '#3c3c3c' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*' -e ''"
- myBtmStatusBar = "conky -c /home/yami/.conky/conkyrc | dzen2 -e '' -x '0' -h '24' -ta 'c' -bg '#3c3c3c' -fg '#FFFFFF' -fn '-*-bitstream vera sans-medium-r-normal-*-11-*-*-*-*-*-*-*' -y '1176' & stalonetray &"
- myBitmapsDir = "/home/yami/.xmonad/dzen"
- -- Main {
- main = do
- dzenTopBar <- spawnPipe myStatusBar
- dzenBtmBar <- spawnPipe myBtmStatusBar
- xmonad $ defaultConfig
- { terminal = myTerminal
- , workspaces = myWorkspaces
- , keys = keys'
- , modMask = modMask'
- , startupHook = ewmhDesktopsStartup >> setWMName "LG3D" >> spawnOnce "sh /home/yami/.xmonad/autostart.sh"
- , layoutHook = layoutHook'
- , manageHook = manageHook'
- , logHook = myLogHook dzenTopBar >> fadeInactiveLogHook 0xdddddddd >> setWMName "LG3D"
- , normalBorderColor = colorNormalBorder
- , focusedBorderColor = colorFocusedBorder
- , borderWidth = 2
- }
- -- Bar
- myLogHook :: Handle -> X ()
- myLogHook h = dynamicLogWithPP $ defaultPP
- {
- ppCurrent = dzenColor "#00CCFF" "#3c3c3c" . pad
- , ppVisible = dzenColor "white" "#3c3c3c" . pad
- , ppHidden = dzenColor "white" "#3c3c3c" . pad
- , ppHiddenNoWindows = dzenColor "#7b7b7b" "#3c3c3c" . pad
- , ppUrgent = dzenColor "red" "#3c3c3c" . pad
- , ppWsSep = " "
- , ppSep = " | "
- , ppLayout = dzenColor "#00CCFF" "#3c3c3c" .
- (\x -> case x of
- "ResizableTall" -> "^i(" ++ myBitmapsDir ++ "/tall.xbm)"
- "Mirror ResizableTall" -> "^i(" ++ myBitmapsDir ++ "/mtall.xbm)"
- "Full" -> "^i(" ++ myBitmapsDir ++ "/full.xbm)"
- "Simple Float" -> "~"
- _ -> x
- )
- , ppTitle = (" " ++) . dzenColor "white" "#3c3c3c" . dzenEscape
- , ppOutput = hPutStrLn h
- }
- -- Hooks
- -- ManageHook
- manageHook' :: ManageHook
- manageHook' = (composeAll . concat $
- [[isFullscreen --> doFullFloat
- -- Ignores
- , className =? "stalonetray" --> doIgnore
- -- Floats
- , className =? "Xmessage" --> doCenterFloat
- , name =? "File Operation Progress" --> doCenterFloat
- , name =? "Wicd Connection Info" --> doCenterFloat
- -- Fullscreen floats
- --, className =? "VirtualBox" --> doFullFloat
- -- 1:main
- , className =? "Terminal" --> doShift "1:main"
- -- 2:random
- , className =? "Xchat" --> doShift "2:random"
- -- 3:media
- , className =? "xbmc" --> doShift "3:media"
- , className =? "vlc" --> doShift "3:media"
- , className =? "Sonata" --> doShift "3:media"
- -- 4:chat
- , className =? "Pidgin" --> doShift "4:chat"
- , className =? "Skype" --> doShift "4:chat"
- -- 5:web
- , className =? "Firefox" --> doShift "5:web"
- , className =? "Download" --> doShift "5:web"
- , name =? "Downloads" --> doShift "5:web"
- -- 6:doc
- , className =? "Texmaker" --> doShift "6:doc"
- , className =? "Epdfview" --> doShift "6:doc"
- , name=? "OpenOffice.org" --> doShift "6:doc"
- , fmap ("libreoffice" `isInfixOf`) className--> doShift "6:doc"
- -- 7:matlab
- , className =? "MATLAB" --> doShift "7:matlab"
- , name =? "MATLAB 7.12.0 (R2011a)" --> doShift "7:matlab"
- -- 8:windows
- , className =? "VirtualBox" --> doShift "8:windows"
- ]])
- where
- name = stringProperty "WM_NAME"
- -- a trick for fullscreen but stil allow focusing of other WSs
- myDoFullFloat :: ManageHook
- myDoFullFloat = doF W.focusDown <+> doFullFloat
- -- layoutHook' = customLayout
- layoutHook' = avoidStruts $ onWorkspaces ["5:web","6:doc","7:matlab"] myLayout2 $ onWorkspaces ["4:chat"] imLayout $ myLayout1
- -- Layouts
- myLayout1 = smartBorders tiled ||| Grid ||| noBorders Full
- where
- tm = ResizableTall 1 (2/100) (1/2) []
- tiled = spacing pxl $ tm
- pxl = 3
- myLayout2 = smartBorders tiled ||| noBorders Full
- where
- tm = ResizableTall 1 (2/100) (1/2) []
- tiled = spacing pxl $ tm
- pxl = 3
- imLayout = withIM (1%5) (And (ClassName "Pidgin") (Role "buddy_list")) Grid
- --gimpLayout = avoidStruts $ withIM (0.11) (Role "gimp-toolbox") $
- --reflectHoriz $
- -- withIM (0.15) (Role "gimp-dock") Full
- -- Theming
- -- Color names
- colorCyan = "#00CCFF"
- colorOrange = "#FD971F"
- colorDarkGray = "#3c3c3c"
- colorPink = "#F92672"
- colorGreen = "#A6E22E"
- colorBlue = "#66D9EF"
- colorYellow = "#E6DB74"
- colorWhite = "#CCCCC6"
- -- Border colors
- colorNormalBorder = "#CCCCC6"
- colorFocusedBorder = "#00CCFF"
- barFont = "terminus"
- barXFont = "inconsolata:size=14"
- xftFont = "xft: inconsolata-14"
- --}}}
- -- Prompt Config {{{
- mXPConfig :: XPConfig
- mXPConfig =
- defaultXPConfig { font = barFont
- , bgColor = colorDarkGray
- , fgColor = colorCyan
- , bgHLight = colorCyan
- , fgHLight = colorDarkGray
- , promptBorderWidth = 0
- , height = 14
- , historyFilter = deleteConsecutive
- }
- -- Run or Raise Menu
- largeXPConfig :: XPConfig
- largeXPConfig = mXPConfig
- { font = xftFont
- , height = 24
- }
- -- }}}
- -- Key mapping {{{
- keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
- keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
- [ ((modMask, xK_p ), runOrRaisePrompt largeXPConfig)
- , ((modMask, xK_r ), spawn "gmrun")
- , ((modMask, xK_Return ), spawn $ XMonad.terminal conf) -- spawn terminal
- -- Programs
- , ((0, xK_Print ), spawn "scrot -e 'mv $f ~/Images/Screenshots/'")
- , ((modMask, xK_e ), spawn "thunar")
- , ((modMask, xK_z ), spawn "firefox")
- , ((modMask, xK_a ), spawn "pavucontrol")
- , ((modMask, xK_s ), spawn "sonata")
- , ((modMask, xK_m ), spawn "/usr/local/MATLAB/R2011a/bin/matlab -desktop")
- , ((modMask, xK_n ), spawn "texmaker")
- , ((modMask .|. shiftMask, xK_p ), spawn "pidgin")
- , ((modMask .|. shiftMask, xK_i ), spawn "xchat")
- , ((modMask .|. shiftMask, xK_s ), spawn "skype")
- , ((modMask .|. shiftMask, xK_w ), spawn "virtualbox")
- , ((modMask .|. shiftMask, xK_e ), spawn "scribes /home/yami/.xmonad/xmonad.hs")
- -- Media Keys
- , ((0, 0x1008ff12 ), spawn "amixer -q sset Master toggle") -- XF86AudioMute
- , ((0, 0x1008ff11 ), spawn "amixer -q sset Master 5%-") -- XF86AudioLowerVolume
- , ((0, 0x1008ff13 ), spawn "amixer -q sset Master 5%+ unmute") -- XF86AudioRaiseVolume
- , ((0, 0x1008ff14 ), spawn "sonata pp") -- XF86AudioPlay
- , ((0, 0x1008ff17 ), spawn "sonata next") -- XF86AudioNext
- , ((0, 0x1008ff16 ), spawn "sonata prev") -- XF86AudioPrevious
- -- Switching screens
- , ((modMask .|. shiftMask, xK_z ), spawn "xrandr --output LVDS --mode 1600x900 --pos 0x0 --rotate normal --output CRT1 --off --output DFP2 --off --output DFP3 --off --output DFP1 --off && killall conky dzen2 stalonetray nitrogen && xmonad --restart && nitrogen --restore &")
- , ((modMask .|. shiftMask, xK_x ), spawn "xrandr --output LVDS --off --output CRT1 --off --output DFP2 --off --output DFP3 --off --output DFP1 --mode 1920x1080 --pos 0x0 --rotate normal && killall conky dzen2 stalonetray nitrogen && xmonad --restart && nitrogen --restore &")
- -- layouts
- , ((modMask, xK_space ), sendMessage NextLayout)
- , ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- reset layout on current desktop to default
- , ((modMask, xK_b ), sendMessage ToggleStruts)
- , ((mod1Mask, xK_Tab ), windows W.focusDown) -- move focus to next window
- , ((modMask, xK_q ), kill) -- kill selected window
- , ((modMask .|. shiftMask, xK_j ), windows W.swapDown) -- swap the focused window with the next window
- , ((modMask .|. shiftMask, xK_k ), windows W.swapUp) -- swap the focused window with the previous window
- , ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink) -- Push window back into tiling
- , ((modMask, xK_u ), sendMessage Shrink) -- %! Shrink a master area
- , ((modMask, xK_i ), sendMessage Expand) -- %! Expand a master area
- , ((modMask, xK_j ), sendMessage MirrorShrink) -- %! Shrink a slave area
- , ((modMask, xK_k ), sendMessage MirrorExpand) -- %! Expand a slave area
- -- increase or decrease number of windows in the master area
- , ((modMask , xK_comma ), sendMessage (IncMasterN 1))
- , ((modMask , xK_period ), sendMessage (IncMasterN (-1)))
- -- workspaces
- , ((modMask, xK_Right ), nextWS)
- , ((modMask, xK_Left ), prevWS)
- , ((modMask .|. shiftMask, xK_Right ), shiftToNext) -- moves a window to the next workspace
- , ((modMask .|. shiftMask, xK_Left ), shiftToPrev) -- moves a windows to the previous workspace
- -- quit, or restart
- , ((modMask .|. mod1Mask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- , ((modMask .|. shiftMask, xK_r ), spawn "xmonad --recompile && killall stalonetray && xmonad --restart ")
- ]
- ++
- -- mod-[1..9] %! Switch to workspace N
- -- mod-shift-[1..9] %! Move client to workspace N
- [((m .|. modMask, k), windows $ f i)
- | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
- ]
- ++
- -- Switching workspace with the num pad keys
- [((m .|. modMask, k), windows $ f i)
- | (i, k) <- zip myWorkspaces numPadKeys
- , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
- ]
- where
- -- Non-numeric num pad keys, sorted by number
- numPadKeys = [ xK_KP_End, xK_KP_Down, xK_KP_Page_Down -- 1, 2, 3
- , xK_KP_Left, xK_KP_Begin, xK_KP_Right -- 4, 5, 6
- , xK_KP_Home, xK_KP_Up, xK_KP_Page_Up -- 7, 8, 9
- , xK_KP_Insert ] -- 0
- --}}}
Add Comment
Please, Sign In to add comment