From b9f23c8d2189352b409a461c065d635ecab3e893 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 1 Feb 2020 03:59:57 +0000 Subject: Wee musical tweakings --- src/TopC.hs | 27 ++++++--------------------- src/lib/GMPDP.hs | 8 ++++---- src/lib/Music.hs | 40 +++++++++++++++++++++++++--------------- 3 files changed, 35 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/TopC.hs b/src/TopC.hs index 9aea28e..f2fa458 100644 --- a/src/TopC.hs +++ b/src/TopC.hs @@ -1,7 +1,7 @@ import Xmobar import Config import Monitors -import Music (mpris, gpmd) +import Music (mpris, gpmd, mpdt) topProcL p = TopProc (p <~> ["-t" , " " @@ -11,32 +11,17 @@ diskIOL p = DiskIO [("/", ""), ("/home", "")] mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t", " "] 10 -mpdt light = - if light - then "/ \ - \</fc></fn> \ - \<fn=0><album></fn> \ - \<fn=0><fc=dodgerblue4><artist></fc> \ - \<fc=burlywood4><composer></fc> <date></fn>" - else "<ppos>/<plength> \ - \<fn=0><title></fn> \ - \<fn=0><fc=darkseagreen><album></fc></fn> \ - \<fn=0><fc=darkseagreen4><artist></fc> \ - \<fc=burlywood4><composer></fc> <date></fn>" - -autoMPD light = AutoMPD [ "-T", "110", "-E", "…", "-W", "10", "-t" , mpdt light] +autoMPD light = AutoMPD [ "-T", "110", "-E", "…", "-W", "10", "-t" , + " <remaining> " ++ mpdt light] ompd light = - MPD [ "-T", "120", "-W", "10", "-E", "…", "-t", tm, "--", "-p", "6669"] 20 + MPD [ "-T", "120", "-W", "10", "-E", "…", "-t", tm, "--", "-p", "6600"] 20 where tm = " <remaining> " ++ mpdt light compMPD light = concatMonitor " " mpd (autoMPD light) mpn = "spotify" --- music light = toggleMonitor "/tmp/mpris.st" (mpris mpn 120) (compMPD light) --- music light = toggleMonitor "/tmp/mpris.st" gpmd (compMPD light) --- music light = toggleMonitor "/tmp/mpris.st" (compMPD light) (ompd light) -music light = toggleMonitor "/tmp/mpris.st" (mpris mpn 120) (ompd light) --- music light = ompd light +-- music light = toggleMonitor "/tmp/mpris.st" (mpris mpn 120) (autoMPD light) +music = ompd -- <fn=1> 💡 </fn> config p = (baseConfig p) { diff --git a/src/lib/GMPDP.hs b/src/lib/GMPDP.hs index d7e36de..6c8ad17 100644 --- a/src/lib/GMPDP.hs +++ b/src/lib/GMPDP.hs @@ -5,17 +5,17 @@ module GMPDP where import Data.Aeson -import Data.Text -import Control.Applicative + + import qualified Data.ByteString.Lazy as B -import Network.HTTP.Conduit (simpleHttp) + import GHC.Generics import Xmobar import Control.Monad (when, guard) import Control.Concurrent.STM -import Control.Exception (SomeException (..), handle, evaluate) + import System.INotify (Event(..), EventVariety(..), initINotify, addWatch) diff --git a/src/lib/Music.hs b/src/lib/Music.hs index 0fdb87c..3d298df 100644 --- a/src/lib/Music.hs +++ b/src/lib/Music.hs @@ -3,7 +3,7 @@ module Music where import Xmobar import Monitors import qualified Bottom -import Config (defaultHeight) +import Config (defaultHeight, pIsLight) import GMPDP (GMPDP(..)) mpris client width = @@ -11,7 +11,7 @@ mpris client width = ["-t", " <fn=0><tracknumber>\ \ <title> <fc=sienna4><artist></fc>\ \ <album> <length></fn>" - , "-T", show width, "-E", "...", "-M", "100", "-x", ""] 10 + , "-T", show width, "-E", "…", "-M", "100", "-x", ""] 10 mprisConfig client p = Bottom.config [Run (mpris client 165)] "|mpris2|" p @@ -19,24 +19,34 @@ mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t" , " <lapsed> <fc=honeydew3><fn=5><bar></fn></fc>"] 10 -- fn=5 -autoMPD l = AutoMPD [ "-T", l, "-E", "...", "-W", "10", "-t" - , "<length> <ppos>/<plength> \ - \<fn=0><fc=darkolivegreen><title></fc></fn> \ - \<fn=0><album></fn> \ - \<fn=0><fc=dodgerblue4><artist></fc> \ - \<fc=burlywood4><composer></fc> <date></fn>"] - -mpdConfig p = (Bottom.config [Run mpd, Run (autoMPD "150")] "|mpd| |autompd|" p) +mpdt light = + if light + then "<ppos>/<plength> \ + \<fn=0><fc=darkolivegreen><title></fc></fn> \ + \<fn=0><fc=dodgerblue4><artist></fc> \ + \<fn=0><album></fn> \ + \<fc=burlywood4><composer></fc> <date></fn>" + else "<ppos>/<plength> \ + \<fn=0><fc=darkseagreen4><title></fc></fn> \ + \<fn=0><fc=darkslategray4><artist></fc> \ + \<fn=0><fc=burlywood4><album></fc></fn> \ + \<composer> <date></fn>" + +autoMPD l lgt = + AutoMPD [ "-T", l, "-E", "…", "-W", "10", "-t", "<length> " ++ mpdt lgt] + +mpdConfig p = + (Bottom.config [Run mpd, Run (autoMPD "150" (pIsLight p))] "|mpd| |autompd|" p) { textOffsets = [defaultHeight - 7, defaultHeight - 6] } -compMPD = concatMonitor " " mpd (autoMPD "150") -alt x = altMonitor (mpris x 165) compMPD +compMPD p = concatMonitor " " mpd (autoMPD "150" (pIsLight p)) +alt x p = altMonitor (mpris x 165) (compMPD p) gpmd = Run (GMPDP "gmpdp") -config cl = +config cl p = if cl == "mpd" - then mpdConfig - else Bottom.config [Run (alt cl)] "|mpris2_mpd_autompd|" + then mpdConfig p + else Bottom.config [Run (alt cl p)] "|mpris2_mpd_autompd|" p -- cgit v1.2.3