Advertisement
Guest User

Untitled

a guest
Aug 25th, 2011
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haskell 26.96 KB | None | 0 0
  1. ------------------------------------------------------------------------
  2. -- ~/.xmonad/xmonad.hs
  3. -- validate syntax: xmonad --recompile
  4. {-# LANGUAGE NoMonomorphismRestriction #-}
  5. ------------------------------------------------------------------------
  6.  
  7. -- Import -------------------------------------------------
  8.  
  9. --import XMonad                         -- XMonad
  10. import XMonad hiding ( (|||) )
  11. import qualified XMonad.StackSet as W -- Keys
  12. import qualified Data.Map as M        -- Keys
  13. import System.Exit                    -- Exit
  14.  
  15. import XMonad.Hooks.DynamicLog        -- Xmobar
  16. import XMonad.Hooks.UrgencyHook       -- Urgent
  17. import XMonad.Hooks.InsertPosition    -- Focus windows
  18. import XMonad.Hooks.ManageHelpers     -- Helper functions
  19. import XMonad.Hooks.ManageDocks       -- App workspace
  20. import XMonad.Hooks.EwmhDesktops
  21. import XMonad.Hooks.FadeInactive(setOpacity)
  22.  
  23. import XMonad.Layout.ResizableTile    -- Rezise
  24. import XMonad.Layout.Tabbed           -- Tab
  25. import XMonad.Layout.Named            -- Named
  26. import XMonad.Layout.SubLayouts       -- Sub layouts
  27. import XMonad.Layout.Simplest         -- Simple Layout
  28. import XMonad.Layout.WindowNavigation -- Windows navigator
  29. import XMonad.Layout.LayoutHints
  30. import XMonad.Layout.LayoutModifier
  31. import XMonad.Layout.NoBorders
  32. import XMonad.Layout.Spacing
  33. import XMonad.Layout.Reflect
  34. import XMonad.Layout.IM
  35. import XMonad.Layout.ComboP
  36. import XMonad.Layout.TwoPane
  37. import XMonad.Layout.Named
  38. import XMonad.Layout.LayoutCombinators
  39. import XMonad.Layout.PerWorkspace
  40.  
  41. import XMonad.Actions.GridSelect      -- Grid
  42. import XMonad.Actions.CopyWindow      -- Copy window to workspace
  43. import XMonad.Actions.WindowGo        -- RunOrRaise, etc
  44. import XMonad.Actions.FloatKeys
  45. import XMonad.Actions.Commands
  46.  
  47. import XMonad.Prompt
  48. import XMonad.Prompt.Shell
  49.  
  50. import XMonad.Util.NamedScratchpad 
  51.  
  52. import XMonad.Config.Kde
  53.  
  54. import XMonad.ManageHook
  55. import XMonad.Util.Run
  56.  
  57. -- подключаем библиотеки X11
  58. import Foreign.C.Types (CLong)
  59. --import XMonad.Layout.BoringWindows    --
  60. import Data.List
  61. import qualified Data.Map as M
  62. import Data.Monoid
  63. import Graphics.X11
  64. import Graphics.X11.Xlib.Extras
  65. import System.Exit
  66. import System.IO
  67.  
  68. -----------------------------------------------------------
  69.  
  70.  
  71. scratchpads = [
  72.      NS "scratchpad" "~/bin/scratchpad" (resource =? "scratchpad") defaultFloating ,
  73.      NS "stardict" "stardict" (className =? "Stardict")
  74.          (customFloating $ W.RationalRect (1/6) (1/6) (2/3) (2/3))
  75.  ] where role = stringProperty "WM_WINDOW_ROLE"
  76.  
  77.  
  78.  
  79. -- Main -------------------------------------------------------
  80. main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
  81. myConfig = ewmh defaultConfig
  82.         { terminal = "urxvt"
  83.         , borderWidth = 1
  84.         , modMask = mod4Mask
  85.        
  86.         , normalBorderColor  = myNormalBorderColor
  87.         , focusedBorderColor = myFocusedBorderColor
  88.        
  89.         , keys = myKeys
  90.         , layoutHook  = myLayout
  91.         , manageHook  = myManage <+> manageMenus <+> manageDialogs
  92.         , workspaces  = myWorkspaces
  93. --      , logHook     = dynamicLogWithPP $ myDzenPP dzen
  94.         }
  95.  
  96. ---------------------------------------------------------------
  97. -- Bar ---------
  98. myBar = "xmobar"
  99. --myBar = "dzen2"
  100. ----------------
  101. ------------------------------------------------------------------
  102. -- Custom Bar ------------------------------------------------
  103. myPP = xmobarPP { ppCurrent = xmobarColor "#6587a8" ""
  104.                 , ppUrgent = xmobarColor "#fab20c" "" . wrap "[" "]"
  105.                 , ppTitle = xmobarColor "#afafaf" "" . shorten 40
  106.                 , ppSep = xmobarColor "#6587a8" "" " >> "
  107. }
  108. -----------------------------------------------------------------------
  109. -- Fonts and colours ------------------------------------
  110.  
  111. -- Color, font and iconpath definitions:
  112. myFont = "-xos4-terminus-medium-r-normal-*-14-*-*-*-c-*-iso10646-1"
  113. myIconDir = "/home/neg/.dzen"
  114. myDzenFGColor = "#555555"
  115. myDzenBGColor = "#222222"
  116. myNormalFGColor = "#ffffff"
  117. myNormalBGColor = "#0f0f0f"
  118.  
  119. myNormalBorderColor = "#202020"
  120. myFocusedBorderColor = "#404040"
  121.  
  122. myFocusedFGColor = "#f0f0f0"
  123. myFocusedBGColor = "#333333"
  124. myUrgentFGColor = "#0099ff"
  125. myUrgentBGColor = "#0077ff"
  126. myIconFGColor = "#777777"
  127. myIconBGColor = "#0f0f0f"
  128. mySeperatorColor = "#555555"
  129.  
  130. ------------------------------------------------------------------
  131. -- XPConfig conf ----------------------------------------
  132. myXPConfig = defaultXPConfig
  133.     {
  134.     --font = "-elite-laptop-bold-r-normal--28-280-72-72-c-140-koi8-r"
  135.       font = "xft:Terminus"
  136.     , bgColor =  "#000000"
  137.     , fgColor =  "#ffffff"
  138.     , fgHLight = "#ffffff"
  139.     , bgHLight = "#00ffff"
  140.     , borderColor = "#000000"
  141.     , promptBorderWidth = 1
  142.     , position = Bottom
  143.     , height = 32
  144.     , historySize = 100
  145.     --, historyFilter = ""
  146.     --, promptKeymap = ""
  147.     --, completionKey = ""
  148.     --, defaultText = ""
  149.     --, autoComplete = "KeySym"
  150.     --, showCompletionOnTab = ""
  151.     }
  152.  
  153. ------------------------------------------------------------
  154. -- 4. Additional ManageHooks
  155. ------------------------------------------------------------
  156.  
  157. manageConkeror :: ManageHook
  158. manageConkeror =
  159.     className =? "Conkeror"
  160.     --> composeOne
  161.         [ ("*" `isPrefixOf`) `fmap` title -?> doF W.focusDown
  162.         , stringProperty "WM_WINDOW_ROLE" =? "console" -?> doFlopDown ]
  163.  
  164. manageDocs :: ManageHook
  165. manageDocs = composeOne
  166.     [ className =? c -?> doShift "4:docs"
  167.     | c <- [ "Xpdf"
  168.            , "Zathura"
  169.            ]]
  170.  
  171. -- liftX lifts a normal X action into a Query (as expected by -->)
  172. -- idHook ensures the proper return type
  173. manageEmacs :: ManageHook
  174. manageEmacs =
  175.     className =? "Emacs"
  176.     --> (ask >>= doF . \w -> (copyWindow w "3:emacs"))
  177.     <+> (ask >>= \w -> liftX (setOpacity w 0.9) >> idHook)
  178.  
  179. manageGimp :: ManageHook
  180. manageGimp =
  181.     className =? "Gimp"
  182.     --> (doShift "8:gimp")
  183.     <+> composeOne
  184.          [ stringProperty "WM_WINDOW_ROLE" =? "gimp-image-window"
  185.             -?> doCenterFloat
  186.          , stringProperty "WM_WINDOW_ROLE" =? "gimp-image-new"
  187.             -?> doCenterFloat
  188.          , stringProperty "WM_WINDOW_ROLE" =? "gimp-dock"
  189.             -?> doTopRightFloat
  190.          , stringProperty "WM_WINDOW_ROLE" =? "gimp-toolbox"
  191.             -?> doTopLeftFloat
  192.          , stringProperty "WM_WINDOW_ROLE" =? "gimp-toolbox-color-dialog"
  193.             -?> doBottomRightFloat
  194.          , return True -?> doFloat ]
  195.  
  196. manageImages :: ManageHook
  197. manageImages = composeOne
  198.     [ className =? c
  199.     -?> doTopLeftFloat
  200.     <+> (ask >>= doF . \w -> (copyWindow w "5:images"))
  201.     | c <- [ "feh"
  202.            , "Display"
  203.            ]]
  204.  
  205. manageTerm :: ManageHook
  206. manageTerm = composeOne
  207.     [ className =? c
  208.     -?> (ask >>= \w -> liftX (setOpacity w 0.9) >> idHook)
  209.     <+> (ask >>= doF . \w -> (copyWindow w "7:term"))
  210.     | c <- [ "URxvt"
  211.            , "XTerm"
  212.            ]]
  213.  
  214. manageTransient :: ManageHook
  215. manageTransient =
  216.     composeAll
  217.         [ (className =? "Xmessage"
  218.                      --> doCenterFloat
  219.                      <+> (ask >>= \w -> liftX (setOpacity w 0.7) >> idHook))
  220.         , (stringProperty "WM_NAME" =? "xine Panel"
  221.                      --> doBottomRightFloat
  222.                      <+> (ask >>= \w -> liftX (setOpacity w 0.7) >> idHook))
  223.         ]
  224.  
  225. manageVideo :: ManageHook
  226. manageVideo = composeOne
  227.     [ className =? c -?> (ask >>= doF . \w -> (copyWindow w "6:video"))
  228.     | c <- [ "MPlayer"
  229.            , "xine"
  230.            ]]
  231.  
  232. manageWeb :: ManageHook
  233. manageWeb = composeOne
  234.     [ className =? c -?> (ask >>= doF . \w -> (copyWindow w "2:web"))
  235.     | c <- [ "Conkeror"
  236.            , "Dillo"
  237.            , "Firefox"
  238.            ]]
  239.  
  240. ------------------------------------------------------------
  241. -- 5. ManageHook Helpers
  242. ------------------------------------------------------------
  243.  
  244. doFlopDown :: ManageHook
  245. doFlopDown = doF (W.focusUp . W.swapDown)
  246.  
  247. doTopRightFloat :: ManageHook
  248. doTopRightFloat = ask
  249.                 >>= \w -> doF . W.float w . position . snd
  250.                 =<< liftX (floatLocation w)
  251.     where
  252.     position (W.RationalRect _ _ w h) = W.RationalRect (1-w) 0.03 w h
  253.  
  254. doTopLeftFloat :: ManageHook
  255. doTopLeftFloat = ask
  256.                 >>= \w -> doF . W.float w . position . snd
  257.                 =<< liftX (floatLocation w)
  258.     where
  259.     position (W.RationalRect _ _ w h) = W.RationalRect 0 0.03 w h
  260.  
  261. doBottomRightFloat :: ManageHook
  262. doBottomRightFloat = ask
  263.                     >>= \w -> doF . W.float w . position . snd
  264.                     =<< liftX (floatLocation w)
  265.     where
  266.     position (W.RationalRect _ _ w h) = W.RationalRect (1-w) (1-h) w h
  267.  
  268. doBottomLeftFloat :: ManageHook
  269. doBottomLeftFloat = ask
  270.                     >>= \w -> doF . W.float w . position . snd
  271.                     =<< liftX (floatLocation w)
  272.     where
  273.     position (W.RationalRect _ _ w h) = W.RationalRect 0 (1-h) w h
  274.  
  275.  
  276. ------------------------------------------------------------------
  277. -- Workspaces ----------------------------------------------
  278. myWorkspaces = ["1:term", "2:web", "3:book", "4:media", "7:other"]
  279. ------------------------------------------------------------------
  280.  
  281. -- <grid-select>
  282. myColorizer = colorRangeFromClassName
  283.     (0x00,0x00,0x00) -- lowest inactive bg
  284.     (0xBB,0xAA,0xFF) -- highest inactive bg
  285.     (0x88,0x66,0xAA) -- active bg
  286.     (0xBB,0xBB,0xBB) -- inactive fg
  287.     (0x00,0x00,0x00) -- active fg
  288.   where
  289.     black = minBound
  290.     white = maxBound
  291.  
  292. --myGSConfig colorizer = (buildDefaultGSConfig myColorizer)
  293. --    { gs_cellheight   = 50
  294. --    , gs_cellwidth    = 200
  295. --    , gs_cellpadding  = 10
  296. --    , gs_font         = "xft:Terminus"
  297. --    }
  298.  
  299. ------------------------------------------------------------------
  300. --Layouts --------------------------------------------------
  301. ------------------------------------------------------------------
  302. myLayout =  avoidStruts $ windowNavigation $ addTabs shrinkText myTheme $ spacing 6 $
  303.             tall ||| mtall |||  term
  304.             where
  305.               rt    = ResizableTall 1 (3/100) (1/2) []
  306.               tall  = named "Tall" $ subLayout [0,1,2] (Simplest) $ rt
  307.               mtall = named "Mirror" $ subLayout [0,1,2] (Simplest) $ Mirror rt
  308.               term_rt    = ResizableTall 1 (3/100) (1/4) []
  309.               term  = named "term" $ reflectHoriz $ combineTwoP (term_rt) (mtall) (Simplest) (ClassName "Kopete")
  310.               fullscreenLayout = named "fullscreen" $ noBorders Full
  311. ------------------------------------------------------------------
  312. -- Manage ----------------------------------------------------
  313. ------------------------------------------------------------------
  314. myManage = namedScratchpadManageHook scratchpads <+> manageDocks
  315.         <+> composeAll [ isFullscreen            --> doFullFloat
  316.                         , className =? "Thunar"   --> doFloat
  317.                         , className =? "Gimp-2.6" --> doFloat
  318.                         , className =? "MPlayer"  --> doFloat
  319.                         , resource  =? "MainTerminal" --> doShift "1:term"
  320. --                      , transience'
  321.                         , className =? "Firefox"    --> doShift "2:web"
  322.                         , className =? "Gimp-2.6"   --> doShift "4:media"
  323.                         , className =? "Gimp-2.6"   --> doShift "4:media"
  324.                         , className =? "Okular"     --> doShift "3:book"
  325.                         ]
  326. -------------------------------------------------------------------------
  327.  
  328. -- Whether focus follows the mouse pointer.
  329. --myFocusFollowsMouse :: Bool
  330. --myFocusFollowsMouse = False
  331.  
  332. -------------------------------------------------------------------------
  333.  
  334. ------------------------------------------------------------------
  335. -- Custom Tab----------------------------------------------
  336. -- Theme options:
  337. ------------------------------------------------------------------
  338. myTheme = defaultTheme
  339.     { activeColor =         "#222222"
  340.     , inactiveColor =       "#000000"
  341.     , urgentColor =         "#110000"
  342.     , activeBorderColor =   "#222222"
  343.     , inactiveBorderColor = "#000000"
  344.     , urgentBorderColor =   "#cc0000"
  345.     , activeTextColor =     "#aaaaaa"
  346.     , inactiveTextColor =   "#888888"
  347.     , urgentTextColor =     "#cc0000"
  348.     , fontName = "" ++ myFont ++ ""
  349. --  , decoWidth = "29"
  350. --  , decoHeight = "29"
  351.     }
  352. -----------------------------------------------------------
  353.  
  354. ------------------------------------------------------------------
  355. -- Statusbar options:
  356. ------------------------------------------------------------------
  357. --myStatusBar = "xmobar"
  358. myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '1300' -ta 'l' -fg '" ++ myNormalFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  359. --myTopBar = "conky -c .conkytop | dzen2 -x '1300' -y '0' -h '16' -w '620' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  360. --myMPDBar = "conky -c .conkympd | dzen2 -x '0' -y '1184' -h '16' -w '1600' -ta 'l' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  361. --myHDDBar = "conky -c .conkyhdd | dzen2 -x '1600' -y '1184' -h '16' -w '320' -ta 'r' -fg '" ++ myDzenFGColor ++ "' -bg '" ++ myNormalBGColor ++ "' -fn '" ++ myFont ++ "'"
  362.  
  363. -- Urgency hint options:
  364. myUrgencyHook = withUrgencyHook dzenUrgencyHook
  365.     { args = ["-x", "0", "-y", "1184", "-h", "16", "-w", "1366", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] }
  366.  
  367.  
  368. ------------------------------------------------------------------
  369. -------------------- menuhook --------------------
  370. ------------------------------------------------------------------
  371.  
  372. getProp :: Atom -> Window -> X (Maybe [CLong])
  373. getProp a w = withDisplay $ \dpy -> io $ getWindowProperty32 dpy a w
  374.  
  375. checkAtom name value = ask >>= \w -> liftX $ do
  376.                 a <- getAtom name
  377.                 val <- getAtom value
  378.                 mbr <- getProp a w
  379.                 case mbr of
  380.                   Just [r] -> return $ elem (fromIntegral r) [val]
  381.                   _ -> return False
  382.  
  383. checkDialog = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_DIALOG"
  384. checkMenu = checkAtom "_NET_WM_WINDOW_TYPE" "_NET_WM_WINDOW_TYPE_MENU"
  385.  
  386. manageMenus = checkMenu --> doFloat
  387. manageDialogs = checkDialog --> doFloat
  388.  
  389.  
  390. -- Grid -------------------------------------------
  391. myGSConfig = defaultGSConfig { gs_cellwidth = 160 }
  392. ---------------------------------------------------
  393.  
  394. -- Keys ------------------------------------------------------------
  395. toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
  396.  
  397. myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
  398. ------------------------------------------------------------------
  399. -- Launch and Kill -----------------------------------------------
  400. ------------------------------------------------------------------
  401.     [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
  402.  
  403.     , ((modm, xK_l), sendMessage $ Go R)
  404.     , ((modm, xK_h), sendMessage $ Go L)
  405.     , ((modm, xK_k), sendMessage $ Go U)
  406.     , ((modm, xK_j), sendMessage $ Go D)
  407.  
  408. --  , ((modm, xK_grave), shellPrompt myXPConfig)
  409.  
  410. --  , ((0 ,                0x1008ff33), spawn "thunar")
  411. --  , ((0 ,                0x1008ff32), spawn "urxvt -e ncmpcpp")
  412. --  , ((0 ,                0x1008ff19), spawn "thunderbird")
  413. --  , ((0 ,                0x1008ff2a), spawn "oblogout")
  414.  
  415.     , ((modm,               xK_BackSpace), spawn "exe=`dmenu_path | dmenu -fn 'snap-7' -b -nb '#151515' -nf '#919191' -sb '#151515' -sf '#c98f0a' ` && eval \"exec $exe\"")
  416.  
  417.     , ((modm , xK_w), runOrRaiseNext "firefox" (className =? "Firefox"))
  418.     , ((modm , xK_e), runOrRaiseNext "kopete" (className =? "Kopete"))
  419.     , ((modm , xK_o), runOrRaiseNext "okular" (className =? "Okular"))
  420.     , ((modm , xK_x), runOrRaise "/home/neg/bin/urxvt" (resource =? "MainTerminal"))
  421. --  , ((modm , xK_x), runOrRaise "
  422.    
  423.  
  424.     , ((modm              , xK_F4    ), spawn "eject")
  425.     , ((modm .|. shiftMask, xK_c     ), kill1) -- @@ Close the focused window
  426. --  , ((modm .|. shiftMask, xK_c     ), kill)
  427.  
  428.     , ((modm , xK_s), namedScratchpadAction scratchpads "scratchpad")
  429.     , ((modm , xK_d), namedScratchpadAction scratchpads "stardict")
  430.     ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  431.  
  432. -- Print -----------------------------------------------------------------------------------
  433.     , ((0,                  xK_Print ), spawn "scrot -e 'mv $f ~/Pantallazos/ 2>/dev/null'")
  434. --------------------------------------------------------------------------------------------
  435.  
  436. -- Vol ----------------------------------------------------------------
  437.     , ((0 ,                0x1008ff13), spawn "amixer sset Master 5%+")
  438.     , ((0 ,                0x1008ff11), spawn "amixer sset Master 5%-")
  439. -----------------------------------------------------------------------
  440.  
  441. -- Mpd ----------------------------------------------------
  442.     , ((0 ,                0x1008ff14), spawn "mpc toggle")
  443.     , ((0 ,                0x1008ff15), spawn "mpc stop")
  444.     , ((0 ,                0x1008ff16), spawn "mpc prev")
  445.     , ((0 ,                0x1008ff17), spawn "mpc next")
  446. -----------------------------------------------------------
  447.  
  448. -- Grid --------------------------------------------------------
  449.     , ((modm,               xK_g     ), goToSelected myGSConfig)
  450. ----------------------------------------------------------------
  451.  
  452. -- Layouts -----------------------------------------------------
  453.     , ((modm,               xK_space ), sendMessage NextLayout)
  454.     , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
  455. ---------------------------------------------------------------------------
  456.  
  457. -- Sub Layout ------------------------------------------------------------
  458.     , ((modm .|. controlMask, xK_Left), sendMessage $ pullGroup L)
  459.     , ((modm .|. controlMask, xK_Right), sendMessage $ pullGroup R)
  460.     , ((modm .|. controlMask, xK_Up), sendMessage $ pullGroup U)
  461.     , ((modm .|. controlMask, xK_Down), sendMessage $ pullGroup D)
  462.  
  463.     , ((modm .|. controlMask, xK_m), withFocused (sendMessage . MergeAll))
  464.     , ((modm .|. controlMask, xK_u), withFocused (sendMessage . UnMerge))
  465.  
  466.     , ((modm .|. controlMask, xK_period), onGroup W.focusUp')
  467.    , ((modm .|. controlMask, xK_comma), onGroup W.focusDown')
  468. -------------------------------------------------------------------------
  469. -- Resize viewed windows to the correct size ---
  470.     , ((modm,               xK_n     ), refresh)
  471. -- Copying window to all
  472.     , ((modm, xK_v ), windows copyToAll) -- @@ Make focused window always visible
  473. ------------------------------------------------
  474. -- Move focus ---------------------------------------------------------
  475.     , ((modm,               xK_Tab   ), windows W.focusDown)
  476. --  , ((modm,               xK_j     ), windows W.focusDown)
  477. --  , ((modm,               xK_k     ), windows W.focusUp  )
  478.     , ((modm,               xK_m     ), windows W.focusMaster)
  479.     , ((modm,               xK_t     ), withFocused $ windows . W.sink)
  480. -----------------------------------------------------------------------
  481. -- Swap focused ---------------------------------------------
  482.     , ((modm,               xK_Return), windows W.swapMaster)
  483.     , ((modm .|. shiftMask, xK_Down  ), windows W.swapDown  )
  484.     , ((modm .|. shiftMask, xK_Up    ), windows W.swapUp    )
  485. -------------------------------------------------------------
  486. -- Resizing -------------------- --------------------------------
  487.     , ((modm,               xK_Left  ), sendMessage Shrink)
  488.     , ((modm,               xK_Right ), sendMessage Expand)
  489.     , ((modm,               xK_Down  ), sendMessage MirrorShrink)
  490.     , ((modm,               xK_Up    ), sendMessage MirrorExpand)
  491. -----------------------------------------------------------------
  492. -- Increment/Deincrement the number of windows in the master area ----
  493. --  , ((modm              , xK_comma ), sendMessage (IncMasterN 1))
  494. --  , ((modm              , xK_period), sendMessage (IncMasterN (-1)))
  495. ----------------------------------------------------------------------
  496. -- Quit/Restart xmonad --------------------------------------------------------------
  497. --  , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
  498.     , ((modm .|. shiftMask, xK_r     ), spawn "xmonad --recompile; xmonad --restart")
  499. --  , ((modm .|. xK_apostrophe       ), spawn "xmonad --recompile; xmonad --restart")
  500.  
  501.  
  502. --  , ((modm , xK_i), spawn "env GTK2_RC_FILES=$HOME/.themes/Clearlooks-DarkBlue/gtk-2.0/gtkrc inkscape")
  503. --  , ((modm , xK_o), spawn "env GTK2_RC_FILES=$HOME/.themes/Clearlooks-DarkBlue/gtk-2.0/gtkrc openoffice.org")
  504. --  , ((modm , xK_d), spawn "date +'%Y-%m-%d %H:%M' | osd_cat -p bottom -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
  505. --  , ((modm  .|. shiftMask, xK_d), spawn "date +'%H:%M' | osd_cat -p middle -A center -s 2 -c '#a10a30' -f '-xos4-terminus-medium-r-normal-*-140-*-*-*-c-*-iso10646-1'")
  506. --  , ((modm , xK_g), spawn "gimp")
  507. --  , ((modm , xK_k), spawn "k3b")
  508. --  , ((modm , xK_x), spawn "xbmc")
  509. --  , ((modm , xK_v), spawn "virtualbox")
  510. --  , ((modm , xK_n), spawn "nicotine")
  511. --  , ((modm , xK_m), spawn "gmpc")
  512. --  , ((modm , xK_Print), spawn "scrot screen_%Y-%m-%d.png -d 1") -- take screenshot
  513.  
  514.     , ((mod1Mask .|. controlMask, xK_Home), spawn "mpc toggle") -- play/pause song
  515.     , ((mod1Mask .|. controlMask, xK_End), spawn "mpc stop") -- stop playback
  516.     , ((mod1Mask .|. controlMask, xK_Prior), spawn "mpc prev") -- previous song
  517.     , ((mod1Mask .|. controlMask, xK_Next), spawn "mpc next") -- next song
  518.  
  519.     , ((mod1Mask .|. controlMask, xK_z), spawn "mpc volume -5")
  520.     , ((mod1Mask .|. controlMask, xK_x), spawn "mpc volume +5")
  521.  
  522.     , ((mod1Mask, xK_Tab), windows W.focusDown) -- move focus to the next window
  523.     , ((mod1Mask, xK_j), windows W.focusDown) -- move focus to the next window
  524.     , ((mod1Mask, xK_k), windows W.focusUp) -- move focus to the previous window
  525.     , ((mod1Mask, xK_m), windows W.swapMaster) -- swap the focused window and the master window
  526.     , ((mod1Mask .|. shiftMask, xK_1), sendMessage (IncMasterN 1)) -- increment the number of windows in the master area
  527.     , ((mod1Mask .|. shiftMask, xK_2), sendMessage (IncMasterN (-1))) -- deincrement the number of windows in the master area
  528.     , ((mod1Mask, xK_Return), windows W.focusMaster) -- move focus to the master window
  529. --  , ((mod1Mask, xK_f), sendMessage NextLayout) -- rotate through the available layout algorithms
  530.     , ((mod1Mask .|. shiftMask, xK_Tab), windows W.focusUp) -- move focus to the previous window
  531.     , ((mod1Mask .|. shiftMask, xK_h), sendMessage Shrink) -- shrink the master area
  532.     , ((mod1Mask .|. shiftMask, xK_j), windows W.swapDown) -- swap the focused window with the next window
  533.     , ((mod1Mask .|. shiftMask, xK_k), windows W.swapUp)  -- swap the focused window with the previous window
  534.     , ((mod1Mask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area
  535.     , ((mod1Mask .|. shiftMask, xK_Return), focusUrgent) -- move focus to urgent window
  536.     --, ((modMask .|. shiftMask, xK_Left), withFocused (keysResizeWindow (-30,0) (0,0))) -- shrink floated window horizontally by 50 pixels
  537.     --, ((modMask .|. shiftMask, xK_Right), withFocused (keysResizeWindow (30,0) (0,0))) -- expand floated window horizontally by 50 pixels
  538.     --, ((modMask .|. shiftMask, xK_Up), withFocused (keysResizeWindow (-30,-30) (0,0))) -- shrink floated window by 50 pixels
  539.     --, ((modMask .|. shiftMask, xK_Down), withFocused (keysResizeWindow (30,30) (0,0))) -- expand floated window by 50 pixels
  540. --  , ((mod1Mask .|. controlMask, xK_q), io (exitWith ExitSuccess)) -- quit xmonad
  541. --  , ((mod1Mask .|. controlMask, xK_r), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart") -- restart xmonad
  542.     , ((mod1Mask .|. controlMask, xK_d), withFocused $ windows . W.sink) -- push window back into tiling
  543. --  , ((mod1Mask .|. controlMask, xK_f), setLayout $ XMonad.layoutHook conf) -- reset the layouts on the current workspace to default
  544. --  , ((mod1Mask .|. controlMask, xK_Left), withFocused (keysMoveWindow (-30,0))) -- move floated window 10 pixels left
  545. --  , ((mod1Mask .|. controlMask, xK_Right), withFocused (keysMoveWindow (30,0))) -- move floated window 10 pixels right
  546. --  , ((mod1Mask .|. controlMask, xK_Up), withFocused (keysMoveWindow (0,-30))) -- move floated window 10 pixels up
  547. --  , ((mod1Mask .|. controlMask, xK_Down), withFocused (keysMoveWindow (0,30))) -- move floated window 10 pixels down
  548.  
  549.  
  550.     ]
  551.     ++
  552.     [((m .|. modm, k), windows $ f i)
  553.         | (i, k) <- zip (XMonad.workspaces conf) [xK_1 ..]
  554.         , (f, m) <- [(W.view, 0), (W.shift, shiftMask), (copy, shiftMask .|. controlMask)]]
  555.  
  556.  
  557. -- dynamicLog pretty printer for dzen:
  558. --myPP h = defaultPP
  559. --    { ppCurrent = wrap ("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myFocusedBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
  560. --    , ppVisible = wrap ("^fg(" ++ myNormalFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myNormalFGColor ++ ")") "^fg()^bg()^p()" . \wsId -> dropIx wsId
  561. --    , ppHidden = wrap ("^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> if (':' `elem` wsId) then drop 2 wsId else wsId -- don't use ^fg() here!!
  562. --    --, ppHiddenNoWindows = wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . \wsId -> dropIx wsId
  563. --    , ppHiddenNoWindows = \wsId -> if wsId `notElem` staticWs then "" else wrap ("^fg(" ++ myDzenFGColor ++ ")^bg()^p()^i(" ++ myIconDir ++ "/corner.xbm)") "^fg()^bg()^p()" . dropIx $ wsId
  564. --    , ppUrgent = wrap (("^fg(" ++ myUrgentFGColor ++ ")^bg(" ++ myNormalBGColor ++ ")^p()^i(" ++ myIconDir ++ "/corner.xbm)^fg(" ++ myUrgentFGColor ++ ")")) "^fg()^bg()^p()" . \wsId -> dropIx wsId
  565. --    , ppSep = " "
  566. --    , ppWsSep = " "
  567. --    , ppTitle = dzenColor ("" ++ myNormalFGColor ++ "") "" . wrap "< " " >"
  568. --    , ppLayout = dzenColor ("" ++ myNormalFGColor ++ "") "" .
  569. --        (\x -> case x of
  570. --        "Hinted Full" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-full.xbm)"
  571. --        "Hinted ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-tall-right.xbm)"
  572. --        "Hinted Mirror ResizableTall" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-mirror-bottom.xbm)"
  573. --        --"Hinted combining Tabbed Bottom Simplest and Full with DragPane  Vertical 0.1 0.8" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  574. --        "Hinted combining Tabbed Bottom Simplest and Full with TwoPane using Not (Role \"gimp-toolbox\")" -> "^fg(" ++ myIconFGColor ++ ")^i(" ++ myIconDir ++ "/layout-gimp.xbm)"
  575. --        _ -> x
  576. --        )
  577. --    , ppOutput = hPutStrLn h
  578. --    }
  579. --    where
  580. --    dropIx wsId = if (':' `elem` wsId) then drop 2 wsId else wsId
  581. --    staticWs = ["1:irc", "2:www", "3:music", "4:misc", "5:xbmc"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement