Created
May 22, 2012 21:15
-
-
Save anonymous/2771671 to your computer and use it in GitHub Desktop.
stdin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ~/.xmonad/xmonad.hs | |
-- Imports {{{ | |
import XMonad hiding ( (|||) ) | |
-- Prompt | |
import XMonad.Prompt | |
import XMonad.Prompt.RunOrRaise (runOrRaisePrompt) | |
import XMonad.Prompt.AppendFile (appendFilePrompt) | |
-- Hooks | |
import XMonad.Operations | |
import System.IO | |
import System.Exit | |
import XMonad.Util.Run | |
--Actions | |
import XMonad.Actions.GridSelect | |
import XMonad.Actions.WindowGo | |
import XMonad.Actions.CycleWS | |
--Hooks | |
import XMonad.Hooks.ManageDocks | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Hooks.SetWMName | |
import XMonad.Hooks.DynamicLog | |
import XMonad.Hooks.UrgencyHook | |
import XMonad.Hooks.FadeInactive | |
import XMonad.Hooks.EwmhDesktops | |
import XMonad.Hooks.SetWMName | |
--Layouts | |
import XMonad.Layout.NoBorders (smartBorders, noBorders) | |
import XMonad.Layout.PerWorkspace (onWorkspace) | |
import XMonad.Layout.Reflect (reflectHoriz) | |
import XMonad.Layout.IM | |
import XMonad.Layout.SimpleFloat | |
import XMonad.Layout.Spacing | |
import XMonad.Layout.ResizableTile | |
import XMonad.Layout.NoBorders | |
import XMonad.Layout.Gaps | |
import XMonad.Layout.Circle | |
import XMonad.Layout.LayoutCombinators | |
import XMonad.Layout.Tabbed | |
import XMonad.Layout.Named | |
import XMonad.Layout.Spiral | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M | |
import XMonad.Util.NamedScratchpad | |
--}}} | |
-- Config {{{ | |
-- Define Terminal | |
myTerminal = "urxvt" | |
-- Define modMask | |
modMask' :: KeyMask | |
modMask' = mod4Mask | |
myFont = "-*-montecarlo-medium-r-normal-*-11-*-*-*-c-*-*-*" | |
myDzenFGColor = "#555555" | |
myDzenBGColor = "#222222" | |
myNormalFGColor = "#ffffff" | |
myNormalBGColor = "#0f0f0f" | |
myFocusedFGColor = "#f0f0f0" | |
myFocusedBGColor = "#333333" | |
myUrgentFGColor = "#0099ff" | |
myUrgentBGColor = "#0077ff" | |
myIconFGColor = "#777777" | |
myIconBGColor = "#0f0f0f" | |
myPatternColor = "#1f1f1f" | |
mySeperatorColor = "#555555" | |
-- GSConfig options: | |
myGSConfig = defaultGSConfig | |
{ gs_cellheight = 50 | |
, gs_cellwidth = 250 | |
, gs_cellpadding = 10 | |
--, gs_colorizer = "" | |
, gs_font = "" ++ myFont ++ "" | |
--, gs_navigate = "" | |
--, gs_originFractX = "" | |
--, gs_originFractY = "" | |
} | |
-- Define workspaces | |
myWorkspaces = ["main","web","dev","etc","skype"] | |
-- Dzen config | |
myStatusBar = "dzen2 -x '0' -y '0' -h '18' -w '300' -ta 'l' -fg '#FFFFFF' -bg '#0F0F0F' -fn '-*-montecarlo-medium-r-normal-*-11-*-*-*-*-*-*-*'" | |
myTopStatusBar = "conky -c /home/riso/conkydzen | dzen2 -x '300' -w '1380' -h '18' -ta 'r' -bg '#0F0F0F' -fg '#FFFFFF' -fn '-*-montecarlo-medium-r-normal-*-11-*-*-*-*-*-*-*' -y '0'" | |
myBitmapsDir = "/home/riso/.xmonad/dzen" | |
--}}} | |
-- Main {{{ | |
main = do | |
dzenTopBar <- spawnPipe myStatusBar | |
dzenBar <- spawnPipe myTopStatusBar | |
--spawn "sh /home/serrghi/.xmonad/autostart.sh" | |
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig | |
{ terminal = myTerminal | |
, workspaces = myWorkspaces | |
, borderWidth = myBorderWidth | |
, keys = keys' | |
, modMask = modMask' | |
, startupHook = ewmhDesktopsStartup | |
, layoutHook = layoutHook' | |
, manageHook = manageHook' | |
, logHook = myLogHook dzenTopBar | |
, normalBorderColor = colorNormalBorder | |
, focusedBorderColor = colorFocusedBorder | |
} | |
--}}} | |
-- Urgency hint options: | |
--myUrgencyHook = withUrgencyHook dzenUrgencyHook | |
-- { args = ["-x", "0", "-y", "1050", "-h", "16", "-w", "1680", "-ta", "r", "-expand", "l", "-fg", "" ++ myUrgentFGColor ++ "", "-bg", "" ++ myNormalBGColor ++ "", "-fn", "" ++ myFont ++ ""] } | |
-- { args = ["-bg", "yellow", "-fg", "black"] } | |
--Scratchpad | |
scratchpads = [ | |
NS "deluge" "deluge" (title =? "Deluge") defaultFloating, | |
NS "keepassx" "keepassx" (title =? "Keepassx") defaultFloating ] | |
-- Hooks {{{ | |
-- ManageHook {{{ | |
manageHook' :: ManageHook | |
manageHook' = (composeAll . concat $ | |
[ [resource =? r --> doShift "skype" | r <- myIgnores] -- ignore desktop | |
, [className =? c --> doShift "web" | c <- myWebs ] -- move webs to webs | |
, [className =? c --> doShift "etc" | c <- myEtc ] -- move devs to devs | |
, [className =? c --> doF(W.shift "6:wine") | c <- myWines ] -- move wines to wine | |
, [className =? c --> doCenterFloat | c <- myFloats ] -- float my floats | |
, [name =? n --> doCenterFloat | n <- myNames ] -- float my names | |
, [isFullscreen --> myDoFullFloat ] | |
]) <+> namedScratchpadManageHook scratchpads | |
where | |
role = stringProperty "WM_WINDOW_ROLE" | |
name = stringProperty "WM_NAME" | |
-- classnames | |
myFloats = ["Nitrogen","keepassx","Keepassx","Skype","Lxappearance","Feh","Deluge","MPlayer","Zenity","VirtualBox","Xmessage","Save As...","XFontSel","Downloads","Nm-connection-editor"] | |
myWebs = ["Navigator","Shiretoko","Firefox","Uzbl","uzbl","Uzbl-core","uzbl-core","Google-chrome","Chromium-browser","Shredder","Mail"] | |
myEtc = ["Eclipse","eclipse","Netbeans","Gvim","Foxit"] | |
myWines = ["Wine"] | |
-- resources | |
myIgnores = ["Skype","skype"] | |
-- names | |
myNames = ["bashrun","Google Chrome Options","Chromium Options","Delicious.com - Discover Yourself!"] | |
-- a trick for fullscreen but stil allow focusing of other WSs | |
myDoFullFloat :: ManageHook | |
myDoFullFloat = doF W.focusDown <+> doFullFloat | |
-- }}} | |
layoutHook' = customLayout | |
-- Bar | |
--myLogHook :: Handle -> X () | |
myLogHook h = dynamicLogWithPP $ defaultPP | |
{ | |
ppCurrent = dzenColor "#0099ff" "#0f0f0f" . pad | |
, ppVisible = dzenColor "white" "#0f0f0f" . pad | |
, ppHidden = dzenColor "white" "#0f0f0f" . pad . noScratchPad -- haskell makes it so easy | |
--, ppHiddenNoWindows = dzenColor "#444444" "#161616" . pad | |
, ppUrgent = dzenColor "red" "#FFFFFF" . dzenStrip | |
, ppWsSep = " " | |
, ppSep = " " | |
, ppLayout = dzenColor "#777777" "#161616" . | |
(\x -> case x of | |
"ResizableTall" -> "|" | |
"Mirror ResizableTall" -> "/" | |
--"Full" -> "^i(" ++ myBitmapsDir ++ "/full.xbm)" | |
--"Simple Float" -> "~" | |
_ -> x | |
) | |
--, ppTitle = (" " ++) . dzenColor "white" "#161616" . dzenEscape | |
, ppTitle = \x -> "" | |
, ppOutput = hPutStrLn h | |
} | |
where | |
noScratchPad ws = if ws == "NSP" then "" else ws | |
-- Layout | |
--gimpLayout = combineTwoP (TwoPane 0.04 0.82) (tabbedLayout) (Full) (Not (Role "gimp-toolbox")) | |
customLayout = smartBorders $ avoidStruts $ onWorkspace "web" Full $ onWorkspace "etc" ( spiral (6/7) ||| Full ||| Mirror tiled ) $ tiled ||| Mirror tiled ||| Circle | |
where | |
tiled = ResizableTall nmaster delta ratio [] | |
nmaster = 1 | |
delta = 3/100 | |
ratio = toRational (2/(1+sqrt(5)::Double)) | |
--}}} | |
-- Theme {{{ | |
-- Color names are easier to remember: | |
colorOrange = "#ff7701" | |
colorDarkGray = "#171717" | |
colorPink = "#e3008d" | |
colorGreen = "#00aa4a" | |
colorBlue = "#008dd5" | |
colorYellow = "#fee100" | |
colorWhite = "#cfbfad" | |
myBorderWidth = 1 | |
colorNormalBorder = "#0f0f0f" | |
colorFocusedBorder = "#404040" | |
barFont = "terminus" | |
barXFont = "inconsolata:size=14" | |
xftFont = "xft: terminus-14" | |
--}}} | |
-- Prompt Config {{{ | |
mXPConfig :: XPConfig | |
mXPConfig = | |
defaultXPConfig { font = barFont | |
, bgColor = colorDarkGray | |
, fgColor = colorGreen | |
, bgHLight = colorGreen | |
, fgHLight = colorDarkGray | |
, promptBorderWidth = 0 | |
, height = 14 | |
, historyFilter = deleteConsecutive | |
} | |
-- Run or Raise Menu | |
largeXPConfig :: XPConfig | |
largeXPConfig = mXPConfig | |
{ font = xftFont | |
, height = 20 | |
} | |
-- }}} | |
-- Key mapping {{{ | |
keys' :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ()) | |
keys' conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $ | |
[ ((modMask, xK_p ), runOrRaisePrompt largeXPConfig) | |
, ((mod1Mask, xK_F2 ), spawn "gmrun") | |
, ((0, xK_Print ), spawn "screenshot scr") | |
-- Programs | |
, ((modMask, xK_Return ), spawn $ XMonad.terminal conf) -- spawn terminal | |
, ((modMask, xK_Right ), spawn "ncmpcpp next") | |
, ((modMask, xK_Left ), spawn "ncmpcpp prev") | |
, ((modMask, xK_Down ), spawn "ncmpcpp pause") | |
, ((modMask, xK_q ), spawn "urxvt -e ssh ubuntu") -- go ssh conection | |
, ((modMask, xK_F10 ), spawn "amixer -q set Master toggle") | |
, ((modMask, xK_F8 ), spawn "amixer set 'Master' 5dB- unmute > /dev/null") | |
, ((modMask, xK_F9 ), spawn "amixer set 'Master' 5dB+ unmute > /dev/null") | |
, ((modMask, xK_t ), spawn "/home/riso/Dropbox/scripts/translater > /dev/null") | |
, ((modMask, xK_e ), spawn "urxvt -e mc -S xoria256") | |
, ((mod1Mask, xK_F4 ), spawn "sudo halt") | |
, ((mod1Mask, xK_F3 ), spawn "sudo reboot") | |
, ((modMask, xK_w ), runOrRaise "chromium" (className =? "Chromium-browser")) | |
, ((modMask, xK_s ), runOrRaise "skype" (className =? "Skype")) | |
-- layouts | |
, ((modMask, xK_c), sendMessage $ JumpToLayout "Circle") -- set circle layout | |
, ((modMask, xK_j), windows W.focusDown) -- move focus to the next window | |
, ((modMask, xK_k), windows W.focusUp) -- move focus to the previous window | |
, ((modMask, xK_m), windows W.swapMaster) -- swap the focused window and the master window | |
, ((modMask, xK_g), goToSelected myGSConfig) -- display grid select and go to selected window | |
, ((modMask .|. shiftMask, xK_j), windows W.swapDown) -- swap the focused window with the next window | |
, ((modMask .|. shiftMask, xK_k), windows W.swapUp) -- swap the focused window with the previous window | |
, ((modMask .|. shiftMask, xK_l), sendMessage Expand) -- expand the master area | |
, ((modMask .|. shiftMask, xK_h), sendMessage Shrink) -- shrink the master area | |
, ((modMask, xK_z), sendMessage MirrorExpand) | |
, ((modMask, xK_a ), sendMessage MirrorShrink) | |
, ((modMask, xK_space ), sendMessage NextLayout) | |
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) -- reset layout on current desktop to default | |
, ((modMask, xK_b ), sendMessage ToggleStruts) | |
, ((mod1Mask, xK_Tab ), windows W.focusDown) -- move focus to next window | |
, ((mod1Mask, xK_c ), kill) -- kill selected window | |
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown) -- swap the focused window with the next window | |
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp) -- swap the focused window with the previous window | |
, ((modMask .|. shiftMask, xK_t ), withFocused $ windows . W.sink) -- Push window back into tiling | |
-- workspaces | |
, ((mod1Mask .|. controlMask, xK_Right ), nextWS) | |
, ((mod1Mask .|. shiftMask, xK_Right ), shiftToNext) | |
, ((mod1Mask .|. controlMask, xK_Left ), prevWS) | |
, ((mod1Mask .|. shiftMask, xK_Left ), shiftToPrev) | |
, ((modMask, xK_Escape), myToggle) | |
-- quit, or restart | |
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess)) | |
, ((modMask .|. shiftMask, xK_r ), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart") | |
-- scratchpad | |
, ((modMask, xK_d ), namedScratchpadAction scratchpads "deluge") | |
, ((modMask, xK_z ), namedScratchpadAction scratchpads "keepassx") | |
] | |
++ | |
[((m .|. modMask, k), windows $ f i) | |
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] | |
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] | |
where | |
myToggle = windows $ W.view =<< W.tag . head . filter | |
((\x -> x /= "NSP" && x /= "SP") . W.tag) . W.hidden | |
--}}} | |
-- vim:foldmethod=marker sw=4 sts=4 ts=4 tw=0 et ai nowrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment