.xmonad/xmonad.hs

import XMonad hiding ( (|||), Tall )
import XMonad.Operations

import Graphics.X11.Xlib

import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.Ratio ((%))

import XMonad.ManageHook
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.ManageDocks
import XMonad.Layout.LayoutCombinators
import XMonad.Layout.HintedTile
import XMonad.Layout.IM
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Tabbed
import XMonad.Layout.NoBorders
import XMonad.Layout.WindowNavigation
import XMonad.Layout.Named

import XMonad.Prompt
import XMonad.Prompt.Ssh
import XMonad.Prompt.Layout
import XMonad.Prompt.Man

import XMonad.Actions.CycleWS

import XMonad.Util.Run
import System.IO

main = do
    xmobar <- spawnPipe ( "xmobar" )
    xmonad $ bsxConfig xmobar

bsxConfig h = defaultConfig
       { borderWidth        = 1 
       , terminal           = "urxvtc"
       , workspaces         = ["1:shells", "2:code", "3:web", "4:chat", "5:music", "6:office" ]
                              ++ map show [7 .. 9 :: Int]
       , modMask            = mod4Mask
       , normalBorderColor  = "#dddddd"
       , focusedBorderColor = "#0033ff"
       , logHook            = dynamicLogWithPP $ bsxPP h
       , keys = \c -> mykeys c `M.union` keys defaultConfig c
       , manageHook         = manageHook defaultConfig <+> myManageHook <+> manageDocks
       , startupHook        = setWMName "LG3D"
       , layoutHook         = avoidStrutsOn [D] (onWorkspace "4:chat" (IM (1%6) (Or (Role "roster") (Title "Buddy-Liste"))) (windowNavigation (smartBorders (named "tabbed" (tabbed shrinkText defaultTheme) ||| named "hsplit" (hintedTile Tall) ||| named "vsplit" (hintedTile Wide)))))
       }   
  where
    hintedTile = HintedTile nmaster delta ratio TopLeft
    nmaster    = 1 
    ratio      = 1/2 
    delta      = 3/100
    mykeys (XConfig {modMask = modm}) = M.fromList $
      [   
      -- rotate workspaces
      ((modm .|. controlMask, xK_Right), nextWS)
      , ((modm .|. controlMask, xK_Left), prevWS)

      -- switch to previous workspace
      , ((modm, xK_z), toggleWS)


      -- lock the screen with xscreensaver
      , ((modm .|. shiftMask, xK_l), spawn "xscreensaver-command -lock")

      -- some programs to start with keybindings.
      , ((modm .|. shiftMask, xK_f), spawn "firefox")
      , ((modm .|. shiftMask, xK_m), spawn "thunderbird")
      , ((modm .|. shiftMask, xK_g), spawn "gajim")

      -- prompts
      , ((modm .|. controlMask, xK_s), sshPrompt defaultXPConfig)
      , ((modm .|. controlMask, xK_l), layoutPrompt defaultXPConfig)
      , ((modm .|. controlMask, xK_m), manPrompt defaultXPConfig)

      -- window navigation keybindings.
      , ((modm,               xK_Right), sendMessage $ Go R)
      , ((modm,               xK_Left ), sendMessage $ Go L)
      , ((modm,               xK_Up   ), sendMessage $ Go U)
      , ((modm,               xK_Down ), sendMessage $ Go D)
      , ((modm .|. shiftMask, xK_Right), sendMessage $ Swap R)
      , ((modm .|. shiftMask, xK_Left ), sendMessage $ Swap L)
      , ((modm .|. shiftMask, xK_Up   ), sendMessage $ Swap U)
      , ((modm .|. shiftMask, xK_Down ), sendMessage $ Swap D)
      ]

myManageHook = composeAll
    [ className =? "Pidgin" --> doF(W.shift "4:chat")
    , className =? "Gajim.py" --> doF(W.shift "4:chat")
    , className =? "Firefox" --> doF(W.shift "3:web")
    , className =? "Thunderbird-bin" --> doF(W.shift "3:web")
    , className =? "Quodlibet" --> doF(W.shift "5:music")
    , className =? "OpenOffice.org 2.4" --> doF(W.shift "6:office")
    , className =? "Eclipse" --> doF(W.shift "2:code")
    ]

bsxPP h = defaultPP { ppCurrent         = wrap "<fc=#ff0000>" "</fc>"
                    , ppVisible         = wrap "<fc=#a00000>" "</fc>"
                    , ppHiddenNoWindows = \wsId -> if (':' `elem` wsId) then wsId ++ " " else ""
                    , ppSep             = " | "
                    , ppTitle           = shorten 80
                    , ppOrder           = reverse
                    , ppOutput          = hPutStrLn h }

.xmobarrc

Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
       , bgColor = "black"
       , fgColor = "white"
       , position = Bottom
       , commands = [ Run Cpu ["-L","10","-H","70","--low","green","--normal","yellow","--high","red","-t","<total>"] 50
                    , Run CpuFreq ["-t","<cpu0>|<cpu1>GHz","-L","1","-H","2","--low","green","--normal","yellow","--high","red"] 50
                    , Run Battery ["-L","25","-H","90","--low","red","--high","green","-t","<left>"] 50
                    , Run Memory ["-t","Mem: <used>/<total> (<usedratio>%)"] 50
                    , Run Date "%Y-%m-%d %H:%M:%S" "date" 10
                    , Run StdinReader
                    ]   
       , sepChar = "%" 
       , alignSep = "}{"
       , template = "CPU: %cpu% (%cpufreq%) | %memory% } %StdinReader% { <fc=#ee9a00>%date%</fc> | %battery%"
       }
  • dotfiles/bsx.txt
  • Last modified: 2021/04/18 12:35
  • (external edit)