Skip to content

Instantly share code, notes, and snippets.

@mrowe
Created June 10, 2017 00:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrowe/87d654e7dbd138ec1255c1318adf754d to your computer and use it in GitHub Desktop.
Save mrowe/87d654e7dbd138ec1255c1318adf754d to your computer and use it in GitHub Desktop.
Xmonad/Xmobar config
Config { font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
, borderColor = "black"
, border = TopB
, bgColor = "black"
, fgColor = "grey"
, alpha = 255
, position = TopW L 100
, allDesktops = True
, overrideRedirect = True
, commands = [
-- Run Network "wlp1s0b1" ["-L","0","-H","32", "--normal","green","--high","red"] 10
Run Network "wlp1s0b1" ["--template", "Net: <tx>kB|<rx>kB", "-L","1000","-H","5000", "--low", "gray", "--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50", "--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Swap [] 10
, Run Date "%a %Y-%m-%d %H:%M:%S" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %cpu% | %memory% | %wlp1s0b1% <fc=#ee9a00>%date%</fc>" }
import XMonad
import System.Exit
import System.IO
-- import XMonad.Hooks.SetWNName
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Actions.WorkspaceNames
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import qualified XMonad.StackSet as W
import qualified Data.Map as M
myTerminal = "gnome-terminal"
myKeys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
[
((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modMask, xK_p ), spawn "exe=`dmenu_path | dmenu` && eval \"exec $exe -fn fixed\"")
, ((modMask .|. shiftMask, xK_p ), spawn "gmrun")
, ((modMask .|. shiftMask, xK_c ), kill)
, ((modMask .|. controlMask , xK_space ), sendMessage NextLayout)
, ((modMask .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
, ((modMask, xK_n ), refresh)
, ((modMask, xK_Tab ), windows W.focusDown)
, ((modMask, xK_j ), windows W.focusDown)
, ((modMask, xK_k ), windows W.focusUp )
, ((modMask, xK_m ), windows W.focusMaster )
, ((modMask, xK_Return), windows W.swapMaster)
, ((modMask .|. shiftMask, xK_j ), windows W.swapDown )
, ((modMask .|. shiftMask, xK_k ), windows W.swapUp )
, ((modMask, xK_h ), sendMessage Shrink)
, ((modMask, xK_l ), sendMessage Expand)
, ((modMask .|. shiftMask, xK_l ), spawn "gnome-screensaver-command --lock")
, ((modMask, xK_t ), withFocused $ windows . W.sink)
, ((modMask, xK_comma ), sendMessage (IncMasterN 1))
, ((modMask , xK_period), sendMessage (IncMasterN (-1)))
, ((modMask .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
, ((modMask , xK_q ), restart "xmonad" True)
]
++
[((m .|. modMask, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
main = do
xmproc <- spawnPipe "/usr/bin/xmobar"
xmonad $ defaultConfig {
modMask = mod4Mask, -- command key
borderWidth = 1,
normalBorderColor = "#cccccc",
focusedBorderColor = "#cd8b00",
terminal = myTerminal,
keys = myKeys,
workspaces = map show [1..8],
manageHook = manageDocks <+> manageHook defaultConfig,
layoutHook = avoidStruts $ layoutHook defaultConfig,
logHook = workspaceNamesPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = id
}
>>= dynamicLogWithPP
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment