From f62d3d8c2bc488f26fa21a3f824879d614570aec Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 13 Aug 2022 17:15:15 +0100 Subject: lib: clean ups --- lib/Music.hs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/Music.hs (limited to 'lib/Music.hs') diff --git a/lib/Music.hs b/lib/Music.hs new file mode 100644 index 0000000..dc7375c --- /dev/null +++ b/lib/Music.hs @@ -0,0 +1,53 @@ +module Music where + +import Xmobar +import Monitors +import qualified Bottom +import Config (defaultHeight, pIsLight, pHigh, fc, fni) + +mpris p client width = + Mpris2 client + ["-t", fni "\xf1bc" ++ " " ++ fc (pHigh p) "<artist>" + ++ " <album> <length> <composer>" + , "-T", show width, "-E", "…", "-M", "100", "-x", ""] 40 + +mprisConfig client p = Bottom.config [Run (mpris p client 165)] "|mpris2|" p + +mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t" + , " <lapsed> <fc=honeydew3><fn=5><bar></fn></fc>"] 10 -- fn=5 + + +mpdt' c0 c1 c2 = "<ppos>/<plength> " + ++ fc c0 "<title> " ++ fc c1 "<artist> " ++ fc c2 "<album>" + ++ " <composer> <date>" + +mpdt light = + if light + then mpdt' "darkolivegreen" "dodgerblue4" "burlywood4" + else mpdt' "darkseagreen4" "darkslategray4" "burlywood4" + +autoMPD l lgt = + AutoMPD [ "-T", l, "-E", "…", "-W", "10", "-t", "<length> " ++ mpdt lgt] + +mpdx a p i = + MPDX [ "-W", "12", "-b", "░", "-f", "▒", "-t", "<statei> <remaining>" + , "--", "-p", p, "-P", fni "\xf144", "-Z", fni i, "-S", fni i] 20 a + +mpdMon = mpdx "mpd" "6600" "\xf001" +mopMon = mpdx "mopidy" "6669" "\xf1bc" + +mpdConfig p = + (Bottom.config [Run mpd, Run (autoMPD "150" (pIsLight p))] "|mpd| |autompd|" p) + { + textOffsets = [defaultHeight - 7, defaultHeight - 6] + } + +compMPD p = concatMonitor " " mpd (autoMPD "150" (pIsLight p)) +alt x p = altMonitor (mpris p x 165) (compMPD p) + +gpmd = Run (GMPDP "gmpdp") + +config cl p = + if cl == "mpd" + then mpdConfig p + else Bottom.config [Run (alt cl p)] "|mpris2_mpd_autompd|" p -- cgit v1.2.3