Skip to content

Instantly share code, notes, and snippets.

@macizomedia
Forked from soulthreads/xmobarrc
Created December 15, 2021 13:40
Show Gist options
  • Save macizomedia/e5d3fbaf16af5eac36694f4879e1789a to your computer and use it in GitHub Desktop.
Save macizomedia/e5d3fbaf16af5eac36694f4879e1789a to your computer and use it in GitHub Desktop.
XMonad config
Config { font = "xft:Liberation Mono-8:regular"
, bgColor = "#323232"
, fgColor = "#EEEEEC"
, position = Static { xpos = 0, ypos = 0, width = 1024, height = 11 }
, lowerOnStart = True
, commands =
[
Run Network "eth0" ["-L","0","-H","32","--normal","#8ae234","--high","red"] 10
, Run Network "ppp0" ["-L","0","-H","32","--normal","#8ae234","--high","red"] 10
, Run Network "eth1" ["-L","0","-H","100","--normal","#8ae234","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","#8ae234","--high","red", "-t", "<bar>"] 10
--, Run Memory ["-t","Mem: <usedratio>%"] 10
--, Run Swap [] 10
, Run Battery ["-L", "10", "-H", "90","--low","red", "--normal", "#8ae234","--high", "#729fcf", "-t", "BAT: <left>"] 100
, Run Date "%a %d.%m %H:%M" "date" 10
, Run StdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{| %cpu% | %ppp0% <fc=lightblue>|</fc> %battery% | <fc=#34e2e2>%date%</fc>"
}
import XMonad
import XMonad.Actions.SpawnOn
import XMonad.Actions.GridSelect
import XMonad.Actions.DynamicWorkspaces
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.EwmhDesktops
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ThreeColumns
import XMonad.Layout.NoBorders
import XMonad.Layout.ResizableTile
import XMonad.Prompt
import XMonad.Prompt.Window
import XMonad.Prompt.RunOrRaise
import XMonad.Prompt.Shell
import XMonad.Util.Run
import XMonad.Util.EZConfig
import XMonad.Util.Cursor
import XMonad.Util.Scratchpad
import qualified XMonad.StackSet as W
import System.IO
myWorkspaces = ["α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ" ]
myManageHook = composeAll $ [
title =? "glxgears" --> doFloat
, className =? "Dia" --> doFloat
, className =? "Qjackctl" --> doFloat
, className =? "Qjackctl.real" --> doFloat
, className =? "Calfjackhost" --> doFloat
, className =? "feh" --> doFloat
, className =? "Gnome-mplayer" --> doFloat
, className =? "BasicWin" --> doFloat
, className =? "Jack-keyboard" --> doFloat
, className =? "Qsynth" --> doFloat
, className =? "Vmpk" --> doFloat
, resource =? "XXkb" --> doIgnore
, className =? "Iceweasel" --> doF (W.shift "β")
, className =? "Deadbeef" --> doF (W.shift "δ")
, className =? "Okular" --> doF (W.shift "γ")
, className =? "Claws-mail" --> doF (W.shift "ε")
, className =? "Pavucontrol" --> doFloat
, isFullscreen --> doFullFloat
, scratchpadManageHook (W.RationalRect l t w h)
]
where
h = 0.56
w = 0.61
t = 1 - h
l = (1 - w)/2
myLayout = onWorkspace "η" (ThreeCol 1 (1/100) (1/2)) Full ||| tiled ||| Mirror tiled
where
tiled = ResizableTall nmaster delta ratio []
nmaster = 1
ratio = 1/2
delta = 1/100
gsconfig = defaultGSConfig {
gs_cellheight = 25
, gs_cellwidth = 200
, gs_font = "xft:Liberation Mono:size=9"
}
myXPConfig = defaultXPConfig {
font = "xft:Liberation Mono:size=9"
, position = Bottom
}
myKeys =
[
-- ((mod4Mask, xK_p), spawn "dmenu_run -nb '#000' -nf '#FFF' -fn '-xos4-terminus-bold-r-normal--14-140-72-72-*-*-iso10646-1' ")
((mod4Mask, xK_p), shellPrompt myXPConfig)
, ((mod4Mask .|. shiftMask, xK_h), sendMessage MirrorExpand)
, ((mod4Mask .|. shiftMask, xK_l), sendMessage MirrorShrink)
, ((mod4Mask .|. shiftMask, xK_e), spawn "emacs")
, ((mod4Mask .|. shiftMask, xK_m), spawn "uxterm -e ncmpcpp")
, ((mod4Mask .|. shiftMask, xK_w), spawn "firefox")
, ((mod4Mask .|. shiftMask, xK_r), spawn "okular")
, ((0, 0x1008ff11), spawn "amixer sset Master 1%-")
, ((0, 0x1008ff13), spawn "amixer sset Master 1%+")
, ((0, xK_Print), spawn "scrot")
, ((mod4Mask, xK_c), spawn "mpc toggle")
, ((mod4Mask, xK_o), spawn "/home/anton/sources/mpd-not-short.py /data/Music/ /var/run/mpd/socket 0")
, ((mod4Mask, xK_b), sendMessage ToggleStruts)
, ((mod4Mask, xK_g), windowPromptGoto myXPConfig)
, ((mod4Mask .|. shiftMask, xK_g), goToSelected gsconfig)
, ((mod4Mask, xK_s), scratchpadSpawnActionCustom "uxterm -T scratchpad -name scratchpad -e screen -d -RR -S scpad")
]
++
[
((m .|. mod4Mask, k), windows $ f i)
| (i, k) <- zip myWorkspaces ([xK_1..xK_9] ++ [xK_0])
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
]
myLogHook xmproc = dynamicLogWithPP $ xmobarPP {
ppOutput = hPutStrLn xmproc
, ppCurrent = xmobarColor "lightblue" "#282828" . wrap "[" "]"
, ppHiddenNoWindows = xmobarColor "#777777" "" . noScratchPad
, ppHidden = noScratchPad
, ppTitle = xmobarColor "lightgreen" "" . shorten 80
, ppSep = " | "
}
where
noScratchPad ws = if ws == "NSP" then "" else ws
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /home/anton/.xmonad/xmobarrc"
xmonad $ ewmh defaultConfig {
startupHook = setDefaultCursor xC_left_ptr
, manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
, layoutHook = avoidStruts $ smartBorders $ myLayout
, modMask = mod4Mask -- Rebind Mod to Windows key
, terminal = "uxterm"
, workspaces = myWorkspaces
, normalBorderColor = "#D3D7CF"
, focusedBorderColor = "#729FCF"
, handleEventHook = ewmhDesktopsEventHook
, logHook = myLogHook xmproc
} `additionalKeys` myKeys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment