Tabatha openbsd5.4 xmonad.hs
From wikinotes
~/.xmonad/xmonad.hs
--FOR CHANGES, http://xmonad.org/xmonad-docs/xmonad-contrib/
--XMOBAR PP COLOURS ETC: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DynamicLog.html#v:dynamicLogWithPP
-- Imports.
import XMonad
import Data.Monoid
import System.Exit
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run
import XMonad.Util.EZConfig
import XMonad.Util.Loggers
import System.IO
--import qualified XMonad.Actions.FlexibleResize as Flex
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import XMonad.Layout.Gaps
myTerminal = "mrxvt"
myBorderWidth = 3
myNormalBorderColor = "#686868"
myFocusedBorderColor = "#FF9900"
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
myModMask = mod4Mask
-- KEYBINDING
------------------------------------------------
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
-- launch a terminal
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
-- Flexible Resize
--, ((modm, button2), (\w -> focus w >> Flex.mouseResizeWindow w))
-- launch dmenu
, ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu_run` && eval \"exec $exe\"")
-- , ((modm, xK_p ), spawn "exe=`dmenu_path | dmenu_run -fn \"-*-lucidatypewriter-*-*-*-*-13-*-*-*-*-*-*-*\" -nb \"black\" -nf \"grey\" -sb \"#FF9900\" -sf \"#ffffff\"` && eval \"exec $exe\"")
, ((modm, xK_o ), spawn "xfce4-appfinder")
-- launch gmrun
, ((modm .|. shiftMask, xK_p ), spawn "gmrun")
-- close focused window
, ((modm .|. shiftMask, xK_c ), kill)
, ((modm, xK_c ), kill)
-- Rotate through the available layout algorithms
, ((modm, xK_space ), sendMessage NextLayout)
-- Reset the layouts on the current workspace to default
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
-- Resize viewed windows to the correct size
, ((modm, xK_n ), refresh)
-- Move focus to the next window
--, ((modm, xK_Tab ), windows W.focusDown)
-- Move focus to the next window
, ((modm, xK_j ), windows W.focusDown)
-- Move focus to the previous window
, ((modm, xK_k ), windows W.focusUp )
-- Move focus to the master window
, ((modm, xK_m ), windows W.focusMaster )
-- 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 , xK_comma ), sendMessage (IncMasterN 1))
-- Deincrement the number of windows in the master area
, ((modm , xK_period), sendMessage (IncMasterN (-1)))
-- multimedia keys
--
-- (find keys in /usr/share/X11/XKeysymDB)
--NOTES: This configuration is for rhythmbox. mpc and rhythmbox
--controls cannot be combined successfully, since the command spawns
--the unopened rhythmbox in addition to the task you are trying to achieve
--with mpc.
-- RHYTHMBOX
-- XF86AudioLowerVolume :1008FF11
, ((0 , 0x1008FF11), spawn "amixer -q sset Master 5%-")
-- XF86AudioRaiseVolume :1008FF13
, ((0 , 0x1008FF13), spawn "amixer -q sset Master 5%+")
-- XF86AudioMute :1008FF12
, ((0 , 0x1008FF12), spawn "amixer -q sset Master toggle")
-- XF86AudioPlay :1008FF14
, ((0 , 0x1008ff14), spawn "/home/will/.xmonad/Extensions/rbox ctrl play-toggle")
-- XF86AudioStop :1008FF15
-- , ((0 , 0x1008ff15), spawn "rhythmbox-client --pause")
, ((0 , 0x1008ff15), spawn "/home/will/.xmonad/Extensions/rbox ctrl stop")
-- XF86AudioPrev :1008FF16
, ((0 , 0x1008ff16), spawn "/home/will/.xmonad/Extensions/rbox ctrl prev")
-- XF86AudioNext :1008FF17
, ((0 , 0x1008ff17), spawn "/home/will/.xmonad/Extensions/rbox ctrl next")
-- MPD
-- XF86AudioPlay :1008FF14
-- , ((0 , 0x1008ff14), spawn "mpc toggle")
-- XF86AudioStop :1008FF15
-- , ((0 , 0x1008ff15), spawn "mpc stop")
-- XF86AudioPrev :1008FF16
-- , ((0 , 0x1008ff16), spawn "mpc prev")
-- XF86AudioNext :1008FF17
-- , ((0 , 0x1008ff17), spawn "mpc next")
-- Toggle the status bar gap
-- Use this binding with avoidStruts from Hooks.ManageDocks.
-- See also the statusBar function from Hooks.DynamicLog.
--
--, ((modm , xK_b ), sendMessage ToggleStruts)
-- (present further down text)
--, ((modm .|. controlMask, xK_t), sendMessage $ ToggleGaps) --toogle all gaps
-- Toggle Gap for Conky
, ((modm , xK_s), sendMessage $ ToggleGap R) --toogle the bottom gap
-- Quit xmonad
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
-- Restart xmonad
, ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart & pkill xmobar")
]
++
--
-- mod-[1..9], Switch to workspace N
-- mod-shift-[1..9], Move client to workspace N
--
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (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)]]
-- If another problem arises with the top bar being hidden use
-- the following line:
-- myLayout = gaps [ (U,21), (R,214) ]
myLayout = gaps [ (R,214) ]
$ avoidStruts (Mirror tiled ||| 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 = 7/10
-- Percent of screen to increment by when resizing panes
delta = 3/100
--- 'FLOATING' window control ---
---------------------------------------------------------------------------------------
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Krita" --> doFloat
]
---------------------------------------------------------------------------------------
--- XMOBAR CONFIG ---
---------------------------------------------------------------------------------------
-- Command to launch the bar.
myBar = "xmobar"
-- Custom PP, configure it as you like. It determines what is being written to the bar.
--myPP = xmobarPP { ppCurrent = xmobarColor "#429942" "" . wrap "<" ">" }
--myPP = xmobarPP { ppOrder = \(ws:l:t:_) -> [ws,t] ,ppOutput = hPutStrLn myBar }
myPP = xmobarPP { ppCurrent = xmobarColor "white" "" .wrap "(" ")"
, ppTitle = xmobarColor "grey" ""
, ppOrder = \(ws:l:t:_) -> [ws,t] }
-- Key binding to toggle the gap for the bar.
toggleStrutsKey XConfig {XMonad.modMask = modMask} = (modMask, xK_b)
---------------------------------------------------------------------------------------
-- STARTUP PROGRAMS --
myStartupHook = do
spawn "/home/will/.start";
--sendMessage $ ToggleGap R
--spawn "roxterm -e bash -c 'fortune hitchhiker;bash'"
--spawn "roxterm -e bash -c '/home/will/.xmonad/Extensions/bashStartMsg'"
spawn "mrxvt -e ksh -c 'fortune;ksh'"
-----------------------------------------------------------------------------------------
-- The main function.
--main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
main = xmonad =<< statusBar myBar myPP toggleStrutsKey myConfig
myConfig = defaultConfig {
terminal = myTerminal,
modMask = myModMask,
borderWidth = myBorderWidth,
normalBorderColor = myNormalBorderColor,
focusedBorderColor = myFocusedBorderColor,
keys = myKeys,
-- hooks and layouts
layoutHook = myLayout,
--logHook = dynamicLogWithPP $ defaultPP { ppOrder = \(ws:l:t:_) -> [ws,t] ,ppOutput = hPutStrLn h }
--logHook = dynamicLogWithPP $ defaultPP { ppOrder = \(ws:l:t:_) -> [ws,t] ,ppOutput = hPutStrLn h }
manageHook = manageDocks <+> manageHook defaultConfig,
--handleEventHook = myEventHook,
--logHook = myLogHook,
startupHook = myStartupHook
}