Skip to content

Instantly share code, notes, and snippets.

@HBBisenieks
Created October 16, 2015 18:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HBBisenieks/1ff446646de4032fe6a4 to your computer and use it in GitHub Desktop.
Save HBBisenieks/1ff446646de4032fe6a4 to your computer and use it in GitHub Desktop.
Xmonad for NaNoWriMo
Config { font = "-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "#444444"
, fgColor = "#cdcdcd"
, position = Top
, lowerOnStart = True
, commands =
[ Run Weather "KOAK" ["-t","Oakland International: <tempF>F","-L","55","-H","80","--normal","green","--high","red","--low","lightblue"
] 36000
, Run Cpu [ "-L" , "3"
, "-H" , "50"
, "--normal" , "green"
, "--high" , "red"
] 10
, Run Memory [ "-t" , "Mem: <usedratio>%"
, "--Low" , "20"
, "--High" , "90"
, "--low" , "#00f000"
, "--normal" , "darkorange"
, "--high" , "#ff0000"
] 10
, Run Swap [] 10
, Run Date "%a %b %_d %l:%M" "date" 10
, Run Battery [ "--template" , "Batt: <acstatus>"
, "--Low" , "10"
, "--High" , "90"
, "--low" , "#ff0000"
, "--normal" , "darkorange"
, "--high" , "#00ff00"
, "--"
, "-o" , "<left>% (<timeleft>)"
, "-O" , "<fc=#daa520>Charging</fc>"
, "-i" , "<fc=#00f000>Charged</fc>"
] 10
, Run StdinReader
, Run Com "/path/to/nano-progress.sh" [] "nano" 50
]
, sepChar = "%"
, alignSep = "}{"
, template = " %nano% | %StdinReader% }{ %cpu% | %memory% * %swap% | %battery% | <fc=#ee9a00>%date%</fc> | %KOAK% "
}
#!/bin/bash
# Assumes that NaNo work is being written in plaintext spread over multiple files
# with all files being included in wordcount having names beginning with nano_
# as a way to separate out files being used for notes etc.
wc -w /path/to/NaNoWriMo/folder/nano_*.txt | awk 'END{
if ($1 > 0)
print "NaNo Progress: " $1 "/50000 words"
else
print "NaNo Progress: 0/50000 words"
}'
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run
import XMonad.Util.EZConfig
import XMonad.Layout.Spacing
import qualified XMonad.StackSet as W
import System.IO
--layout stuff
myLayout = tiled ||| Mirror tiled ||| Full
where
tiled = smartSpacing 7 $ Tall nmaster delta ratio
nmaster = 1
ratio = 2/3
delta = 5/100
main = do
xmproc <- spawnPipe "/usr/bin/xmobar /path/to/.xmobarrc"
xmonad $ defaultConfig
{ borderWidth = 2
, modMask = mod4Mask
, manageHook = composeAll
--don't spawn a new pianobar in master pane
[ title =? "pianobar" --> doF W.swapDown ]
, layoutHook = avoidStruts $ myLayout
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "green" "" . shorten 50
, ppLayout = const ""
}
, terminal = "urxvt"
, normalBorderColor = "#cccccc"
, focusedBorderColor = "#cd8b00"
} `additionalKeys`
[ ((mod4Mask .|. shiftMask , xK_z ), spawn "xscreensaver-command -lock")
, ((controlMask , xK_Print ), spawn "sleep 0.2; scrot -s")
--ctrl-shift-m for music via Pianobar
, ((controlMask .|. shiftMask , xK_m ), spawn "urxvt -name pianobar -e pianobar -c '/usr/bin/pianobar'")
--mod-shift-f for vifm file manager
, ((mod4Mask .|. shiftMask , xK_f ), spawn "urxvt -name vifm -e vifm -c '/usr/bin/vifm'")
, ((0 , xK_Print ), spawn "scrot")
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment