import XMonad import System.Exit import System.IO import qualified XMonad.StackSet as W import qualified Data.Map as M import Data.List -- for isSuffixOf import XMonad.Actions.CycleWS import qualified XMonad.Actions.FlexibleManipulate as Flex import XMonad.Actions.NoBorders import XMonad.Actions.GridSelect import XMonad.Actions.WindowBringer import XMonad.Actions.UpdatePointer import XMonad.Hooks.ManageHelpers import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageDocks import XMonad.Hooks.FadeInactive import XMonad.Hooks.EwmhDesktops -- import XMonad.Util.Run(spawnPipe) import XMonad.Util.WindowProperties import XMonad.Util.NamedScratchpad import XMonad.Util.WorkspaceCompare import XMonad.Layout.Tabbed import XMonad.Layout.DecorationMadness import XMonad.Layout.NoBorders import XMonad.Layout.TwoPane import XMonad.Layout.ComboP import XMonad.Layout.ShowWName import XMonad.Layout.Magnifier import XMonad.Prompt import XMonad.Prompt.Shell import Graphics.X11.ExtraTypes.XF86 amphiFont = "xft:Bitstream Vera Sans-10:Normal" amphiNormalFGColor = "#9c9c9c" amphiFocusedFGColor = "#C4B089" amphiUrgentFGColor = "#f57900" amphiUrgentBGColor = amphiNormalBGColor amphiSeperatorColor = "#2e3436" -- clearlooks shadow theme --amphiNormalBGColor = "#2c2c2c" --amphiFocusedBGColor = "#3f3f3f" --amphiFocusedBorderColor = "#8686B3" --amphiNormalBorderColor = "#2c2c2c" -- gommapiumalooks theme amphiNormalBGColor = "#4c4e4a" amphiFocusedBGColor = "#585a55" amphiFocusedBorderColor = "#7a7e78" amphiNormalBorderColor = "#3f413d" amphiXPConfig = defaultXPConfig { bgColor = amphiNormalBGColor , fgColor = amphiNormalFGColor , fgHLight = amphiFocusedFGColor , bgHLight = amphiNormalBGColor , height = 16 , position = Top , font = amphiFont , borderColor = amphiNormalBorderColor , historyFilter = \x -> [] , autoComplete = Just 500000 -- Just x[in microseconds]: if only one completion remains, auto-select it -- } amphiGSConfig = defaultGSConfig { gs_font = "xft:Bitstream Vera Sans-10:Normal" , gs_cellwidth = 160 , gs_cellheight = 45 } scratchpadSize = W.RationalRect 0.05 0.05 0.9 0.9 amphiSPFloat = customFloating scratchpadSize scratchpads = [ NS "scratchpad" "xfce4-terminal --title scratchpad" (title =? "scratchpad") amphiSPFloat , NS "editpad" "gvim --role editpad" (role =? "editpad") amphiSPFloat , NS "calcpad" "xcalc" (className =? "XCalc") (customFloating $ W.RationalRect (3/8) (1/4.5) (1/4) (1/2.2)) ] where role = stringProperty "WM_WINDOW_ROLE" amphiKeys conf@(XConfig {modMask = modm}) = M.fromList $ -- switch to non-empty ws [ ((0, xF86XK_Forward), windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Next HiddenNonEmptyWS 1) , ((0, xF86XK_Back), windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Prev HiddenNonEmptyWS 1) -- switch to empty ws , ((controlMask, xF86XK_Forward), windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Next EmptyWS 1) , ((controlMask, xF86XK_Back), windows . W.greedyView =<< findWorkspace getSortByIndexNoNSP Prev EmptyWS 1) -- send window to any ws except NSP , ((shiftMask, xF86XK_Forward), shiftTo Next (WSIs notNSP)) , ((shiftMask, xF86XK_Back), shiftTo Prev (WSIs notNSP)) -- send window to empty ws , ((controlMask .|. shiftMask, xF86XK_Forward), windows . W.shift =<< findWorkspace getSortByIndexNoNSP Next EmptyWS 1) , ((controlMask .|. shiftMask, xF86XK_Back), windows . W.shift =<< findWorkspace getSortByIndexNoNSP Prev EmptyWS 1) -- send windpow to empty ws & focus it , ((modm .|. shiftMask, xF86XK_Forward), shiftAndView' Next) , ((modm .|. shiftMask, xF86XK_Back), shiftAndView' Prev) -- , ((modm, xK_grave), namedScratchpadAction scratchpads "scratchpad") , ((modm, xK_v), namedScratchpadAction scratchpads "editpad") , ((modm, xK_c), namedScratchpadAction scratchpads "calcpad") , ((modm, xK_w), toggleWS) , ((modm, xK_b), sendMessage ToggleStruts) , ((modm, xK_d), withFocused toggleBorder) , ((modm .|. controlMask, xK_m), sendMessage Toggle) , ((modm, xK_g), goToSelected amphiGSConfig) , ((modm , xK_x), shellPrompt amphiXPConfig { position = Top, borderColor = amphiFocusedBorderColor }) ] 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) amphiMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $ [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w)) , ((modm, button2), (\w -> focus w >> windows W.shiftMaster)) -- raise window to top of stack , ((modm, button3), (\w -> focus w >> Flex.mouseWindow Flex.linear w))] tabbedConf = defaultTheme { inactiveBorderColor = amphiNormalBorderColor , activeBorderColor = amphiNormalBorderColor , activeColor = amphiFocusedBGColor , inactiveColor = amphiNormalBGColor , activeTextColor = amphiFocusedFGColor , inactiveTextColor = amphiNormalFGColor , decoHeight = 16 , fontName = amphiFont } amphiLayoutHook = avoidStruts $ showWName $ smartBorders $ magnifier (tall) ||| magnifier (Mirror tall) ||| Full ||| noBorders (gimpLayout) where gimpLayout = combineTwoP (TwoPane 0.04 0.86) (tabbedLayout) (Full) (Not (Role "gimp-toolbox")) tall = Tall 1 (3/100) (1/2) tabbedLayout = tabbedBottomAlways shrinkText tabbedConf amphiManageHook = namedScratchpadManageHook scratchpads <+> composeAll [ className =? "MPlayer" --> doCenterFloat , (role =? "gimp-toolbox" <||> role =? "gimp-image-window") --> (ask >>= doF . W.sink) , className =? "feh" --> doCenterFloat , className =? "Gcolor2" --> doCenterFloat , className =? "Gksu" --> doCenterFloat , className =? "Grun" --> doCenterFloat , className =? "Grandr" --> doCenterFloat , className =? "povray" --> doCenterFloat , className =? "XFontSel" --> doCenterFloat , className =? "Xcolorsel" --> doCenterFloat , className =? "Xmag" --> doCenterFloat , className =? "Reportbug" --> doCenterFloat , className =? "Stellarium" --> doFullFloat , role =? "progress" --> doCenterFloat , role =? "decompose" --> doCenterFloat , role =? "file-jpeg" --> doCenterFloat , role =? "file-png" --> doCenterFloat , role =? "gimp-export-image" --> doCenterFloat , role =? "gimp-image-scale" --> doCenterFloat , role =? "gimp-file-open" --> doCenterFloat , role =? "gimp-file-save" --> doCenterFloat , role =? "gimp-toolbox-color-dialog" --> doCenterFloat , (className =? "Gimp" <&&> fmap ("tool" `isSuffixOf`) role) --> doCenterFloat , title =? "Authentication Required" --> doCenterFloat -- midori auth window , title =? "HF-Lab" --> doFloat , title =? "Event Tester" --> doFloat --, className =? "Gthumb" --> doFullFloat , title =? "Rename" --> doCenterFloat , className =? "Wicd-client.py" --> doCenterFloat , className =? "Xmessage" --> doCenterFloat , className =? "Gmessage" --> doCenterFloat ] where role = stringProperty "WM_WINDOW_ROLE" main = xmonad $ ewmh defaultConfig { borderWidth = 1, focusFollowsMouse = True, workspaces = ["1","2","3","4","5","6","7","8","9"], terminal = "xfce4-terminal", modMask = mod4Mask, manageHook = amphiManageHook <+> (isFullscreen --> doFullFloat) <+> manageHook defaultConfig, layoutHook = amphiLayoutHook, --logHook = updatePointer (Relative 0.5 0.5) >> fadeInactiveLogHook 0.7, logHook = updatePointer (Relative 0.5 0.5), normalBorderColor = amphiNormalBorderColor, focusedBorderColor = amphiFocusedBorderColor, keys = \c -> amphiKeys c `M.union` keys defaultConfig c, mouseBindings = amphiMouseBindings }