-- $HOME/.xmonad/xmonad.hs for i531 -- {-# LANGUAGE NoMonomorphismRestriction #-} import System.IO import XMonad import XMonad.Actions.CycleWS import XMonad.Actions.DynamicWorkspaces import XMonad.Actions.GridSelect import XMonad.Actions.UpdatePointer import XMonad.Actions.WindowGo import XMonad.Hooks.DynamicLog import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers import XMonad.Hooks.UrgencyHook import XMonad.Layout import XMonad.Layout.ComboP import XMonad.Layout.Grid import XMonad.Layout.Named import XMonad.Layout.NoBorders import XMonad.Layout.PerWorkspace import XMonad.Layout.ResizableTile import XMonad.Layout.ShowWName import XMonad.Layout.ToggleLayouts import XMonad.Layout.TwoPane import XMonad.Prompt import XMonad.Prompt.AppendFile import XMonad.Prompt.Man import XMonad.Prompt.RunOrRaise import XMonad.Prompt.Shell import XMonad.Prompt.Ssh import XMonad.Prompt.Window import XMonad.Util.EZConfig import XMonad.Util.NamedScratchpad import XMonad.Util.Run (runInTerm, spawnPipe) import XMonad.Util.WindowProperties import XMonad.Util.WorkspaceCompare import qualified XMonad.Actions.Search as S import qualified XMonad.Actions.Submap as SM import qualified XMonad.Layout.Magnifier as M import qualified XMonad.Prompt as P import qualified XMonad.StackSet as W myManageHook = namedScratchpadManageHook myScratchPads <+> composeAll [ className =? "MPlayer" --> doFloat -- place the following in the floating layer -- , className =? "Smplayer" --> doFloat -- , className =? "feh" --> doCenterFloat -- , className =? "Gcolor2" --> doCenterFloat -- , className =? "XCalc" --> doCenterFloat -- , isFullscreen --> doFullFloat -- full screen anything that uses the full screen window property -- , (role =? "gimp-toolbox" <||> role =? "gimp-image-window") --> (ask >>= doF . W.sink) ]where role = stringProperty "WM_WINDOW_ROLE" myLayoutHook = avoidStruts $ myShowWName $ smartBorders $ toggleLayouts Full $ -- toggle Full layout with the current layout; on the focused window -- layoutHook defaultConfig ||| gimpLayout ||| Grid ||| (named "ResizableTall" $ tall) ||| (named "Mag Mirror ResizableTall" $ M.magnifier (Mirror tall)) ||| (named "Mag ResizableTall" $ M.magnifier (tall)) where gimpLayout = named "GimpL" $ combineTwoP (TwoPane 0.04 0.86) (Full) (Full) (Not (Role "gimp-toolbox")) tall = ResizableTall 1 (3/100) (1/2) [] 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" , swn_fade = 2 } myLogHook xmproc = dynamicLogWithPP xmobarPP { ppCurrent = \(c) -> [] -- do not show -- , ppHidden = \(h) -> [] -- "" "" -- , ppOrder = \(ws:l:_) -> [l,ws] -- display layout then workspace -- , ppOutput = hPutStrLn xmproc , ppSort = fmap (namedScratchpadFilterOutWorkspace.) (ppSort xmobarPP) -- hide 'NSP' from the workspace list -- , ppUrgent = xmobarColor "#000000" "#ffff00" -- highlight urgent workspace[s] with the specified colors["fg" "bg"] -- } >> updatePointer (Relative 0.5 0.5) -- move the pointer to the center of a newly focused window -- 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 } myScratchPads = [ 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 "notes" "gvim --role notes $HOME/documents/notes.txt" (role =? "notes") (customFloating $ W.RationalRect (1/6) (1/6) (1/3) (1/3)) , NS "xcalc" "xcalc" (title =? "xcalc") (customFloating $ W.RationalRect (1/6) (1/6) (1/3) (1/3)) , NS "NSP" "screen-NSP.sh" (title =? "NSP") (customFloating $ W.RationalRect (1/6) (1/6) (1/2) (1/2)) ]where role = stringProperty "WM_WINDOW_ROLE" myGSConfig = defaultGSConfig {gs_font = "xft:DejaVu Sans Mono:pixelsize=11:antialias=true"} mySpawnList = ["screen.sh", "screen-mail.sh", "screen-sync.sh"] myUrgencyConfig = urgencyConfig {suppressWhen = XMonad.Hooks.UrgencyHook.Never} myWorkSpaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "NSP"] myKeys = -- misc -- [ ("M-d r", renameWorkspace myXPConfig ) -- rename[s] are only temporary; M-q resets them -- , ("M-g i", runOrRaiseMaster "gimp" (className =? "Gimp" )) , ("M-g p", runOrRaiseMaster "gpodder" (className =? "Gpodder" )) , ("M-g s", spawnSelected myGSConfig $ mySpawnList ) -- select an application to spawn from a given list -- , ("M-m a", raiseMaybe (runInTerm "-title mail" "screen -raAd mail") (title =? "mail" )) -- reattach to sessionName _mail_ in the current workspace or if already attached; give it focus -- , ("M-m i", runOrRaiseMaster "midori" (className =? "Midori" )) , ("M-m m", windows W.focusMaster ) -- move focus to the master window -- , ("M-m o", spawn "monitor-standby.sh" ) , ("M-m p", runOrRaiseMaster "smplayer" (className =? "Smplayer" )) , ("M-t s", sendMessage (ToggleStruts )) -- hides *bar -- , ("M-x c", runOrRaiseMaster "chromium-browser" (className =? "Chromium-browser" )) , ("M-x f", runOrRaiseMaster "firefox" (className =? "Firefox" )) , ("M-x k", runOrRaiseMaster "keepassx" (className =? "Keepassx" )) , ("M-x l", spawn "xset dpms force off" >> moveTo Next EmptyWS >> spawn "xtrlock" ) -- focus the Next available empty workspace and lock X -- , ("M-x r", raiseMaybe (runInTerm "-title sync" "screen -raAd sync") (title =? "sync" )) -- reattach to sessionName _sync_ in the current workspace or if already attached; give it focus -- , ("M-x s", raiseMaybe (runInTerm "-title screen" "screen -raAd screen") (title =? "screen" )) -- _screen_ -- , ("M-x v", runOrRaiseMaster "virtualbox" (className =? "VirtualBox" )) , ("M-S-f", sendMessage (Toggle "Full" )) -- toggle Full layout with the current layout; on the focused window -- , ("M-S-", removeWorkspace ) -- remove the current workspace -- -- multimedia volume; alsa -- , ("", spawn "amixer -q set Master toggle" ) -- mute/unmute -- , ("", spawn "amixer -q set Master 1- unmute" ) -- unmute and lowerVolume -- , ("", spawn "amixer -q set Master 1+ unmute" ) -- unmute and raiseVolume -- -- myScratchPads -- , ("C-s c", namedScratchpadAction myScratchPads "xcalc" ) -- run _xcalc_ in a floating NSP -- , ("C-s h", namedScratchpadAction myScratchPads "htop" ) -- run _htop_ -- , ("C-s i", namedScratchpadAction myScratchPads "iotop" ) -- run _iotop_ -- , ("C-s n", namedScratchpadAction myScratchPads "notes" ) -- run _gvim_ -- , ("C-s s", namedScratchpadAction myScratchPads "NSP" ) -- run _screen-NSP.sh_ -- -- navigation -- , ("M-d s", selectWorkspace myXPConfig ) -- goto the selected workspace -- , ("M-g b", bringSelected myGSConfig ) -- brings the selected window to the current workspace -- , ("M-g g", goToSelected myGSConfig ) -- switches to selected window's workspace and focuses that window -- , ("M-g m", gridselectWorkspace myGSConfig (\ws -> W.greedyView ws . W.shift ws )) -- move and follow the focused window to the selected workspace -- , ("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 ,", moveTo Prev (WSIs notNSP )) -- change to the _Previous_ workspace, except for NSP -- , ("M-x .", moveTo Next (WSIs notNSP )) -- _Next_ -- , ("M-x /", toggleWS ) -- toggle to the workspace displayed Previously -- , ("M-C-,", windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Prev HiddenNonEmptyWS 1) -- focus _Previous_ HiddenNonEmpty workspace -- , ("M-C-.", windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Next HiddenNonEmptyWS 1) -- _Next_ -- , ("M-C-", windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Prev EmptyWS 1 ) -- focus _Previous_ NonEmpty workspace -- , ("M-C-", windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Next EmptyWS 1 ) -- _Next_ -- , ("M-S-p", shiftAndView' Prev ) -- move window to _Previous_ and focus HiddenNonEmpty workspace except for NSP -- , ("M-S-n", shiftAndView' Next ) -- _Next_ -- , ("M-S-,", windows . W.shift =<< findWorkspace getSortByIndexNoNSP Prev HiddenNonEmptyWS 1 ) -- move window to _Previous_ HiddenNonEmpty workspace -- , ("M-S-.", windows . W.shift =<< findWorkspace getSortByIndexNoNSP Next HiddenNonEmptyWS 1 ) -- _Next_ -- , ("M-S-", windows . W.shift =<< findWorkspace getSortByIndexNoNSP Prev EmptyWS 1 ) -- move window to _Previous_ NonEmpty workspace -- , ("M-S-", windows . W.shift =<< findWorkspace getSortByIndexNoNSP Next EmptyWS 1 ) -- _Next_ -- -- prompts -- , ("M-S-a", appendFilePrompt myXPConfig "$HOME/documents/notes.txt" ) -- a prompt for appending a single line of text to a file -- , ("M-S-b", windowPromptBring myXPConfig ) -- _a prompt that_ brings windows to you -- , ("M-S-g", windowPromptGoto myXPConfig ) -- takes you to windows -- , ("M-S-h", sshPrompt myXPConfig ) , ("M-S-m", manPrompt myXPConfig ) , ("M-S-p", shellPrompt myXPConfig ) , ("M-S-r", runOrRaisePrompt myXPConfig ) -- a prompt which will run a program, open a file, or raise an already running program, depending on context -- , ("M-S-z", shellPrompt myXPConfig ) -- resizing -- -- depends on window selected, whether it shrinks or expands -- , ("M-C-s", sendMessage MirrorShrink ) -- _Shrink/Expand_ the current window in a ResizableTile Layout -- , ("M-C-e", sendMessage MirrorExpand ) -- -- , ("M-C-", sendMessage M.MagnifyMore ) -- magnify _More_ the current window in a Magnfiier Layout -- , ("M-C-", sendMessage M.MagnifyLess ) -- _Less_ -- -- screenshots -- , ("", spawn "scrot -e 'mv $f /tmp/'" ) -- take a full screenshot; save in /tmp/ -- , ("C-", spawn "sleep 0.2; scrot -s -e 'mv $f /tmp/'" ) -- take a screenshot of a selected window, C-Print then click on a window; save in /tmp/ -- ] -- end of regular keybindings -- -- M-S-#: move and follow the focused window to a workspace[1-9] -- ++ [("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-")] ] -- search; continues below -- ++ [("M-s " ++ k, S.promptSearch myXPConfig f) | (k,f) <- searchList ] ++ [("M-S-s " ++ k, S.selectSearch f) | (k,f) <- searchList ] -- skip the NSP workspace while using CycleWS -- where notNSP = (return $ ("NSP" /=) . W.tag) :: X (WindowSpace -> Bool) getSortByIndexNoNSP = fmap (.namedScratchpadFilterOutWorkspace) getSortByIndex shiftAndView' dir = findWorkspace getSortByIndexNoNSP dir EmptyWS 1 >>= \t -> (windows . W.shift $ t) >> (windows . W.greedyView $ t) -- search engines/list -- 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. -- , ("e", S.deb ) -- , ("i", S.imdb ) -- , ("o", S.google ) -- , ("p", S.debpts ) -- M-S-s + * "If you select something in whatever application and hit , ("y", S.wayback ) -- mod-shift-s + g/h/w it will search the selected string with the specified engine." -- -- mySearchEngines -- , ("d", S.searchEngine "duckduckgo-ssl" "https://duckduckgo.com/?kp=-1&kl=us-en&kg=p&kd=1&kn=1&q=" ) -- these search engines are not included in Search.hs -- , ("g", S.searchEngine "google-ssl" "https://encrypted.google.com/search?num=100&q=" ) , ("h", S.searchEngine "isohunt-ssl" "https://isohunt.com/torrents/?ihq=" ) , ("s", S.searchEngine "scroogle-ssl" "https://ssl.scroogle.org/cgi-bin/nbbwssl.cgi?Gw=" ) -- for the list of the default search engines currently used look at -- , ("k", S.searchEngine "wiktionary-ssl" "https://secure.wikimedia.org/wiktionary/en/wiki/Special:Search?go=Go&search=") -- $HOME/downloads/xmonad/darcs/XMonadContrib/XMonad/Actions/Search.hs -- , ("w", S.searchEngine "wikipedia-ssl" "https://secure.wikimedia.org/wikipedia/en/wiki/Special:Search?go=Go&search=" ) -- and/or at the darcs repo: , ("x", S.searchEngine "tpb-ssl" "https://thepiratebay.org/search/" ) -- http://code.haskell.org/XMonadContrib/XMonad/Actions/Search.hs -- ] main = do xmproc <- spawnPipe "xmobar" -- assumes xmobar in $PATH and config in $HOME/.xmobarrc -- xmonad $ withUrgencyHookC NoUrgencyHook myUrgencyConfig $ ewmh defaultConfig { borderWidth= 1 , manageHook = myManageHook <+> manageDocks <+> manageHook defaultConfig , layoutHook = myLayoutHook , logHook = myLogHook xmproc , modMask = mod4Mask , terminal = "urxvtc" , workspaces = myWorkSpaces } `additionalKeysP` myKeys