Skip to content

Instantly share code, notes, and snippets.

@belst
Last active April 9, 2017 09:00
Show Gist options
  • Save belst/0fb9f36daad0658e0d21bd71390a78eb to your computer and use it in GitHub Desktop.
Save belst/0fb9f36daad0658e0d21bd71390a78eb to your computer and use it in GitHub Desktop.
Config for github.com/monky-hs/monky
{-# LANGUAGE OverloadedStrings #-}
import Monky
import Monky.Modules
import Monky.Examples.Sound.Alsa
import Monky.Examples.CPU
import Monky.Examples.Memory
import Monky.Examples.Time
import Monky.Examples.Battery
import Monky.Examples.Disk
import Monky.Examples.MPD
import Monky.Examples.Modify
import Monky.Examples.IBus
import Monky.Outputs.Dzen2
import Data.Monoid ((<>))
import qualified Data.Text as T
ibusMap :: [(String, MonkyOut)]
ibusMap =
[ ("xkb:us::eng", MonkyPlain "US")
, ("xkb:de::ger", MonkyPlain "DE")
, ("uniemoji" , MonkyPlain "\xf03e") -- TODO: Find better icon
]
timeStr :: String
timeStr = "^fg(#007AC1)[^fg()%a^fg(#007AC1)] \
\[^fg(#CECECE)%d^fg(#007AC1).^fg()%m^fg(#007AC1)] \
\[^fg(#CECECE)%H^fg(#007AC1):^fg()%M^fg(#007AC1):^fg(#4F5455)%S^fg(#007AC1)]^fg()"
-- Add Ellipsis to long song titles
modifyMPD :: [MonkyOut] -> [MonkyOut]
modifyMPD orig@(MonkyPlain xs:ys)
| T.length xs > 20 = MonkyPlain (T.take 19 xs <> "…"):ys
| otherwise = orig
main :: IO ()
main = startLoop (getDzenOutDiv 16 "/home/belst/.monky/xbm/" $ MonkyPlain " \xe0b3 ")
[ pollPack 1 $ getCPUHandle' ScalingCur
, pollPack 5 $ getMemoryBarHandle 2
, evtPack $ getVOLHandle "default"
, evtPack $ getModifyHandle modifyMPD $ getMPDHandle "127.0.0.1" "6600"
, pollPack 5 $ getBatteryHandle "ACAD" "BAT1"
, pollPack 1 $ getFancyTimeHandle timeStr
, evtPack $ getIBusH ibusMap
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment