Skip to content

Latest commit

 

History

History
142 lines (137 loc) · 4.63 KB

window_manager.org

File metadata and controls

142 lines (137 loc) · 4.63 KB

Window manager config

XMonad

Use the XMonad tiling window manager.
import XMonad

<<imports>>

import qualified XMonad.StackSet as W
import qualified Data.Map        as M

General settings

Set up uxterm as the default terminal.

myTerminal = "uxterm -fa mono -fg white -bg black"

Use the “super” key as the modifier for window actions.

myModMask = mod4Mask

Key bindings

Use the modifier key and b to hide/reveal the docks.

import XMonad.Util.CustomKeys   (customKeys)
import XMonad.Hooks.ManageDocks (avoidStruts, docks, ToggleStruts(..))
myKeys :: XConfig Layout -> [((KeyMask, KeySym), X ())]
myKeys conf@(XConfig {modMask = modMask}) =
  [ ((modMask, xK_b), sendMessage ToggleStruts) ]

Layouts

There are two layouts:

  • Horizontally tiled with a main stack and a reserve stack.
  • Fullscreen with one application.
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Spiral (spiral)
myLayout = avoidStruts $ smartBorders $ 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

Some windows need to start out as a floating window. Outside of the managed stack.

myManageHook = composeAll
    [ className =? "MPlayer"            --> doFloat
    , className =? "mpv"                --> doFloat
    , title     =? "CEPL"               --> doFloat
    , className =? "Xmessage"           --> doFloat
    , className =? "qemu-system-x86_64" --> doFloat
    , className =? "Wine"               --> doFloat
    , className =? "Screenkey"          --> doIgnore
    , resource  =? "desktop_window"     --> doIgnore
    , resource  =? "kdesktop"           --> doIgnore ]

Logging

Perform the default logging action.

import XMonad.Hooks.DynamicLog
import System.IO (hPutStrLn)
myLogHook h = def { ppOutput = hPutStrLn h }

Docks

Use XMobar as a dock at the top of the screen

import XMonad.Util.Run (spawnPipe)
dock = spawnPipe "xmobar --dock --top"

Entry point

Putting it all together.

defaults pipe = def { terminal   = myTerminal
                    , modMask    = myModMask
                    , keys       = customKeys (\_ -> []) myKeys
                    , layoutHook = myLayout
                    , manageHook = myManageHook
                    , logHook    = dynamicLogWithPP $ myLogHook pipe
                    }

main = dock >>= (\d -> xmonad $ docks $ defaults d)

XMobar

Use XMobar as a status bar / dock.

Config { <<font>>
       <<colors>>
       <<interactive-commands>>
       <<format-template>>
       }

Font

Use the monospace version of the DejaVu fonts.

font = "xft:DejaVu Sans Mono:style=Bold:size=10"

Colors

Use grey text on a black background for everything.

, bgColor = "black"
, fgColor = "grey"

Interactive commands

  • Use the input reader to display window manager status
  • Use the battery meter to display how much time is left until the battery is depleted / charged.
, commands = [ Run StdinReader
             , Run Battery [ "--template", "Battery left: <timeleft>m charging: <acstatus>"
                           , "--"
                           , "-i", "Idle"
                           ] 50
             ]

Format template

Adjust the window manager status to the left. Adjust battery status and date / time on the right.

, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %battery% | %date%"