aboutsummaryrefslogtreecommitdiffstats
path: root/xmonad
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--xmonad/.gitignore1
-rw-r--r--xmonad/Makefile16
-rw-r--r--xmonad/xmonad.hs.gpp230
-rw-r--r--xmonad/xmonad.mk2
4 files changed, 248 insertions, 1 deletions
diff --git a/xmonad/.gitignore b/xmonad/.gitignore
new file mode 100644
index 0000000..48adae9
--- /dev/null
+++ b/xmonad/.gitignore
@@ -0,0 +1 @@
+/xmonad.hs
diff --git a/xmonad/Makefile b/xmonad/Makefile
index afb5a4b..0cb5a50 100644
--- a/xmonad/Makefile
+++ b/xmonad/Makefile
@@ -11,11 +11,25 @@ install:
mkdir -p -- ~/.config/X11/xinit/xinitrc.d
test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad
ln -sf -- ~/.dotfiles/xmonad/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad
+ pacman -Qq -- general-preprocessor </dev/null >/dev/null
+ pacman -Qq -- xpybar </dev/null >/dev/null
+ mkdir -p -- ~/.xmonad
+ test ! -d ~/.xmonad/xmonad.hs
+ make xmonad.hs
+ ln -sf -- ~/.dotfiles/xmonad/xmonad.hs ~/.xmonad/xmonad.hs
+ xmonad --recompile
+
+include xmonad.mk
uninstall:
-unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xmonad
-rmdir -- ~/.config/X11/xinit/xinitrc.d
-rmdir -- ~/.config/X11/xinit
-rmdir -- ~/.config/X11
+ -rm -rf -- ~/.xmonad
+ -make clean
+
+clean:
+ -rm -f xmonad.hs
-.PHONY: install uninstall
+.PHONY: install uninstall clean
diff --git a/xmonad/xmonad.hs.gpp b/xmonad/xmonad.hs.gpp
new file mode 100644
index 0000000..0728476
--- /dev/null
+++ b/xmonad/xmonad.hs.gpp
@@ -0,0 +1,230 @@
+-- -*- haskell -*-
+import XMonad hiding ( (|||) )
+import qualified XMonad.StackSet as W -- hiding ( workspaces, focus )
+
+import XMonad.Actions.CycleWS
+import XMonad.Actions.UpdatePointer
+import XMonad.Actions.MouseResize
+import XMonad.Actions.WindowMenu
+
+import XMonad.Hooks.DynamicLog
+import XMonad.Hooks.ManageHelpers
+import XMonad.Hooks.ManageDocks
+import XMonad.Hooks.UrgencyHook
+import XMonad.Hooks.EwmhDesktops
+
+import XMonad.Layout.IM
+import XMonad.Layout.LayoutCombinators
+import XMonad.Layout.LayoutHints
+import XMonad.Layout.NoBorders
+import XMonad.Layout.PerWorkspace
+import XMonad.Layout.ResizableTile
+import XMonad.Layout.Grid
+import XMonad.Layout.Accordion
+import XMonad.Layout.Circle
+import XMonad.Layout.WindowArranger
+import XMonad.Layout.SimpleFloat
+import XMonad.Layout.PerScreen
+import XMonad.Layout.LayoutModifier
+import XMonad.Layout.Gaps
+
+import XMonad.Util.EZConfig
+import XMonad.Util.Loggers
+import XMonad.Util.Run
+import XMonad.Util.Scratchpad
+import XMonad.Util.WindowProperties
+import XMonad.Util.WorkspaceCompare
+import XMonad.Util.Replace
+import XMonad.Util.Themes
+
+import XMonad.Layout.Tabbed
+import XMonad.Layout.DecorationMadness
+import XMonad.Layout.DecorationAddons
+import XMonad.Layout.Decoration
+import XMonad.Layout.SimpleDecoration
+import XMonad.Layout.DwmStyle
+import XMonad.Layout.TabBarDecoration
+import XMonad.Layout.ImageButtonDecoration
+import XMonad.Layout.BorderResize
+import XMonad.Layout.SimpleFloat
+import XMonad.Layout.Maximize
+import XMonad.Layout.Minimize
+
+import qualified Data.Map as M
+
+
+$$<
+ workspace_1=main
+ if test "$(hostname | tr '[[:upper:]]' '[[:lower:]]')" = zenith; then
+ workspace_6=saved
+ workspace_7=chat
+ workspace_8=mail
+ fi
+ workspace_9=media
+
+ modmask=mod4Mask # Super_L
+ focus_on_hover=True
+ with_decorations=true
+
+ if test -x /usr/bin/terminator || test -x /usr/local/bin/terminator; then
+ terminal=terminator
+ elif test -x /usr/bin/st || test -x /usr/local/bin/st; then
+ terminal=st
+ else
+ terminal=xterm
+ fi
+ screenshooter=
+$$>
+
+
+
+---- ==== Keypad numbers ==== ----
+numPadKeys = [ xK_KP_Insert -- 0
+ , xK_KP_End, xK_KP_Down, xK_KP_Page_Down -- 1, 2, 3
+ , xK_KP_Left, xK_KP_Begin, xK_KP_Right -- 4, 5, 6
+ , xK_KP_Home, xK_KP_Up, xK_KP_Page_Up -- 7, 8, 9
+ ]
+
+
+---- ==== Kill panel and restart ==== ----
+$$>if test -x /usr/bin/dpkill; then
+myRestart = "env DISPLAY=${DISPLAY}.0 dpkill xpybar ; xmonad --restart"
+$$>else
+myRestart = "pkill xpybar ; xmonad --restart"
+$$>fi
+
+
+---- ==== Naming of workspaces ==== ----
+myWorkspaces = [ "1$${workspace_1:+-${workspace_1}}"
+ , "2$${workspace_2:+-${workspace_2}}"
+ , "3$${workspace_3:+-${workspace_3}}"
+ , "4$${workspace_4:+-${workspace_4}}"
+ , "5$${workspace_5:+-${workspace_5}}"
+ , "6$${workspace_6:+-${workspace_6}}"
+ , "7$${workspace_7:+-${workspace_7}}"
+ , "8$${workspace_8:+-${workspace_8}}"
+ , "9$${workspace_9:+-${workspace_9}}"
+ ]
+
+
+---- ==== Mouse bindings ==== ----
+stackRotate (W.Stack f [] rs) = W.Stack f [] rs
+stackRotate (W.Stack f ls rs) = W.Stack l (f:(reverse ls')) rs
+ where
+ (l:ls') = reverse ls
+
+stackUnrotate (W.Stack f [] rs) = W.Stack f [] rs
+stackUnrotate (W.Stack f (l:ls) rs) = W.Stack l (ls ++ [f]) rs
+
+stackUnrotateRight (W.Stack f ls []) = W.Stack f ls []
+stackUnrotateRight (W.Stack f ls rs) = W.Stack r ls (f:(reverse rs'))
+ where
+ (r:rs') = reverse rs
+
+stackRotateRight (W.Stack f ls []) = W.Stack f ls []
+stackRotateRight (W.Stack f ls (r:rs)) = W.Stack r ls (rs ++ [f])
+
+myMouse = [ (( $${modmask}, button4), (\w -> focus w >> windows (W.modify' stackRotate)))
+ , (( $${modmask}, button5), (\w -> focus w >> windows (W.modify' stackUnrotate)))
+ , (( $${modmask} .|. controlMask, button4), (\w -> focus w >> windows (W.modify' stackRotateRight)))
+ , (( $${modmask} .|. controlMask, button5), (\w -> focus w >> windows (W.modify' stackUnrotateRight)))
+ ]
+
+
+---- ==== Main method ==== ----
+main = do
+ ---- System status panel
+ d <- spawnPipe "env DISPLAY=${DISPLAY}.0 xpybar -c ~/.config/xpybar/xmonad-monitor"
+
+ ---- Dude… settings
+ xmonad $ docks $ ewmh def
+ { terminal = "$${terminal}"
+ , focusFollowsMouse = $${focus_on_hover}
+ , modMask = $${modmask}
+ , borderWidth = 0 -- No borders
+ , workspaces = myWorkspaces -- Name my workspaces
+ , logHook = myLogHook d -- Top(system) panel hook
+ , manageHook = myManageHook -- Manage hook
+ , layoutHook = myLayoutHook -- Layout algorithms
+ , handleEventHook = handleEventHook def <+> fullscreenEventHook
+ , mouseBindings = \x -> M.union (mouseBindings def x) (M.fromList myMouse)
+ }`additionalKeys` -- Modifiy keybindings
+ [ (( $${modmask}, xK_F4), kill) -- <Super>F4 :: Kill window
+ , (( $${modmask}, xK_F12), spawn "$${terminal}") -- <Super>F12 :: Open terminal
+$$>if test -n "${screenshooter}"; then
+ , (( 0, xK_Print), spawn "$${screenshooter}") -- SysReq :: Take a screen-shot
+$$>fi
+ , (( $${modmask}, xK_q), spawn myRestart) -- modified restart command
+ , (( $${modmask}, xK_F5), sendMessage $ JumpToLayout (decoName ++ "Tall"))
+ , (( $${modmask}, xK_F6), sendMessage $ JumpToLayout (decoName ++ "Mirror Tall"))
+ , (( $${modmask}, xK_F7), sendMessage $ JumpToLayout (decoName ++ "Grid"))
+ , (( $${modmask}, xK_F8), sendMessage $ JumpToLayout "Full")
+ , (( $${modmask} .|. controlMask, xK_m), withFocused (sendMessage . maximizeRestore))
+ , (( $${modmask}, xK_m), withFocused minimizeWindow)
+ , (( $${modmask} .|. shiftMask , xK_m), sendMessage RestoreNextMinimizedWin)
+ ]
+
+
+---- ==== Layout settings ==== ----
+ratios = [ toRational (2/(1 + sqrt 5 :: Double)) -- golden ratio
+ , toRational (sqrt 2 - 1 :: Double) -- silver ratio
+ , 1 / 2 -- half
+ ]
+
+$$>if ${with_decorations}; then
+$$> deco="imageButtonDeco shrinkText myTheme"
+myTheme = (defaultThemeWithImageButtons
+ { activeColor = "#333333"
+ , inactiveColor = "#000000"
+ , urgentColor = "#880000"
+ , activeBorderColor = "#888888"
+ , inactiveBorderColor = "#888888"
+ , urgentBorderColor = "#CD656C"
+ , activeTextColor = "#EEEEEE"
+ , inactiveTextColor = "#EEEEEE"
+ , urgentTextColor = "#FFFFFF"
+ , fontName = "-misc-fixed-medium-r-normal-*-10-*-*-*-c-*-iso10646-1"
+ , decoWidth = 100
+ , decoHeight = 14
+ , windowTitleAddons = []
+ {- , windowTitleIcons = [] -}
+ })
+decoName = "ImageButtonDeco Maximize Minimize "
+$$>else
+$$> deco=
+decoName = "Maximize Minimize "
+$$>fi
+
+myManageHook = manageDocks <+> manageHook def <+> composeAll
+ [ className =? "XEyes" --> doIgnore
+ , className =? "TzClock" --> doIgnore
+ ]
+myLayoutHook = avoidStruts $ myLayouts
+myLayouts = $${deco} (maximize $ minimize (tiled 2))
+ ||| $${deco} (maximize $ minimize (Mirror (tiled 2)))
+ ||| full
+ ||| $${deco} (maximize $ minimize Grid)
+ ||| $${deco} (maximize $ minimize (Mirror Grid))
+ ||| full
+tiled n = Tall nmaster delta (ratios!!n)
+full = noBorders Full
+nmaster = 1
+delta = 1/100
+
+
+---- ==== dzen2/xpybar (top panel) settings ==== ----
+myLogHook h = do
+ dynamicLogWithPP $ def
+ { ppCurrent = dzenColor "#303030" "#909090" . pad
+ , ppHidden = dzenColor "#909090" "" . pad
+ , ppHiddenNoWindows = dzenColor "#606060" "" . pad
+ , ppLayout = dzenColor "#909090" "" . pad
+ , ppUrgent = dzenColor "#cd656c" "" . pad . dzenStrip
+ , ppTitle = shorten 100
+ , ppWsSep = ""
+ , ppSep = " "
+ , ppOutput = hPutStrLn h
+ }
+ dynamicLogString def
+ { ppSort = getSortByXineramaRule
+ } >>= xmonadPropLog
diff --git a/xmonad/xmonad.mk b/xmonad/xmonad.mk
new file mode 100644
index 0000000..66b4054
--- /dev/null
+++ b/xmonad/xmonad.mk
@@ -0,0 +1,2 @@
+xmonad.hs: xmonad.hs.gpp xmonad.mk
+ gpp -s '$$$$' < xmonad.hs.gpp > ~/.xmonad/xmonad.hs