elhackerlibre

my config xmonad.hs

May 1st, 2017
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env runhugs +l
  2. --
  3. -- xmonad.hs
  4. -- Copyright (C) 2017 Felix Molero <fmolero69@gmail.com>
  5. --
  6. -- Distributed under terms of the GPLv3+ license.
  7. -- Xmonad V 0.13
  8. --
  9. -- IMPORTS MODULES:
  10. import XMonad
  11. import XMonad.Hooks.DynamicLog
  12. import XMonad.Hooks.EwmhDesktops
  13. import XMonad.Hooks.ManageDocks
  14. import XMonad.Util.Run(spawnPipe)
  15. import XMonad.Util.SpawnOnce
  16. import Data.Monoid
  17. import System.Exit
  18. import qualified XMonad.StackSet as W
  19. import qualified Data.Map        as M
  20.  
  21. -- Funciones principales
  22. myModMask             = mod4Mask
  23. myFocusFollowsMouse   :: Bool
  24. myFocusFollowsMouse   = True
  25. myTerminal            = "termite"
  26. myBar                 = "date '+%a %d %b %Y %I:%M:%P' && LANG=es_VE.utf-8 xmobar ~/.xmobarrc"
  27. myWorkspaces          = ["1","2","3","4","5","6","7","8","9"]
  28. myNormalBorderColor   = "#404040"
  29. myFocusedBorderColor  = "#989898"
  30. myBorderWidth         = 1
  31. myKeys conf@(XConfig {XMonad.modMask = modm} ) = M.fromList $
  32. --toggleStrutsKey XConfig {XMonad.modMask = modm} = (modMask, xK_b)
  33.  
  34.     ---------------------------------------------------------------------------
  35.     ------------------------ Atajos de teclados -------------------------------
  36.     ---------------------------------------------------------------------------
  37.     ---------------------- Lanzador de útilidades -----------------------------
  38.     [ (( modm,               xK_d      ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe\"")
  39.     , (( modm,               xK_g      ), spawn "gmrun")
  40.     , (( modm,               xK_Return ), spawn $ XMonad.terminal conf)
  41.  
  42.    ----------------------- Lanzador de aplicaciones ---------------------------
  43.     , (( modm,               xK_F1     ), spawn "firefox"   )
  44.     , (( modm,               xK_F2     ), spawn "thunar"    )
  45.     , (( modm,               xK_F3     ), spawn "mousepad"  )
  46.     , (( modm .|. shiftMask, xK_F1     ), spawn "palemoon"  )
  47.     , (( modm .|. shiftMask, xK_F2     ), spawn "gimp"      )
  48.     , (( modm .|. shiftMask, xK_F3     ), spawn "inkscape"  )
  49.  
  50.    ---------------------- Control de música [MPC] ------------------------------
  51.     , (( modm,               xK_p      ), spawn "mpc toggle" )
  52.     , (( modm,               xK_s      ), spawn "mpc stop"   )
  53.     , (( modm,               xK_b      ), spawn "mpc prev"   )
  54.     , (( modm,               xK_n      ), spawn "mpc next"   )
  55.     , (( modm,               xK_plus   ), spawn "mpc volume +3")
  56.     , (( modm,               xK_minus  ), spawn "mpc volume -3")
  57.  
  58.    --------------------- Control de volumen -----------------------------------
  59.     , (( modm .|. shiftMask, xK_plus   ), spawn "amixer set Master 5%+ unmute")
  60.     , (( modm .|. shiftMask, xK_minus  ), spawn "amixer set Master 5%- unmute")
  61.     , (( modm .|. shiftMask, xK_m      ), spawn "amixer set Master toggle"    )
  62.  
  63.    --------------------- Funcionalidad del xmonad -----------------------------
  64.     , (( modm,               xK_r      ), spawn "xmonad --recompile; xmonad --restart")
  65.     , (( modm,               xK_e      ), io (exitWith ExitSuccess))
  66.     , (( modm .|. shiftMask, xK_q      ), kill )
  67.     , (( modm .|. shiftMask, xK_r      ), refresh)
  68.     , (( modm,               xK_Tab    ), windows W.focusDown)
  69.     , (( modm,               xK_j      ), windows W.focusDown)
  70.     , (( modm,               xK_k      ), windows W.focusUp)
  71.     , (( modm .|. shiftMask, xK_m      ), windows W.focusMaster)
  72.     , (( modm .|. shiftMask, xK_Return ), windows W.swapMaster)
  73.     , (( modm .|. shiftMask, xK_j      ), windows W.swapDown)
  74.     , (( modm .|. shiftMask, xK_k      ), windows W.swapUp)
  75.     , (( modm,               xK_h      ), sendMessage Shrink)
  76.     , (( modm,               xK_l      ), sendMessage Expand)
  77.     , (( modm,               xK_t      ), withFocused $ windows . W.sink)
  78.     , (( modm,               xK_comma  ), sendMessage (IncMasterN 1)) -- Inc
  79. --    , (( modm,               xK_comma  ), sendMessage (IncMasterN 1))
  80.   : , (( modm,               xK_period ), sendMessage (IncMasterN (-1)))
  81.     , (( modm .|. shiftMask, xK_b      ), sendMessage ToggleStruts)
  82.     ]
  83.     ++
  84.  
  85.     --
  86.     -- mod-[1..9], Switch to workspace N
  87.     --
  88.     -- mod-[1..9], Switch to workspace N
  89.     -- mod-shift-[1..9], Move client to workspace N
  90.     --
  91.     [((m .|. modm, k), windows $ f i)
  92.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
  93.         , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
  94.     ++
  95.  
  96.     --
  97.     -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
  98.     -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
  99.     --
  100.     [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
  101.         | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
  102.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
  103.  
  104. -------------------------------------------------------------------------------
  105.  
  106. -- Mouse bindings: default actions bound to mouse events
  107. --
  108. myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
  109.  
  110.     -- mod-button1, Set the window to floating mode and move by dragging
  111.     [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
  112.                                        >> windows W.shiftMaster))
  113.  
  114.     -- mod-button2, Raise the window to the top of the stack
  115.     , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
  116.  
  117.     -- mod-button3, Set the window to floating mode and resize by dragging
  118.     , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
  119.                                        >> windows W.shiftMaster))
  120.  
  121.     -- you may also bind events to the mouse scroll wheel (button4 and button5)
  122.     ]
  123.  
  124. -------------------------------------------------------------------------------
  125.  
  126. myLayout = tiled ||| Mirror tiled ||| Full
  127.   where
  128.     -- default tiling algorithm partitions the screen into two panes
  129.     tiled   = Tall nmaster delta ratio
  130.  
  131.     -- The default number of windows in the master pane
  132.     nmaster = 1
  133.  
  134.     -- Default proportion of screen occupied by master pane
  135.     ratio   = 1/2
  136.  
  137.     -- Percent of screen to increment by when resizing panes
  138.     delta   = 3/100
  139.  
  140. -------------------------------------------------------------------------------
  141.  
  142.  -- myManageHook = composeAll
  143.  --   [ className =? "MPlayer"        --> doFloat
  144.  --   , className =? "Gimp"           --> doFloat
  145.  --   , resource  =? "desktop_window" --> doIgnore
  146.  --   , resource  =? "kdesktop"       --> doIgnore ]
  147.  
  148. -------------------------------------------------------------------------------
  149.  
  150. myStartupHook = do
  151.       spawnOnce "mpd"
  152.       spawnOnce "compton -cCGb"
  153.       spawnOnce "thunar --daemon"
  154.       spawnOnce "feh --bg-scale ~/.background/xmonad2.png"
  155.       spawnOnce "conky -d; sleep 1 && transset-df .5 -n Conky"
  156.  
  157. -------------------------------------------------------------------------------
  158.  
  159. myManageHook = manageDocks <+> manageHook defaultConfig
  160. myLayoutHook = avoidStruts  $ layoutHook defaultConfig
  161. myEventHook  = docksEventHook <+> handleEventHook
  162.                defaultConfig  <+> fullscreenEventHook
  163.  
  164. myLogHook   = dynamicLogWithPP xmobarPP
  165.               { ppOutput        = hPutStrLn xmproc
  166.               , ppTitle         = xmobarColor "darkorange" "" . shorten 50
  167.               , ppUrgent        = xmobarColor "darkred" "" . wrap "[" "]"
  168.               , ppCurrent       = xmobarColor "darkorange" ""
  169.               , ppVisible       = xmobarColor "#404040" ""
  170.               }
  171.  
  172. -------------------------------------------------------------------------------
  173. main = xmonad =<< statusBar myBar toggleStrutsKey myDefConfig
  174.  
  175. --defaults = defaultConfig
  176. myDefConfig = defaultConfig
  177.             -- Keys bindings
  178.               { keys              = myKeys
  179.               , mouseBindings     = myMouseBindings  
  180.  
  181.             -- Simple stuff
  182.              , modMask            = myModMask
  183.              , terminal           = myTerminal
  184.              , workspaces         = myWorkspaces
  185.              , borderWidth        = myBorderWidth
  186.              , focusFollowsMouse  = myFocusFollowsMouse
  187.              , normalBorderColor  = myNormalBorderColor
  188.              , focusedBorderColor = myFocusedBorderColor
  189.  
  190.             -- Hooks, layouts
  191.              , logHook            = myLogHook
  192.              , layoutHook         = myLayoutHook
  193.              , manageHook         = myManageHook
  194.              , startupHook        = myStartupHook
  195.              , handleEventHook    = myEventHook
  196.               }
Add Comment
Please, Sign In to add comment