Guest User

my xmonad config

a guest
Jan 16th, 2011
320
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --System imports
  2. import XMonad
  3. import System.Exit
  4. import qualified XMonad.StackSet as W
  5. import qualified Data.Map        as M
  6. import Data.Ratio ((%))
  7. import System.IO
  8. import Data.IORef
  9. import Data.Monoid
  10.  
  11.  
  12. -- Graphics import
  13.  
  14. import Graphics.X11.Xlib.Extras
  15. import Graphics.X11.ExtraTypes.XF86
  16.  
  17. -- Actions import
  18. import XMonad.Actions.CycleWS
  19. import XMonad.Actions.NoBorders
  20. import XMonad.Actions.CopyWindow
  21. import XMonad.Actions.SinkAll
  22. import XMonad.Hooks.DynamicLog
  23. import XMonad.Actions.TagWindows
  24. import XMonad.Actions.UpdatePointer
  25. import qualified XMonad.Actions.FlexibleResize as Flex
  26. import XMonad.Actions.WindowMenu
  27. import XMonad.Actions.GridSelect
  28. import XMonad.Actions.ConstrainedResize as Sqr
  29. import XMonad.Actions.FlexibleResize
  30. import XMonad.Actions.FindEmptyWorkspace
  31. import XMonad.Actions.RotSlaves
  32. import XMonad.Actions.FocusNth
  33. import XMonad.Actions.Submap
  34. --import XMonad.Actions.CycleSelectedLayouts
  35. --import XMonad.Actions.Search
  36. -- Layouts
  37. --import xmproc
  38. import XMonad.Layout.Circle
  39. import XMonad.Layout.NoBorders
  40. import XMonad.Layout.Tabbed
  41. -- import XMonad.Layout.DwmStyle
  42. import XMonad.Layout.Named
  43. import XMonad.Layout.Master
  44. import XMonad.Layout.Decoration
  45. import XMonad.Layout.PerWorkspace
  46. import XMonad.Layout.Named
  47. import XMonad.Layout.IM
  48. import XMonad.Layout.Reflect
  49. import XMonad.Layout.MagicFocus
  50. import XMonad.Layout.LayoutModifier
  51. import XMonad.Layout.MultiToggle
  52. import XMonad.Layout.NoBorders
  53. import XMonad.Layout.TwoPane
  54. import XMonad.Layout.ResizableTile
  55. import XMonad.Layout.Spiral
  56. import XMonad.Layout.StackTile
  57. import XMonad.Layout.Mosaic
  58. import XMonad.Layout.MosaicAlt
  59. -- import XMonad.Layout.Dishes
  60. import XMonad.Layout.Gaps
  61. import XMonad.Layout.Grid
  62. import XMonad.Layout.MouseResizableTile
  63. import XMonad.Layout.Simplest
  64. import XMonad.Layout.SimplestFloat
  65. import XMonad.Layout.OneBig
  66. import XMonad.Layout.Minimize
  67. import XMonad.Layout.Maximize
  68. --import XMonad.Layout.Accordion
  69. --import XMonad hiding ( (|||) )
  70. --import XMonad.Layout.LayoutCombinators
  71. import XMonad.Layout.WindowNavigation
  72. import XMonad.Layout.SimpleFloat
  73. import XMonad.Layout.SimplestFloat
  74. import XMonad.Layout.CenteredMaster
  75. import XMonad.Layout.SimpleDecoration
  76. import XMonad.Layout.ShowWName
  77. import XMonad.Layout.DecorationMadness
  78.  
  79. -- Prompt import
  80. import XMonad.Prompt
  81. import XMonad.Prompt.Man
  82. import XMonad.Prompt.Shell
  83. import XMonad.Prompt.Ssh
  84. import XMonad.Prompt.Input
  85. --
  86. import XMonad.Prompt.Workspace
  87. --import XMonad.Prompt.Layout
  88. --import XMonad.Prompt.RunOrRaise
  89.  
  90. -- Hooks import
  91. import XMonad.Hooks.UrgencyHook
  92. import XMonad.Hooks.EwmhDesktops
  93. import XMonad.Hooks.ManageDocks
  94. import XMonad.Hooks.ManageHelpers
  95. import XMonad.Hooks.FadeInactive
  96. import XMonad.Hooks.DynamicLog
  97. import XMonad.Hooks.Place
  98. import XMonad.Hooks.RestoreMinimized
  99.  
  100.  
  101. --
  102. -- import XMonad.Util.EZConfig
  103. -- Tobe able to query X11 atoms and such on
  104. -- X11 import
  105. import Graphics.X11.Xlib.Display
  106. import Graphics.X11.Xlib.Screen
  107. import Graphics.X11.Xlib.Extras
  108. import Graphics.X11.Types
  109. import Graphics.X11.ExtraTypes.XF86
  110. import Graphics.X11.ExtraTypes.XorgDefault
  111. import Foreign.C.Types (CLong)
  112. import Text.Regex.Posix ((=~))
  113. --import utils
  114. import XMonad.Util.XUtils
  115. import XMonad.Util.Run (spawnPipe)
  116. import XMonad.Util.CustomKeys
  117. --import XMonad.Util.Dzen
  118.  
  119.  
  120. myTerminal      = "gnome-terminal"
  121. myBorderWidth   = 1
  122. myModMask       = mod1Mask
  123. myFadeIn = 0.7
  124. -- > $ xmodmap | grep Num
  125. -- > mod2        Num_Lock (0x4d)
  126. --
  127. -- Set numlockMask = 0 if you don't have a numlock key, or want to treat
  128. -- numlock status separately.
  129. --
  130. myNumlockMask   = mod2Mask
  131. myWorkspaces = ["sys","im","sip","mail","www","tab","graph", "files", "media"]
  132. myNormalBorderColor  = "#cccccc"
  133. --myNormalBorderColor  = "#ffffff"
  134. myFocusedBorderColor = "#000000"
  135. myBar = "conky"
  136.  
  137. setRootAtom :: String -> String -> X ()
  138. setRootAtom name value = withDisplay (io . setRootAtom' name value)
  139.    where setRootAtom' atom name d = do
  140.                                        a <- internAtom d atom False
  141.                                        rw <- rootWindow d $ defaultScreen d
  142.                                        setTextProperty d rw name a
  143.  
  144. getRootAtom :: String -> X [String]
  145. getRootAtom name = withDisplay (io . getRootAtom' name)
  146.    where getRootAtom' atom d = do
  147.             a <- internAtom d atom False
  148.             rw <- rootWindow d $ defaultScreen d
  149.             tp <- getTextProperty d rw a
  150.             wcTextPropertyToTextList d tp
  151.  
  152. setLayoutAtom :: String -> X ()
  153. setLayoutAtom name =  setRootAtom "XMONAD_LAYOUT" name
  154.  
  155. -- chooseLayout name = sendMessage $ JumpToLayout name
  156.  
  157. --
  158.  
  159. -- Window tags
  160.  
  161. stackPlus s1 s2 = Just W.Stack {W.focus = W.focus s1,
  162.                                W.up    = (W.up s1) ++ (W.up s2),
  163.                                W.down  = (W.down s1) ++ (W.down s2) ++ [W.focus s2]}
  164.  
  165. stackPlus' Nothing st = Just st
  166. stackPlus' (Just s1) s2 = stackPlus s1 s2
  167.  
  168. modifyWs i d f s = W.modify d f (W.view i s)
  169.  
  170. emptyCurrentWs = W.modify Nothing (const Nothing)
  171.  
  172. addStackToTarget target st = modifyWs target st (stackPlus' st)
  173.  
  174. returnToCurrent c s = W.view curtag s
  175.    where curtag = W.currentTag c
  176.  
  177. curstack s = W.stack $ W.workspace $ W.current s
  178. -- CompizFusion or MS Win Se7en like
  179. -- CompizFusion or MS Win Se7en like
  180. currentList :: X [Window]
  181. currentList = withWindowSet (\s -> return $ W.integrate' $ curstack s)
  182.  
  183. unmaximize :: Window -> X ()
  184. unmaximize w = withDisplay $ unmaximize' w
  185.  where
  186.    unmaximize' w d =
  187.       let swd = widthOfScreen s
  188.           sht = heightOfScreen s
  189.           wd = round $ 0.8*(fromIntegral swd)
  190.           ht = round $ 0.8*(fromIntegral sht)
  191.           x = round $ (fromIntegral (swd-wd))/2
  192.           y = round $ (fromIntegral (sht-ht))/2
  193.           s = defaultScreenOfDisplay d
  194.      in do float w
  195.            io $ resizeWindow d w wd ht
  196.            io $ moveWindow d w x y
  197.  
  198. isFloat :: Window -> X Bool
  199. isFloat w = do
  200.   fls <- withWindowSet (return . W.floating)
  201.   return (w `M.member` fls)
  202.  
  203. specialMove w = do
  204.   focus w
  205.   lst <- currentList
  206.   case lst of
  207.     [] -> return ()
  208.     [x] -> do
  209.       is <- isFloat x
  210.       if is
  211.         then mouseMoveWindow w
  212.         else float x >> unmaximize x
  213.     _ -> mouseMoveWindow w
  214.  
  215. ------------------------------------------------------------------------
  216. -- Взять значение свойства окна
  217. getProp :: Atom -> Window -> X (Maybe [CLong])
  218. getProp a w = withDisplay $ \dpy -> io $ getWindowProperty32 dpy a w
  219.  
  220. -- Эта функция проверяет, выставлено ли свойство окна name в значение value
  221. checkAtom name value = ask >>= \w -> liftX $ do
  222.           a <- getAtom name
  223.           val <- getAtom value
  224.           mbr <- getProp a w
  225.           case mbr of
  226.             Just [r] -> return $ elem (fromIntegral r) [val]
  227.             _ -> return False
  228. -- Эта функция проверяет, является ли окно диалогом ли tear-off меню
  229. checkDialog = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DIALOG"
  230. checkMenu = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_MENU"
  231.  
  232. -- Сделать меню плавающими
  233. --manageMenus = checkMenu --> doFloat
  234. -- Сделать диалоги плавающими
  235. --manageDialogs = checkDialog --> doFloat
  236.  
  237. manageMenus=checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DIALOG" --> doFloat
  238. manageDialogs = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_MENU" --> doFloat
  239. ------------------------------------------------------------------------
  240. -- Key bindings. Add, modify or remove key bindings here.
  241. --
  242. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  243.  
  244.     [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  245.      --, ((modm .|. controlMask, xK_d), spawn "oowriter")
  246.      , ((modm .|. controlMask, xK_d), spawn "/opt/openoffice.org3/program/swriter")
  247.      , ((shiftMask .|. modm .|. controlMask, xK_d), spawn "abiword")
  248.      --, ((modm .|. controlMask, xK_e), spawn "oocalc")
  249.      , ((modm .|. controlMask, xK_e), spawn "/opt/openoffice.org3/program/scalc")
  250.      , ((shiftMask .|. modm .|. controlMask, xK_e), spawn "gnumeric")
  251.      --, ((modm .|. controlMask, xK_p), spawn "ooimpress")
  252.      , ((modm .|. controlMask, xK_p), spawn "/opt/openoffice.org3/program/simpress")
  253.      , ((shiftMask .|. modm .|. controlMask, xK_p), spawn "lyx")
  254.      , ((modm .|. controlMask, xK_o), spawn "xterm -e /home/AlexYeCu/xnest")
  255.      , ((shiftMask .|. modm .|. controlMask, xK_o), spawn "evolution")
  256.      --, ((mod4Mask, xK_e ), spawn "urxvt")
  257.      , ((mod4Mask, xK_e ), spawn "gnome-terminal")
  258.      , ((shiftMask .|. mod4Mask, xK_e ), spawn "xterm")
  259.      , ((controlMask .|. mod4Mask, xK_e ), spawn "gnome-terminal")
  260.      , ((modm .|. mod4Mask, xK_e ), spawn "xterm")
  261.      , ((mod4Mask, xK_period ), spawn "ellipses")  
  262.      , ((mod4Mask, xK_w ), spawn "wacommode")
  263.      , ((mod4Mask, xK_h), spawn "gedit ~/.xmonad/xmonad.hs")
  264.      , ((mod4Mask, xK_a), spawn "gedit ~/bin/autostart")
  265.      , ((mod4Mask, xK_c), spawn "/home/AlexYeCu/bin/clipthis")
  266.      , ((mod4Mask, xK_t), spawn "/home/AlexYeCu/bin/translit")
  267.      ,((mod4Mask, xK_v), spawn "gthumb vi-vim-cheat-sheet.gif")
  268.      ,((mod4Mask, xK_q), spawn "echo $ELLE")
  269.      , ((modm,               xK_p     ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
  270.      , ((modm,               xK_f     ), spawn "exe=`fmenu_path | fmenu` && eval \"exec $exe\"")
  271.      --, ((modm,               xK_v     ), spawn "exe=`vmenu_path | vmenu` && eval \"exec $exe\"")
  272.      , ((controlMask .|. modm, xK_BackSpace), spawn "sudo killall -9 X")
  273.      , ((modm .|. shiftMask , xK_period), spawn "echo …")
  274. --XF86Sleep 0x1008ff10
  275.      , ((0, xF86XK_Sleep ), spawn "slock")
  276.  
  277.     , ((controlMask, xF86XK_Sleep ), spawn "xterm -e /home/AlexYeCu/bin/off")
  278. --
  279.      , ((0, xK_Print ), spawn "scrot")
  280.     -- launch gmrun
  281.     , ((modm .|. shiftMask, xK_p     ), spawn "gmrun")
  282.     , ((modm,               xK_r     ), spawn "gmrun")
  283.     -- close focused window
  284.     , ((modm .|. shiftMask, xK_c     ), kill)
  285.     , ((mod4Mask, xK_z ), kill)
  286.     , ((mod4Mask, xK_x ), spawn "xkill")
  287. --XF86Mail 0x1008ff19
  288.     , ((shiftMask, 0x1008ff19 ), spawn "opera")
  289.     , ((0, 0x1008ff19 ), spawn "firefox")
  290.     , ((modm, 0x1008ff19 ), spawn "epiphany")
  291.     , ((controlMask, 0x1008ff19 ), spawn "google-chrome")
  292.     , ((mod4Mask, 0x1008ff19 ), spawn "arora")
  293.    -- , ((mod3Mask, 0x1008ff19 ), spawn "konqueror")
  294. --XF86Home 0x1008ff33
  295.     , ((0, xF86XK_HomePage), spawn "nautilus $HOME")
  296.     --, ((shiftMask, xF86XK_HomePage ), spawn "krusader")
  297.     --, ((mod4Mask, xF86XK_HomePage ), spawn "thunar $HOME")
  298.     --, ((mod4Mask, xF86XK_HomePage ), spawn "gentoo")
  299.     , ((controlMask, xF86XK_HomePage ), spawn "pcmanfm")
  300.     --, ((modm, xF86XK_HomePage ), spawn "dolphin $HOME")
  301.     , ((shiftMask, xF86XK_HomePage ), spawn "gnome-commander")
  302. --XF86WebCam 0x1008ff8f
  303. --    , ((0, xF86XK_WebCam), spawn "camx")
  304. --XF86Favorites 0x1008ff30
  305.     , ((shiftMask, xF86XK_Favorites ), spawn "gogh")
  306.     , ((0, xF86XK_Favorites ), spawn "gcolor2")
  307.     , ((controlMask, xF86XK_Favorites ), spawn "xournal")
  308. --XF86Search 0x1008ff1b
  309.     , ((0, xF86XK_Search ), spawn "~/bin/mpcpult")
  310.     , ((shiftMask, xF86XK_Search ), spawn "beagle-search")
  311.     , ((controlMask, xF86XK_Search ), spawn "~/bin/websearch")
  312. --XF86Back 0x1008ff26
  313.     --, ((controlMask .|. shiftMask, xF86XK_Back ), sendMessage $ ToggleGaps)  -- toggle all gaps
  314.     , ((shiftMask, xF86XK_Back ), spawn "killall -9 xmobar")
  315.     --, ((controlMask, xF86XK_Back ), sendMessage $ ToggleGap U) -- toggle the top gap
  316.     --, ((modm, xF86XK_Back ), spawn "~/bin/bga")
  317.     --, ((mod4Mask, xF86XK_Back ), spawn "killall xcompmgr | killall cairo-compmgr")
  318.     , ((0, xF86XK_Back ), spawn "~/bin/dvdeject")
  319. --XF86Forward 0x1008ff27
  320.     --, ((controlMask .|. shiftMask, xF86XK_Forward ), sendMessage ToggleStruts)
  321.     , ((shiftMask, xF86XK_Forward ), spawn "/home/AlexYeCu/.cabal/bin/xmobar")
  322.     --, ((modm, xF86XK_Forward ), spawn "~/bin/bgb")
  323.     , ((0, xF86XK_Forward ), spawn "gmrun")
  324.     --, ((mod4Mask, xF86XK_Forward ), spawn "xcompmgr -cfFS -r 0 -o 0 -D 10 -I 0.1 -O 0.1 &")
  325.    --,((mod4Mask, xF86XK_Forward ), spawn "xcompmgr")
  326.    --,((shiftMask .|. mod4Mask, xF86XK_Forward ), spawn "/usr/local/bin/cairo-compmgr")
  327. --XF86Stop xK_Cancel 0x1008ff28
  328.     , ((0, xK_Cancel ), spawn "~/bin/camx")
  329.     , ((shiftMask, xK_Cancel ), spawn "~/bin/webcam -p")
  330.     , ((modm, xK_Cancel ), spawn "kill -9 `/usr/sbin/lsof -t /dev/video0`")
  331.     , ((controlMask .|. modm, xK_Cancel ), spawn "v4l2ucp")
  332.     , ((controlMask, xK_Cancel ), spawn "~/bin/camrec -f")
  333.     , ((mod4Mask, xK_Cancel), spawn "~/bin/camrec -j")
  334. --XF86Refresh 0x1008ff73
  335.     , ((0, xF86XK_Refresh), spawn "tomboy --new-note $(date +%Y-%m-%d_%H:%M:%S)")
  336.     , ((shiftMask, xF86XK_Refresh), spawn "gedit")
  337.     , ((controlMask, xF86XK_Refresh), spawn "gvim")
  338.     , ((mod4Mask, xF86XK_Refresh), spawn "~/bin/clipthis")
  339.     , ((0, xF86XK_Reload), spawn "tomboy --new-note $(date +%Y-%m-%d_%H:%M:%S)")
  340.     , ((shiftMask, xF86XK_Reload), spawn "gedit")
  341.     , ((controlMask, xF86XK_Reload), spawn "gvim")
  342.     , ((mod4Mask, xF86XK_Reload), spawn "~/bin/clipthis")
  343. --XF86AudioPrev 0x1008ff16
  344.    --, ((0, xF86XK_AudioPrev  ),      spawn "amarok --previous")
  345.    , ((0, xF86XK_AudioPrev),      spawn "mpc prev")
  346.    , ((shiftMask, xF86XK_AudioPrev),       spawn "mocp --prev")
  347.    , ((controlMask, xF86XK_AudioPrev),       spawn "mpc seek -10%")
  348.    , ((mod4Mask, xF86XK_AudioPrev),       spawn "mpc seek -00:00:30")
  349. --XF86AudioNext 0x1008ff17
  350.      , ((0, xF86XK_AudioNext ),       spawn "mpc next")
  351.      , ((shiftMask, xF86XK_AudioNext ),       spawn "mocp --next")
  352.      , ((controlMask, xF86XK_AudioNext ),       spawn "mpc seek +10%")
  353.      , ((mod4Mask, xF86XK_AudioNext ),       spawn "mpc seek +00:00:30")
  354. --XF86AudioStop 0x1008ff15
  355.    --, ((0, xF86XK_AudioStop),       spawn "amarok --stop")    
  356.      , ((0, xF86XK_AudioStop),        spawn "mocp --stop")
  357. --XF86Play 0x1008ff14
  358.      , ((0, xF86XK_AudioPlay),        spawn "mpc toggle")
  359.      , ((0, xF86XK_AudioPlay),        spawn "mpc toggle")
  360.      , ((mod4Mask, xF86XK_AudioPlay),        spawn "gmpc")
  361.      , ((shiftMask, xF86XK_AudioPlay),        spawn "mocp -G")
  362. --XF86AudioMute 1008ff12
  363.     , ((0, xF86XK_AudioMute),        spawn "amixer -c0 set Master 0% 0%")
  364.      , ((modm, xF86XK_AudioMute),        spawn "~/bin/headphones -m")
  365.      -- , ((0, xF86XK_AudioMute),        spawn "amixer -c0 set Master toggle")
  366.      , ((controlMask, xF86XK_AudioMute),        spawn "amixer -c0 set Mic 0% 0%")
  367.      , ((controlMask .|. shiftMask , xF86XK_AudioMute),        spawn "amixer -c7 set Mic 0% 0%")
  368.      , ((shiftMask, xF86XK_AudioMute),        spawn "amixer -c0 set Front 0% 0%")
  369.      , ((mod4Mask, xF86XK_AudioMute),        spawn "~/bin/mic")
  370.      , ((controlMask .|. mod4Mask, xF86XK_AudioMute),        spawn "amixer -c0 set Front 75% 75%")
  371. --XF86AudioLowerVolume 0x1008ff11
  372.     --, ((0, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Master 5dB-")
  373.     --, ((controlMask, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Mic 5dB-")
  374.     --, ((shiftMask, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Front 5dB-")
  375.     , ((0, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Master 5%-")
  376.     , ((controlMask, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Mic 5%-")
  377.     , ((controlMask .|. shiftMask , xF86XK_AudioLowerVolume), spawn "amixer -c7 set Mic 5%-")
  378.     , ((shiftMask, xF86XK_AudioLowerVolume), spawn "amixer -c0 set Front 5%-")
  379.    , ((modm, xF86XK_AudioLowerVolume), spawn "~/bin/headphones -l")
  380. --XF86AudioRaiseVolume 0x1008ff13
  381.     --, ((0, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Master 5dB+")
  382.     --, ((controlMask, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Mic 5dB+")
  383.     --, ((shiftMask, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Front 5dB+")
  384.     , ((0, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Master 5%+")
  385.     , ((controlMask, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Mic 5%+")
  386.    , ((controlMask .|. shiftMask , xF86XK_AudioRaiseVolume), spawn "amixer -c7 set Mic 5%+")
  387.     , ((shiftMask, xF86XK_AudioRaiseVolume), spawn "amixer -c0 set Front 5%+")
  388.     , ((modm, xF86XK_AudioRaiseVolume), spawn "~/bin/headphones -h")
  389.      -- Rotate through the available layout algorithms
  390.     , ((modm,               xK_space ), sendMessage NextLayout)
  391.     --, ((mod4Mask,               xK_space ), sendMessage PreviousLayout)
  392.     --  Reset the layouts on the current workspace to default
  393.     , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  394.  
  395.     -- Resize viewed windows to the correct size
  396.     , ((modm .|. controlMask,               xK_r     ), refresh)
  397.  
  398.     -- Move focus to the next window
  399.     , ((modm,               xK_Tab   ), windows W.focusDown)
  400.  
  401.     -- Move focus to the previous window
  402.     , ((mod4Mask,               xK_Tab     ), windows W.focusUp  )
  403.  
  404. -- Alt+k n Windows switch
  405.  
  406.    --[
  407.      --   ((modMask , xK_k), submap . M.fromList $
  408.        -- [((0, k), focusNth i) | (i, k) <- zip [0 .. 8] [xK_1 ..]])
  409.         --]
  410.  
  411.  
  412.  
  413.  --Window navigator
  414.     , ((modm .|. shiftMask,   xK_Right), sendMessage $ Go R)
  415.     , ((modm .|. shiftMask,   xK_Left ), sendMessage $ Go L)
  416.     , ((modm .|. shiftMask,   xK_Up   ), sendMessage $ Go U)
  417.     , ((modm .|. shiftMask,   xK_Down ), sendMessage $ Go D)
  418.     , ((modm .|. controlMask, xK_Right), sendMessage $ Swap R)
  419.     , ((modm .|. controlMask, xK_Left ), sendMessage $ Swap L)
  420.     , ((modm .|. controlMask, xK_Up   ), sendMessage $ Swap U)
  421.     , ((modm .|. controlMask, xK_Down ), sendMessage $ Swap D)
  422.  
  423. -- Rotate slaves
  424.    , ((modm .|. shiftMask, xK_Tab   ), rotSlavesUp)
  425.  
  426.     -- Move focus to the master window
  427.     , ((mod4Mask, xK_m ), windows W.focusMaster  )
  428.  
  429.     -- Swap the focused window and the master window
  430.     , ((modm,               xK_Return), windows W.swapMaster)
  431.  
  432.     -- Swap the focused window with the next window
  433.     , ((mod4Mask, xK_Down     ), windows W.swapDown  )
  434.  
  435.     -- Swap the focused window with the previous window
  436.     , ((mod4Mask, xK_Up     ), windows W.swapUp    )
  437.  
  438.     -- Shrink the master area
  439.     , ((modm,               xK_h     ), sendMessage Shrink)
  440.  
  441.     -- Expand the master area
  442.     , ((modm,               xK_l     ), sendMessage Expand)
  443.  
  444.     -- Push window back into tiling
  445.     , ((modm,               xK_t     ), withFocused $ windows . W.sink)
  446.  
  447.     -- Increment the number of windows in the master area
  448.     , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
  449.  
  450.     -- Deincrement the number of windows in the master area
  451.     , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
  452.  
  453.     -- toggle the status bar gap (used with avoidStruts from Hooks.ManageDocks)
  454.     , ((modm .|. controlMask, xK_b ), sendMessage ToggleStruts)
  455.     , ((modm, xK_d ), sendMessage ToggleStruts)
  456.    
  457. --menu max min
  458.     , ((modm, xK_backslash), withFocused (sendMessage . maximizeRestore))
  459.     , ((modm,               xK_o ), windowMenu)
  460.     , ((modm,               xK_slash     ), withFocused (\f -> sendMessage (MinimizeWin f)))
  461.     , ((modm .|. shiftMask, xK_slash     ), sendMessage RestoreNextMinimizedWin)
  462.  
  463.  
  464.     -- Quit xmonad
  465.     , ((modm .|. shiftMask, xK_f     ),  io (exitWith ExitSuccess))
  466.  
  467.     -- Restart xmonad
  468.     , ((modm              , xK_q     ), restart "xmonad" True)
  469.     , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  470.  
  471. --Combinators
  472. --, ((modm,  xK_t ),   cycleThroughLayouts ["Tall", "Mirror Tall", "Full"])
  473. --, ((modm .|. controlMask, xK_f), sendMessage $ JumpToLayout "Full")
  474.  
  475. -- ResizebleYile
  476.     , ((modm,               xK_a), sendMessage MirrorShrink)
  477.     , ((modm,               xK_z), sendMessage MirrorExpand)
  478. -- MosaicAlt
  479.      , ((modm .|. shiftMask  , xK_s    ), withFocused (sendMessage . tallWindowAlt))
  480.      , ((modm .|. shiftMask  , xK_w    ), withFocused (sendMessage . wideWindowAlt))
  481.      , ((modm .|. controlMask, xK_space), sendMessage resetAlt)
  482. -- MouseResizable
  483.      , ((modm,               xK_b), sendMessage ShrinkSlave) -- %! Shrink a slave area
  484.      , ((modm,               xK_n), sendMessage ExpandSlave) -- %! Expand a slave area
  485.  
  486. -- Gaps
  487.     , ((modm .|. controlMask, xK_g), sendMessage $ ToggleGaps)  -- toggle all gaps
  488.     , ((modm .|. controlMask, xK_t), sendMessage $ ToggleGap U) -- toggle the top gap
  489.     --, ((modm .|. controlMask, xK_w), sendMessage $ IncGap R 5)  -- increment the right-hand gap
  490.     --, ((modm .|. controlMask, xK_q), sendMessage $ DecGap R 5)  -- decrement the right-hand gap
  491. --prompt
  492.     -- , ((mod4Mask, xK_a     ), sendMessage NextLayout >> (dynamicLogString myLogHookD >>= \d->spawn $"xmessage "++d))
  493. --utils
  494.  
  495. --reflect
  496.     , ((modm .|. controlMask, xK_x), sendMessage $ Toggle REFLECTX)
  497.     , ((modm .|. controlMask, xK_y), sendMessage $ Toggle REFLECTY)
  498. --grid
  499.    , ((modm, xK_g), goToSelected defaultGSConfig)
  500.  
  501.    , ((modm,                xK_e    ), viewEmptyWorkspace)
  502.  
  503.    -- , ((modm .|. shiftMask,  xK_e    ), tagToEmptyWorkspace)
  504.  
  505.     ]
  506.     ++
  507.     --E
  508.     -- mod-[1..9], Switch to workspace N
  509.     -- mod-shift-[1..9], Move client to workspace N
  510.     --
  511.     [((m .|. modm, k), windows $ f i)
  512.         | (i, k) <- zip (XMonad.workspaces conf) ([xK_1 .. xK_9])
  513.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  514.     ++
  515.  
  516.     --
  517.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  518.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  519.     --
  520.     [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  521.       | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  522.       , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  523. ------------------------------------------------------------------------
  524. -- Mouse bindings: default actions bound to mouse events
  525.  
  526. myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  527.  
  528.     -- mod-button1, Set the window to floating mode and move by dragging
  529.     [ --((modMask, button1), (\w -> focus w >> mouseMoveWindow w >> windows W.swapMaster))
  530.       ((modMask, button1), specialMove)
  531.  
  532.     -- mod-button2, Raise the window to the top of the stack
  533.     , ((modMask, button2), (\w -> focus w >> windows W.swapMaster))
  534.  
  535.     -- mod-button3, Set the window to floating mode and resize by dragging
  536.     --, ((modMask, button3), (\w -> focus w >> mouseResizeWindow w))
  537.     , ((mod4Mask, button3),               (\w -> focus w >> Sqr.mouseResizeWindow w False))
  538.     , ((mod4Mask .|. shiftMask, button3), (\w -> focus w >> Sqr.mouseResizeWindow w True ))
  539.     , ((modMask, button3), (\w -> focus w >> Flex.mouseResizeWindow w))
  540.  
  541.  
  542.     -- you may also bind events to the mouse scroll wheel (button4 and button5)
  543.     ]
  544.  
  545. -- Window rules:
  546.  
  547. -- To find the property name associated with a program, use
  548. -- > xprop | grep WM_CLASS
  549. -- and click on the client you're interested in.
  550. --
  551. -- To match on the WM_NAME, you can use 'title' in the same way that
  552. -- 'className' and 'resource' are used below.
  553. --
  554. myManageHook = composeAll
  555.     [ className =? "MPlayer"        --> doCenterFloat
  556.     , className =? "Vlc"       --> doCenterFloat
  557.     , className =? "Sonata"       --> doCenterFloat
  558.     , className =? "Terminal"       --> doCenterFloat
  559.     --, className =? "URxvt"       --> doCenterFloat
  560.     , className =? "kmplayer"       --> doCenterFloat
  561.     , className =? "Search"       --> doCenterFloat
  562.     , className =? "VNC Viewer: Connection Options"       --> doCenterFloat
  563.     , className =? "VNC Authentication [VncAuth]"       --> doCenterFloat
  564.     , className =? "VNC Viewer: Connection Details"       --> doCenterFloat
  565.     , className =? "Vnciewer"       --> doCenterFloat
  566.     , className =? "Multisync-gui"       --> doCenterFloat
  567.     , className =? "Ucview"       --> doCenterFloat
  568.     , className =? "V4l2ucp" --> doCenterFloat
  569.     , className =? "Search"       --> doCenterFloat
  570.     , className =? "Tomboy"       --> doCenterFloat
  571.     , className =? "Gnote"       --> doCenterFloat
  572.     , className =? "xclock"       --> doFloat
  573.     , className =? "Bluetooth-properties"       --> doFloat
  574.     , className =? "Xdialog"       --> doFloat
  575.     , className =? "Zenity"       --> doFloat
  576.     , className =? "wesnoth"       --> doFloat
  577.     , className =? "Gnash"       --> doFloat
  578.     , className =? "v4l2-tool"       --> doFloat
  579.     , className =? "gcalctool"       --> doFloat
  580.     , className =? "org-alchemy-core-Alchemy"       --> doFloat
  581.     , className =? "v4l2ucp"       --> doFloat
  582.     , className =? "Wine"       --> doFloat
  583.     , className =? "Dolphin"       --> doFloat
  584.     , className =? "Gogh"       --> doFloat
  585.     , className =? "Flash.exe"       --> doFloat
  586.     , className =? "Qjackctl"       --> doFloat
  587.     , className =? "Gimp"           --> doF (W.shift "graph")
  588.     , className =? "Ufraw"           --> doF (W.shift "graph")
  589.     , className =? "mypaint"           --> doF (W.shift "graph")
  590.     , className =? "XXkb"           --> doIgnore
  591.     , className =? "Conky"          --> doIgnore
  592.     , className =? "stalonetray"    --> doIgnore
  593.     -- , className =? "lxpanel"    --> doIgnore
  594.     , className =? "avant-window-navigator"    --> doIgnore
  595.     , className =? "Stalonetray"    --> doIgnore
  596.     , resource  =? "desktop_window" --> doIgnore
  597.     , resource  =? "kdesktop"       --> doIgnore
  598.     , resource  =? "gwenview"       --> doFloat
  599.     , resource  =? "webcamstudio"       --> doFloat
  600.     , resource  =? "glxgears"       --> doFloat
  601.     , className =? "Sylpheed"       --> doF (W.shift "mail")
  602.     , className =? "Sylpheed-claws"       --> doF (W.shift "mail")
  603.     , className =? "Kmail"       --> doF (W.shift "mail")
  604.     , className =? "Evolution"       --> doF (W.shift "mail")
  605.     , className =? "Ekiga"          --> doF (W.shift "sip")
  606.     , className =? "Skype"          --> doF (W.shift "sip")
  607.     , className =? "Liferea-bin"        --> doF (W.shift "www")
  608.     , className =? "Akregator"        --> doF (W.shift "www")
  609.     , className =? "Firefox"        --> doF (W.shift "www")
  610.     , className =? "Navigator"        --> doF (W.shift "www")
  611.     , className =? "RSSOwl"        --> doF (W.shift "www")
  612.     , className =? "Pidgin"         --> doF (W.shift "im")
  613.     , className =? "OpenOffice.org 3.0"       --> doF (W.shift "tab")
  614.     , className =? "Lyx"       --> doF (W.shift "tab")
  615.     , className =? "Abiword"       --> doF (W.shift "tab")
  616.     , className =? "Gnumeric"       --> doF (W.shift "tab")
  617.     , className =? "Emacs"          --> doF (W.shift "sys")
  618.     , className =? "Xterm"          --> doCenterFloat
  619.     , className =? "Amarok"          --> doF (W.shift "media")
  620.     , className =? "Webcamsudio"          --> doF (W.shift "sip")
  621.     --, className =? "vlc"          --> doF (W.shift "media")
  622.     , className =? "Krusader"       --> doF (W.shift "files")
  623.     , className =? "Xnest"          --> doF (W.shift "media")
  624.     , className =? "Konqueror"          --> doF (W.shift "www")
  625.     , className =? "Bluetooth-sendto"  --> doFloat
  626.     , className =? "Gloobus-preview" --> doFloat
  627.     , className =? "CinePaint"                  --> doFloat
  628.  ]
  629. myManageHook2 = composeOne
  630.    [ isFullscreen -?> doFullFloat ]
  631. -- Whether focus follows the mouse pointer.
  632. --myFocusFollowsMouse :: Bool
  633. myFocusFollowsMouse = True
  634. --myFocusFollowsMouse = False
  635.  
  636. gimp = withIM (0.16) (Role "gimp-toolbox") $
  637.              reflectHoriz $
  638.              withIM (0.16) (Role "gimp-dock") (maximize(minimize(windowNavigation (OneBig (3/4) (3/4)))))
  639.  
  640.  
  641. myTabConfig = defaultTheme { inactiveBorderColor = "#CCCCCC"
  642.                                    , activeTextColor = "#000000"
  643.                                    , decoHeight = 20
  644.                                    ,fontName = "xft:terminus:size=10"}
  645.  
  646. gimpt = withIM (0.16) (Role "gimp-toolbox") $
  647.              reflectHoriz $
  648.              withIM (0.16) (Role "gimp-dock") (noBorders (tabbedAlways shrinkText myTabConfig))
  649.  
  650. --skype=withIM (1%4) (Role "MainWindow") (maximize(minimize(windowNavigation ((mosaic 1.5 [])))))
  651. --skype = withIM (1%4) (Title "nonameandnick - Skype™ (Beta)" ) $
  652. -- (maximize(minimize(windowNavigation ((mosaic 1.5 [])))))
  653. skype = withIM (1%4) (Role "buddy_list") $
  654.  (maximize(minimize(windowNavigation ((mosaic 1.5 [])))))
  655. -----------------------------------------------------------------------
  656. --myLogHookF :: X ()
  657. myLogHookD :: X ()
  658. --myLogHookD = dynamicLog
  659. myLogHookD = dynamicLogWithPP myPP
  660. --myLogHookD = dynamicLogWithPP dzen2PP
  661. --myLogHookF = fadeInactiveLogHook fadeAmount
  662.      --where fadeAmount = 0.8
  663. myPP = xmobarPP { ppCurrent = xmobarColor "orange" "" . wrap "[" "]"
  664.                 --,ppOutput = hPutStrLn h
  665.                  --,ppOutput = hPutStrLn xmproc
  666.                  , ppLayout  = xmobarColor "yellow" "" . wrap "[" "]"
  667.                  , ppTitle   = xmobarColor "white"  "" . shorten 40
  668.                  , ppVisible = wrap "(" ")"
  669.                  , ppUrgent = xmobarColor "black" "red" . xmobarStrip
  670.                  }
  671.  
  672.  
  673. dzen2PP = dzenPP { ppCurrent  = dzenColor "white" "#2b4f98" . pad
  674.                      , ppVisible  = dzenColor "black" "#999999" . pad
  675.                      , ppHidden   = dzenColor "black" "#cccccc" . pad
  676.                      , ppHiddenNoWindows = const ""
  677.                      , ppUrgent   = dzenColor "red" "yellow" . dzenStrip
  678.                      , ppWsSep    = ""
  679.                      , ppSep      = ""
  680.                      , ppLayout   = dzenColor "black" "#cccccc" .
  681.                                     (\ x -> case x of
  682.                                               "TilePrime Horizontal" -> " TTT "
  683.                                               "TilePrime Vertical"   -> " []= "
  684.                                               "Hinted Full"          -> " [ ] "
  685.                                               _                      -> pad x
  686.                                     )
  687.                      , ppTitle    = ("^bg(#324c80) " ++) . dzenEscape
  688.                      }
  689. ------------------------------------------------------------------------
  690. -- Startup hook
  691. myPlacement = inBounds (underMouse (0, 0))
  692. myStartupHook = return () >> spawn "/home/AlexYeCu/bin/autostart"
  693. main=do
  694.    --xmproc <- spawnPipe "/home/AlexYeCu/.cabal/bin/xmobar" "/home/AlexYeCu/.xmobarrc"
  695.    xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
  696.      {
  697.       focusFollowsMouse  = myFocusFollowsMouse
  698.      , borderWidth        = myBorderWidth
  699.      , modMask            = myModMask
  700.      , numlockMask        = myNumlockMask
  701.      , workspaces         = myWorkspaces
  702.      , normalBorderColor  = myNormalBorderColor
  703.      , focusedBorderColor = myFocusedBorderColor
  704.      , keys               = myKeys
  705.      , mouseBindings      = myMouseBindings
  706.      --, logHook            = myLogHookD
  707.      , logHook = do
  708.            dynamicLogWithPP $ myPP
  709.            --dynamicLogWithPP $ dzen2PP
  710.    
  711.  
  712.             --fadeInactiveLogHook 0.9
  713.  
  714.      , startupHook        = myStartupHook
  715.      , manageHook=myManageHook <+> manageDocks <+> placeHook myPlacement <+> manageMenus <+> manageDialogs <+> myManageHook2
  716.      ,layoutHook= gaps [(U,49), (R,0)] $
  717.            smartBorders $
  718.            --avoidStruts $      
  719.            mkToggle (single REFLECTX) $
  720.            --mkToggle (single REFLECTY) $
  721.            onWorkspace "sys" (maximize(minimize(windowNavigation (OneBig (3/4) (3/4) ||| mosaic 1.5 [] ||| ResizableTall 1 (3/100) (1/2) [] ||| StackTile 1 (3/100) (1/2))))) $
  722.            onWorkspace "im" (skype
  723.  ||| withIM (1%4) (Role "buddy_list") (windowNavigation ((OneBig (3/4) (3/4)))) ) $
  724.            onWorkspace "sip" (skype ||| maximize(minimize(windowNavigation (mouseResizableTileMirrored )))) $
  725.            onWorkspace "mail" (maximize(minimize(windowNavigation(mosaic 1.5 [] ||| ResizableTall 1 (3/100) (1/2) [] ||| OneBig (3/4) (3/4))))) $
  726.            onWorkspace "www" (minimize(maximize(centerMaster Grid)) ||| noBorders Full ||| maximize(minimize(windowNavigation(mosaic 1.5 [])))) $
  727.            onWorkspace "tab" ((noBorders (tabbedAlways shrinkText myTabConfig) ||| minimize(maximize(windowNavigation(OneBig (5/6) (4/5))))) ) $
  728.            onWorkspace "graph" (gimp ||| minimize(maximize(windowNavigation(OneBig (5/6) (4/5)))) ||| minimize(maximize(windowNavigation(mouseResizableTile)))) $
  729.            onWorkspace "files" (maximize(minimize(windowNavigation (mosaic 1.5 []) ||| TwoPane (3/100) (1/2) ||| Circle ||| noBorders Full))) $
  730.            onWorkspace "media" (minimize(noBorders Full ||| windowNavigation(minimize(maximize(mosaic 1.5 []))) ||| Circle ||| simplestFloat)) $
  731.            windowNavigation (maximize(minimize(windowNavigation (mosaic 1.5 [])))) ||| maximize(Circle) ||| noBorders Full ||| windowNavigation (OneBig (3/4) (3/4))
  732. }
RAW Paste Data