Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- xmonad config file.
- --
- import XMonad
- import List
- import Data.Monoid
- import System.Exit
- import System.IO
- import qualified XMonad.StackSet as W
- import qualified Data.Map as M
- -- Layout stuff
- import XMonad.Layout.NoBorders
- import XMonad.Layout.IM
- import XMonad.Layout.PerWorkspace
- import XMonad.Layout.ResizableTile
- import XMonad.Layout.Reflect
- -- Hooks
- import XMonad.Hooks.DynamicLog
- import XMonad.Hooks.EwmhDesktops
- import XMonad.Hooks.ManageDocks
- import XMonad.Hooks.SetWMName
- import XMonad.Hooks.UrgencyHook
- -- Utils
- import XMonad.Util.Loggers
- import XMonad.Util.Run
- import XMonad.Util.WorkspaceCompare
- myTerminal = "urxvtc"
- myModMask = mod4Mask
- -- The mask for the numlock key. Numlock status is "masked" from the
- -- current modifier status, so the keybindings will work with numlock on or
- -- off. You may need to change this on some systems.
- --
- -- Set numlockMask = 0 if you don't have a numlock key, or want to treat
- -- numlock status separately.
- --
- myNumlockMask = mod2Mask
- -- in Db!
- myVolStep = "1"
- -- A tagging example:
- --
- myWorkspaces = ["一","二","三","四","五","六","七","八","九"]
- -- Border colors for unfocused and focused windows, respectively.
- --
- myNormalBorderColor = "#000000"
- myFocusedBorderColor = "#ffffff"
- ------------------------------------------------------------------------
- -- Layouts:
- -- You can specify and transform your layouts by modifying these values.
- -- If you change layout bindings be sure to use 'mod-shift-space' after
- -- restarting (with 'mod-q') to reset your layout state to the new
- -- defaults, as xmonad preserves your old layout settings by default.
- --
- -- smartBorders removes borders when floated window is fullscreen or when
- -- there's only one window on a screen.
- --
- -- avoidStruts leaves enough space for docks wherever they appear.
- --
- myLayout = avoidStruts $ smartBorders $ onWorkspace "六" gimpLayout $ standardLayouts
- where
- -- default tiling algorithm partitions the screen into two panes
- tiled = ResizableTall nmaster delta ratio slaves
- -- 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
- --
- slaves = []
- --
- gimpLayout = withIM (0.11) (Role "gimp-toolbox") $
- reflectHoriz $
- withIM (0.15) (Role "gimp-dock") standardLayouts
- standardLayouts = tiled ||| Mirror tiled ||| Full
- ------------------------------------------------------------------------
- -- Window rules:
- -- Execute arbitrary actions and WindowSet manipulations when managing
- -- a new window. You can use this to, for example, always float a
- -- particular program, or have a client always appear on a particular
- -- workspace.
- --
- -- To find the property name associated with a program, use
- -- > xprop | grep WM_CLASS
- -- and click on the client you're interested in.
- --
- -- To match on the WM_NAME, you can use 'title' in the same way that
- -- 'className' and 'resource' are used below.
- --
- -- manageDocks de-manages dock windows, so xmonad does not try to
- -- tile them
- --
- myManageHook = composeAll
- [ className =? "MPlayer" --> doFloat <+> doShift "四"
- , className =? "feh" --> doFloat
- , className =? "Ario" --> doShift "四"
- , className =? "Ossxmix" --> doShift "四"
- , className =? "Galculator" --> doFloat
- , className =? "Firefox" --> doShift "一"
- , className =? "Gimp" --> doShift "六"
- ]
- ------------------------------------------------------------------------
- -- Event handling
- -- * EwmhDesktops users should change this to ewmhDesktopsEventHook
- --
- -- Defines a custom handler function for X Events. The function should
- -- return (All True) if the default handler is to be run afterwards. To
- -- combine event hooks use mappend or mconcat from Data.Monoid.
- --
- myEventHook = mempty
- ------------------------------------------------------------------------
- -- Status bars and logging
- -- Perform an arbitrary action on each internal state change or X event.
- -- See the 'XMonad.Hooks.DynamicLog' extension for examples.
- --
- -- General status bar options
- myStatusBar = "dzen2 -w 800 -ta l " ++ myDzenGenOpts
- -- General dzen options
- myDzenGenOpts = "-fg '" ++ myGeneralFgColor ++ "' -bg '" ++ myGeneralBgColor ++ "' -fn '" ++ myFont ++ "'"
- -- Icons
- myIconPath = "/home/runiq/.config/dzen2/icons/"
- -- Fonts
- mySymbolFont = "DejaVu Sans-9"
- myFont = "Meguri P-9:bold"
- myJapaneseFont = "Meguri P-14:bold"
- -- Colors
- myGeneralFgColor = "#ffffff"
- myGeneralBgColor = "#000000"
- myCurrentFgColor = "#ffffff"
- myCurrentBgColor = "#000000"
- myVisibleFgColor = "#1994d1"
- myVisibleBgColor = "#000000"
- myHiddenFgColor = "#1550aa"
- myHiddenBgColor = "#000000"
- myHiddenNWFgColor = "#888888"
- myHiddenNWBgColor = "#000000"
- myUrgentFgColor = "#ff0000"
- myUrgentBgColor = "#000000"
- myTitleFgColor = "#ffffff"
- myTitleBgColor = "#000000"
- myLayoutFgColor = "#1994d1"
- myLayoutBgColor = "#000000"
- mySep = " "
- myWsSep = " "
- myPP = dzenPP
- { ppCurrent = wrapFont myJapaneseFont . dzenColor myCurrentFgColor myCurrentBgColor
- , ppVisible = wrapFont myJapaneseFont . dzenColor myVisibleFgColor myVisibleBgColor . wrapClickable
- , ppHidden = wrapFont myJapaneseFont . dzenColor myHiddenFgColor myHiddenBgColor
- -- , ppHiddenNoWindows = const "" -- not needed
- , ppUrgent = wrapFont myJapaneseFont . dzenColor myUrgentFgColor myUrgentBgColor . dzenStrip
- , ppSep = mySep
- , ppWsSep = myWsSep
- , ppTitle = dzenColor myTitleFgColor myTitleBgColor . shorten 50
- , ppLayout = dzenColor myLayoutFgColor"" .
- (\x -> case x of
- "ResizableTall" -> wrapBitmap "dzen_bitmaps/tall.xbm"
- "Mirror ResizableTall" -> wrapBitmap "dzen_bitmaps/mtall.xbm"
- "Full" -> wrapBitmap "dzen_bitmaps/full.xbm"
- "IM ReflectX IM ResizableTall" -> wrapBitmap "dzen_bitmaps/tall.xbm"
- "IM ReflectX IM Mirror ResizableTall" -> wrapBitmap "dzen_bitmaps/mtall.xbm"
- "IM ReflectX IM Full" -> wrapBitmap "dzen_bitmaps/full.xbm")
- -- , ppOutput = hPutStrLn h
- }
- where
- currentWsIndex w = case (elemIndex w myWorkspaces) of
- Nothing -> "1"
- Just n -> show n
- wrapClickable content = wrap ("^ca(1,xdotool key super+" ++ (show $ currentWsIndex content)) "^ca()"
- wrapFont font = wrap ("^fn(" ++ font ++ ")") "^fn()"
- wrapBitmap bitmap = "^p(5)^i(" ++ myIconPath ++ bitmap ++ ")^p(5)"
- ------------------------------------------------------------------------
- -- Startup hook
- -- By default, do nothing.
- --myStartupHook = return ()
- --
- -- Set WMName to LG3D for Java apps
- myStartupHook = setWMName "LG3D"
- ------------------------------------------------------------------------
- -- Key bindings. Add, modify or remove key bindings here.
- --
- myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
- -- launch a terminal
- [ ((modm, xK_y ), spawn $ XMonad.terminal conf)
- -- launch dmenu
- , ((modm, xK_x ), spawn "exe=`dmenu_path | dmenu -i -r -p \"Execute:\" -y 0 -w 1032 -nb black -nf \"#103060\" -sb black -sf \"#1d53ff\" -fn \"xft:DejaVu Sans-9:Condensed\"` && eval \"exec $exe\"")
- -- close focused window
- , ((modm .|. shiftMask, 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_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)))
- -- 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)
- -- Quit xmonad
- , ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
- -- Restart xmonad
- , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart")
- ------------------------------------------------------------------------------------
- -- my own keybindings
- --
- -- Control MPD
- , ((modm , xK_Left ), spawn "mpc prev")
- , ((modm , xK_Right ), spawn "mpc next")
- , ((modm , xK_Down ), spawn "mpc toggle")
- , ((modm , xK_Up ), spawn "mpc random")
- -- The following are XF86* keybindings, I looked them up in
- -- /usr/include/X11/XF86keysym.h.
- --
- -- I tend to hit both the Fn and the Super key, so here goes nothing
- --
- -- Toggle between Mute and non-mute
- , ((0 , 0x1008FF12), spawn "ossmix misc.front-mute toggle")
- , ((modm , xK_F3 ), spawn "ossmix misc.front-mute toggle")
- -- Lower volume by <myVolStep> Db
- , ((0 , 0x1008FF11), spawn ("ossmix vmix0-outvol -- -" ++ myVolStep))
- , ((modm , xK_F4 ), spawn ("ossmix vmix0-outvol -- -" ++ myVolStep))
- -- Raise volume by <myVolStep> Db
- , ((0 , 0x1008FF13), spawn ("ossmix vmix0-outvol -- +" ++ myVolStep))
- , ((modm , xK_F5 ), spawn ("ossmix vmix0-outvol -- +" ++ myVolStep))
- -- Shrink slave windows
- , ((modm , xK_a ), sendMessage MirrorShrink)
- -- Expand slave windows
- , ((modm , xK_s ), sendMessage MirrorExpand)
- ]
- ++
- --
- -- 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.view, 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
- --
- -- Kein greedyView --> kein Swap der Workspaces
- [((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))
- -- you may also bind events to the mouse scroll wheel (button4 and button5)
- ]
- ------------------------------------------------------------------------
- -- Now run xmonad with all the defaults we set up.
- main = do
- -- Spawns dzen as specified in myStatusBar
- --
- myStatusBarPipe <- spawnPipe myStatusBar
- xmonad $ withUrgencyHook NoUrgencyHook $ ewmh defaultConfig {
- -- simple stuff
- terminal = myTerminal,
- modMask = myModMask,
- numlockMask = myNumlockMask,
- workspaces = myWorkspaces,
- normalBorderColor = myNormalBorderColor,
- focusedBorderColor = myFocusedBorderColor,
- -- key bindings
- keys = myKeys,
- mouseBindings = myMouseBindings,
- -- hooks, layouts
- layoutHook = myLayout,
- manageHook = myManageHook,
- handleEventHook = myEventHook,
- -- why can't I run this from myLogHook :-(
- logHook = dynamicLogWithPP $ myPP myStatusBarPipe,
- startupHook = myStartupHook
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement