All pastes #1935543 Raw Edit

ml|

public text v1 · immutable
#1935543 ·published 2010-09-08 06:07 UTC
rendered paste body
-- $HOME/.xmonad/xmonad.hs for i531 --{-# LANGUAGE NoMonomorphismRestriction #-}import System.IOimport XMonadimport XMonad.Actions.CycleWSimport XMonad.Actions.GridSelectimport XMonad.Actions.UpdatePointerimport XMonad.Actions.WindowGoimport XMonad.Hooks.DynamicLogimport XMonad.Hooks.EwmhDesktopsimport XMonad.Hooks.ManageDocksimport XMonad.Hooks.ManageHelpersimport XMonad.Hooks.UrgencyHookimport XMonad.Layoutimport XMonad.Layout.ComboPimport XMonad.Layout.Gridimport XMonad.Layout.LayoutHintsimport XMonad.Layout.Namedimport XMonad.Layout.NoBordersimport XMonad.Layout.PerWorkspaceimport XMonad.Layout.ResizableTileimport XMonad.Layout.ShowWNameimport XMonad.Layout.ToggleLayoutsimport XMonad.Layout.TwoPaneimport XMonad.Promptimport XMonad.Prompt.AppendFileimport XMonad.Prompt.Manimport XMonad.Prompt.Shellimport XMonad.Prompt.Sshimport XMonad.Prompt.Windowimport XMonad.Util.EZConfigimport XMonad.Util.NamedScratchpadimport XMonad.Util.Run (runInTerm, spawnPipe)import XMonad.Util.WindowPropertiesimport qualified XMonad.Actions.Submap   as SMimport qualified XMonad.Actions.Search   as Simport qualified XMonad.Layout.Magnifier as Magimport qualified XMonad.Prompt           as Pimport qualified XMonad.StackSet         as Wmain = do    xmproc <- spawnPipe "xmobar" -- assumes xmobar in $PATH and config in $HOME/.xmobarrc --    xmonad $ withUrgencyHookC NoUrgencyHook myUrgencyConfig $ ewmh defaultConfig      {   manageHook = namedScratchpadManageHook myScratchPads      <+> manageDocks      <+> myManageHook      <+> manageHook defaultConfig      , layoutHook   = myShowWName myLayoutHook      , logHook      = myLogHook xmproc      , modMask      = myModMask      , terminal     = myTerminal      , workspaces   = myWorkSpaces      } `additionalKeysP` myKeysmyManageHook = composeAll      [ className =? "MPlayer"          --> doFloat               -- place the following in the floating layer --      , className =? "Smplayer"         --> doFloat               --      , className =? "feh"              --> doCenterFloat         --      , className =? "Chromium-browser" --> doShiftAndGo "1:web"  -- move these to the specified workspace --      , className =? "Epdfview"         --> doShiftAndGo "9:misc" --      , className =? "Firefox"          --> doShiftAndGo "1:web"  --      , className =? "Gimp"             --> doShiftAndGo "7:gimp" --      , className =? "Gpodder"          --> doShiftAndGo "4:aud"  --      , className =? "MPlayer"          --> doShiftAndGo "5:vid"  --      , className =? "Smplayer"         --> doShiftAndGo "5:vid"  --      , className =? "VirtualBox"       --> doShiftAndGo "8:vbox" --      , title     =? "mail"             --> doShiftAndGo "6:mail" --      , title     =? "screen"           --> doShiftAndGo "2:scr"  --      , title     =? "ssh"              --> doShiftAndGo "3:ssh"  --      , title     =? "sshfs"            --> doShiftAndGo "3:ssh"  --      ,                    isFullscreen --> doFullFloat           -- full screen anything that uses the full screen window property      ,      (role =? "gimp-toolbox" <||> role =? "gimp-image-window") --> (ask >>= doF . W.sink) -- gimpLayout --      ] where role = stringProperty "WM_WINDOW_ROLE"doShiftAndGo :: WorkspaceId -> ManageHookdoShiftAndGo ws = doF (W.greedyView ws) <+> doShift wsmyLayoutHook = avoidStruts            $      smartBorders                    $      onWorkspace "7:gimp" gimpLayout $ -- display the gimpLayout only in "7:gimp" --      toggleLayouts Full              $ -- toggle Full layout with the current layout; on the focused window --      layoutHints                     $      layoutHook defaultConfig      ||| Grid      ||| (named "ResizableTall"            $ tall)       ||| (named "Mag Mirror ResizableTall" $ Mag.magnifier (Mirror tall))      ||| (named "Mag ResizableTall"        $ Mag.magnifier (tall))      where gimpLayout = named "Gimp"       $ combineTwoP (TwoPane 0.04 0.86) (Full) (Full) (Not (Role "gimp-toolbox")) -- gimpLayout --            tall = ResizableTall 1 (3/100) (1/2) []myLogHook xmproc = dynamicLogWithPP xmobarPP      { ppCurrent= xmobarColor "#ffffff" "" . wrap "[" "]" -- highlight the current workspace with the specified color '[1:wsp]' --      , ppOrder  = \(ws:l:_) -> [ws,l]                     -- display workspace, then layout -- [1:wsp] [2:wsp] : Tall --      , ppOutput = hPutStrLn xmproc      , ppSort   = fmap (namedScratchpadFilterOutWorkspace.) (ppSort xmobarPP) -- hide 'NSP' from the workspace list --      , ppUrgent = xmobarColor "#00ffff" "" -- highlight urgent workspaces with the specified color --      } >> updatePointer (Relative 0.5 0.5) -- move the pointer to the center of a newly focused window --myShowWName = showWName' defaultSWNConfig   -- when switching workspaces, show the workspace on the screen --      { swn_bgcolor = "#000000"      , swn_color   = "#ffffff"      , swn_font    = "xft:DejaVu Sans Mono:pixelsize=20:antialias=true"      }myXPConfig = defaultXPConfig        -- mainly options for XMonad.Prompt.*; but for some others as well --      { autoComplete  = Just 500000 -- Just x[in microseconds]: if only one completion remains, auto-select it --      , bgColor       = "#000000"      , bgHLight      = "#00ffff"      , borderColor   = "#000000"      , fgColor       = "#00ffff"      , fgHLight      = "#000000"      , font          = "xft:DejaVu Sans Mono:pixelsize=13:antialias=true"      , historySize   = 0 -- do not save anything to $HOME/.xmonad/history --       , position      = Top      }myGSConfig      = defaultGSConfig { gs_font = "xft:DejaVu Sans Mono:pixelsize=11:antialias=true" }myModMask       = mod4MaskmySpawnList     = ["screen.sh", "screen-mail.sh", "screen-sshfs.sh"] myTerminal      = "urxvtc" -- run a client terminal from the urxvt terminal deamon[urxvtd] --myUrgencyConfig = urgencyConfig { suppressWhen = XMonad.Hooks.UrgencyHook.Never }myWorkSpaces    = ["1:web", "2:scr", "3:ssh", "4:aud", "5:vid", "6:mail", "7:gimp", "8:vbox", "9:misc", "NSP"]myScratchPads =      [ NS "calc"  "urxvtc -e calc"  (title =? "calc")  (customFloating $ W.RationalRect (1/6) (1/6) (1/3) (1/3))      , NS "notes" "gvim --role notes $HOME/documents/notes.txt" (role =? "notes") (customFloating $ W.RationalRect (1/6) (1/6) (1/3) (1/3))      , NS "htop"  "urxvtc -e htop"  (title =? "htop")  (customFloating $ W.RationalRect (1/6) (1/6) (1/2) (1/2))      , NS "iotop" "urxvtc -e iotop" (title =? "iotop") (customFloating $ W.RationalRect (1/6) (1/6) (1/2) (1/2))      , NS "NSP"   "screen-NSP.sh"   (title =? "NSP")   (customFloating $ W.RationalRect (1/6) (1/6) (1/2) (1/2))      ] where role = stringProperty "WM_WINDOW_ROLE"myKeys =      -- misc --      [ ("M-g i", runOrRaiseMaster "gimp"             (className =? "Gimp"                        )) -- and open in 7:gimp --      , ("M-g p", runOrRaiseMaster "gpodder"          (className =? "Gpodder"                     )) -- and open in 4:aud --      , ("M-g s", spawnSelected    myGSConfig         $ mySpawnList                               )  -- select an application to spawn from a given list --      , ("M-m o", spawn            "monitor-standby.sh"                                           )  -- send monitor to standby --      , ("M-m p", runOrRaiseMaster "smplayer"         (className =? "Smplayer"                    )) -- and open in 5:vid --      , ("M-m u", raiseMaybe  (runInTerm "-title mutt"   "screen -raAd mutt")(title =? "mutt"     )) -- reattach to sessionname 'mutt' and open in 6:mail; if not switch to 6:mail --      , ("M-x c", runOrRaiseMaster "chromium-browser" (className =? "Chromium-browser"            )) -- and open in 1:web --      , ("M-x e", runOrRaiseMaster "epdfview"         (className =? "Epdfview"                    )) -- and open in 9:misc --      , ("M-x f", runOrRaiseMaster "firefox"          (className =? "Firefox"                     )) -- and open in 1:web --      , ("M-x h", raiseMaybe  (runInTerm "-title sshfs"  "screen -raAd sshfs")  (title =? "sshfs" )) -- reattach to sessionname 'sshfs' and open in 3:ssh; if not switch to 3:ssh --      , ("M-x k", runOrRaiseMaster "keepassx"         (className =? "Keepassx"                    )) --      , ("M-x l", spawn            "xset dpms force off" >> moveTo Next EmptyWS >> spawn "xtrlock")  -- move to the next available empty workspace and lock X --      , ("M-x s", raiseMaybe  (runInTerm "-title screen" "screen -raAd screen") (title =? "screen")) -- reattach to sessionname 'screen' and open in 2:scr; if not switch to 2:scr --      , ("M-x v", runOrRaiseMaster "virtualbox"       (className =? "VirtualBox"                  )) -- and open in 8:vbox --      , ("M-S-f", sendMessage (Toggle "Full"                                                      )) -- toggle Full layout with the current layout; on the focused window --      , ("M-S-t", sendMessage (ToggleStruts                                                       )) -- toggleStruts on or off, to free screen space; ie.. hide xmobar --      -- multimedia: volume - alsa --      , ("<XF86AudioMute>",        spawn "amixer -q set Master toggle"                            )  -- mute --      , ("<XF86AudioLowerVolume>", spawn "amixer -q set Master 1- unmute"                         )  -- lowerVolume --      , ("<XF86AudioRaiseVolume>", spawn "amixer -q set Master 1+ unmute"                         )  -- raiseVolume --      -- myScratchPads --      ,  ("C-s c", namedScratchpadAction myScratchPads "calc"                                     )  -- run calc in a floating scratchpad --      ,  ("C-s h", namedScratchpadAction myScratchPads "htop"                                     )  -- run htop in a floating scratchpad --      ,  ("C-s i", namedScratchpadAction myScratchPads "iotop"                                    )  -- run iotop in a floating scratchpad --      ,  ("C-s n", namedScratchpadAction myScratchPads "notes"                                    )  -- run gvim in a floating scratchpad, for taking notes --      ,  ("C-s s", namedScratchpadAction myScratchPads "NSP"                                      )  -- run screen-NSP.sh in a floating scratchpad --      -- navigation --      , ("M-g b", bringSelected       myGSConfig                                                  )  -- brings selected window to the current workspace --      , ("M-g g", goToSelected        myGSConfig                                                  )  -- switches to selected window's workspace and focuses that window --      , ("M-g w", gridselectWorkspace myGSConfig W.greedyView                                     )  -- select a workspace and view it using the given function --      , ("M-x u", focusUrgent                                                                     )  -- focus the most recently urgent window --      , ("M-x ,", prevWS                                                                          )  -- change to previous workspace --      , ("M-x .", nextWS                                                                          )  -- change to next workspace --      , ("M-x /", toggleWS                                                                        )  -- toggle previous workspace --      , ("M-S-,", shiftToPrev >> prevWS                                                           )  -- move the current selected window to the previous workspace --      , ("M-S-.", shiftToNext >> nextWS                                                           )  -- move the current selected window to the next workspace --      , ("M-S-/", moveTo Next    EmptyWS                                                          )  -- change to the next available empty workspace --      -- prompts --      , ("M-S-a", appendFilePrompt  myXPConfig "$HOME/documents/notes.txt"                        )  -- a prompt for appending a single line of text to a file --      , ("M-S-p", shellPrompt       myXPConfig                                                    )  -- a shell prompt --      , ("M-S-b", windowPromptBring myXPConfig                                                    )  -- a prompt that brings window's to you --      , ("M-S-g", windowPromptGoto  myXPConfig                                                    )  -- a prompt that takes you to window's --      , ("M-S-h", sshPrompt         myXPConfig                                                    )  -- a ssh prompt --      , ("M-S-m", manPrompt         myXPConfig                                                    )  -- a manual page prompt --            -- resizing --                                                                                 -- depends on window selected, whether it shrinks or expands --      , ("M-S-s", sendMessage MirrorShrink                                                        )  -- shrink/expand the current window in a ResizableTile Layout --      , ("M-S-e", sendMessage MirrorExpand                                                        )  -- shrink/expand the current window in a ResizableTile Layout --      , ("M-S-<Page_Up>",   sendMessage Mag.MagnifyMore                                           )  -- magnify more the current window in a Magnfiier Layout --      , ("M-S-<Page_Down>", sendMessage Mag.MagnifyLess                                           )  -- magnify less the current window in a Magnifier Layout --      -- screenshots --      , ("<Print>",   spawn "scrot -e 'mv $f /tmp/'"                                              )  -- take a full screenshot, file is saved in /tmp/ --      , ("C-<Print>", spawn "sleep 0.2; scrot -s -e 'mv $f /tmp/'"                                )  -- take a screenshot of a selected window, C-Print then click on a window, file is saved in /tmp/ --      ] -- end of regular keybindings --      -- follow the window when using mod-S-# to move a window to another workspace --      ++ [("M-" ++ m ++ k, windows $ f i) | (i, k) <- zip myWorkSpaces (map show [1 .. 9]), (f, m) <- [(W.greedyView, ""), (\w -> W.greedyView w. W.shift w, "S-")] ]      -- searching --      ++ [("M-s " ++ k, S.promptSearch myXPConfig f) | (k,f) <- searchList ]searchList :: [(String, S.SearchEngine)]searchList =      [ ("a", S.alpha                                                                             )  -- M-s + * prompts you for a search string, then opens a new browser tab or      , ("b", S.debbts                                                                            )  -- window depending how the browser is setup --      , ("d", S.dictionary                                                                        )  --      , ("e", S.deb                                                                               )  --      , ("i", S.imdb                                                                              )  -- for the list of the default search engines currently used look at --      , ("o", S.google                                                                            )  -- $HOME/downloads/xmonad/darcs/XMonadContrib/XMonad/Actions/Search.hs --      , ("t", S.thesaurus                                                                         )  -- and/or http://code.haskell.org/XMonadContrib/XMonad/Actions/Search.hs --      -- mySearchEngines --      , ("g", S.searchEngine "google-ssl"    "https://encrypted.google.com/search?num=100&q="                             ) -- these search engines are not included in Search.hs --      , ("h", S.searchEngine "isohunt-ssl"   "https://isohunt.com/torrents/?ihq="                                         )      , ("s", S.searchEngine "scroogle-ssl"  "https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw="                           )      , ("p", S.searchEngine "tpb-ssl"       "https://thepiratebay.org/search/"                                           )      , ("q", S.searchEngine "ddg-ssl"       "https://duckduckgo.com/?kp=-1&kl=us-en&kg=p&kd=1&kn=1&q="                   )      , ("w", S.searchEngine "wikipedia-ssl" "https://secure.wikimedia.org/wikipedia/en/wiki/Special:Search?go=Go&search=")      ]