Skip to content

Instantly share code, notes, and snippets.

@tzbob
Created September 11, 2012 14:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzbob/3699186 to your computer and use it in GitHub Desktop.
Save tzbob/3699186 to your computer and use it in GitHub Desktop.
urxvt.scrollBar: false
urxvt.font: xft:inconsolata:size=11
urxvt.boldFont: xft:inconsolata:size=11
urxvt.cursorColor: #7F7F7F
Xft.hintstyle: hintfull
Xft.hinting: true
Xft.antialias: true
Xft.rgba: rgb
*background: #FAFAFA
*foreground: #333333
!black
*color0: #251f1f
*color8: #5e5e5e
!red
*color1: #eb4509
*color9: #eb4509
!green
*color2: #006732
*color10: #006732
!yellow
*color3: #ffac18
*color11: #ffac18
!blue
*color4: #46aede
*color12: #46aede
!magenta
*color5: #e32c57
*color13: #e32c57
!cyan
*color6: #5EB2AD
*color14: #5EB2AD
!white
*color7: #efefef
*color15: #efefef
Config {
font = "xft:inconsolata:size=10:antialias=true"
, fgColor = "#EFEFEF"
, bgColor = "#333333"
, position = Static { xpos = 0, ypos = 1050, width = 1920, height = 30 }
, lowerOnStart = True
, commands = [
Run Battery ["-t", "<left>"] 100
, Run MultiCpu ["-t","<total0>"] 30
, Run Date "%_d %#B %Y <fc=#90C63D>|</fc> %H:%M" "date" 600
, Run Com "/home/tzbob/bin/alsavolume" [] "volume" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = " %StdinReader% }{<fc=#90C63D>cpu</fc> %multicpu% <fc=#90C63D>vol</fc> %volume% <fc=#90C63D>bat</fc> %battery% <fc=#90C63D>|</fc> %date% "
}
import XMonad
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Layout.NoBorders
import XMonad.Actions.UpdatePointer
import XMonad.Util.Run(spawnPipe)
import System.IO (hPutStrLn)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
myTerminal = "urxvtc"
myFocusFollowsMouse :: Bool
myFocusFollowsMouse = True
myBorderWidth = 1
myModMask = mod1Mask
myWorkspaces = ["A","S","D","F"]
--myMainColor = "#4A8BF5"
myMainColor = "#90C63D"
myTextcolor = "#EFEFEF"
myBgColor = "#333333"
myLowColor = "#999999"
myNormalBorderColor = myTextcolor
myFocusedBorderColor = myTextcolor
-- Key bindings. Add, modify or remove key bindings here.
-------------------------------------------------------------------------------
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- close focused window
, ((modm .|. shiftMask, xK_c), kill)
-- Rotate through the available layout algorithms
, ((modm, xK_space ), sendMessage NextLayout)
-- Resize viewed windows to the correct size
, ((modm, xK_n), refresh)
-- Move focus to the next window
, ((modm, xK_j), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_k), windows W.focusUp )
-- Swap the focused window and the master window
, ((modm, xK_Return), windows W.swapMaster)
-- Swap the focused window with the next window
, ((modm .|. shiftMask, xK_j), windows W.swapDown )
-- Swap the focused window with the previous window
, ((modm .|. shiftMask, xK_k), windows W.swapUp )
-- Shrink the master area
, ((modm, xK_h), sendMessage Shrink)
-- Expand the master area
, ((modm, xK_l), sendMessage Expand)
-- Push window back into tiling
, ((modm, xK_t), withFocused $ windows . W.sink)
-- Increment the number of windows in the master area
, ((modm .|. shiftMask, xK_h), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm .|. shiftMask, xK_l), sendMessage (IncMasterN (-1)))
-- Volume
, ((modm .|. controlMask , xK_j), spawn "amixer -q set Master 5- unmute")
, ((modm .|. controlMask , xK_k), spawn "amixer -q set Master 5+ unmute")
, ((modm .|. controlMask , xK_m), spawn "amixer set Master toggle")
-- Toggle the status bar gap
, ((modm, xK_b), sendMessage ToggleStruts)
-- Programs
, ((modm, xK_p), spawn "bash -il dmenu_run")
, ((modm, xK_m), spawn "dmount")
, ((modm, xK_i), spawn "urxvtc -e irssi")
, ((modm, xK_c), spawn "chromium")
-- Restart xmonad
, ((modm, xK_q), spawn "xmonad --recompile; xmonad --restart")
]
++
--
-- mod-[asdf], Switch to workspace N
-- mod-shift-[asdf], Move client to workspace N
--
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_a, xK_s, xK_d, xK_f]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
--
-- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
-- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
--
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
-- Mouse bindings: default actions bound to mouse events
-------------------------------------------------------------------------------
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
-- mod-button1, Set the window to floating mode and move by dragging
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
-- mod-button2, Raise the window to the top of the stack
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
-- mod-button3, Set the window to floating mode and resize by dragging
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))
]
-- Layouts
------------------------------------------------------------------------
myLayout = smartBorders $ avoidStruts $ tiled ||| Mirror tiled ||| Full
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 3/100
-- Window rules:
-- > xprop | grep WM_CLASS
-------------------------------------------------------------------------------
myManageHook = manageDocks <+> composeAll
[ --resource =? "desktop_window" --> doIgnore
]
-- Event handling
-- * EwmhDesktops users should change this to ewmhDesktopsEventHook
------------------------------------------------------------------------
myEventHook = mempty
-- Status bars and logging
-------------------------------------------------------------------------------
addPad = wrap " " " "
myPP statusPipe = xmobarPP {
ppOutput = hPutStrLn statusPipe
, ppCurrent = xmobarColor myMainColor myBgColor . addPad
, ppHiddenNoWindows = xmobarColor myLowColor "" . addPad
, ppHidden = xmobarColor myTextcolor "" . addPad
, ppTitle = xmobarColor myTextcolor ""
, ppSep = xmobarColor myMainColor myBgColor " | "
}
myLogHook pipe = (dynamicLogWithPP (myPP pipe)) >> (updatePointer (Relative 0.5 0.5))
-- Startup hook
-------------------------------------------------------------------------------
myStartupHook = return ()
-- Configuration structure
-------------------------------------------------------------------------------
defaults statusPipe = defaultConfig {
-- simple stuff
terminal = myTerminal,
focusFollowsMouse = myFocusFollowsMouse,
borderWidth = myBorderWidth,
modMask = myModMask,
workspaces = myWorkspaces,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
-- bindings
keys = myKeys,
mouseBindings = myMouseBindings,
-- hooks, layouts
layoutHook = myLayout,
manageHook = myManageHook,
handleEventHook = myEventHook,
logHook = myLogHook statusPipe,
startupHook = myStartupHook
}
-- Run xmonad with the settings specified. No need to modify this.
-------------------------------------------------------------------------------
main = do
statusPipe <- spawnPipe "xmobar ~/.xmonad/xmobar.hs"
x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment