diff options
author | jao <jao@gnu.org> | 2019-01-27 23:12:27 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2019-01-27 23:12:27 +0000 |
commit | 09141b9a589404fbfa1fabb34c458c7d03edd3f9 (patch) | |
tree | 04b3879beaf501304e7c9c07ebe34dfa3a60b194 /src/lib | |
parent | 78bcb8c73ffb1b09b379ea0bbd7e68f2d84e187e (diff) | |
download | xmobar-config-09141b9a589404fbfa1fabb34c458c7d03edd3f9.tar.gz xmobar-config-09141b9a589404fbfa1fabb34c458c7d03edd3f9.tar.bz2 |
Using monitor combiners to auto-switch mpd/mpris
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bottom.hs | 2 | ||||
-rw-r--r-- | src/lib/Config.hs | 6 | ||||
-rw-r--r-- | src/lib/MPD.hs | 2 | ||||
-rw-r--r-- | src/lib/Monitors.hs | 3 | ||||
-rw-r--r-- | src/lib/Mpris.hs | 4 | ||||
-rw-r--r-- | src/lib/Music.hs | 16 |
6 files changed, 26 insertions, 7 deletions
diff --git a/src/lib/Bottom.hs b/src/lib/Bottom.hs index 1bbf359..176c3b3 100644 --- a/src/lib/Bottom.hs +++ b/src/lib/Bottom.hs @@ -7,7 +7,7 @@ import Monitors config cs tpl p = (baseConfig p) { position = BottomSize C 100 defaultHeight , textOffset = defaultHeight - 6 - , textOffsets = [defaultHeight - 5, defaultHeight - 6] + , textOffsets = [defaultHeight - 5, defaultHeight - 6, -1, defaultHeight - 5] , border = TopB , template = "|tray| \ \<action=`toggle-nm-applet.sh `>|tun0||wlp2s0wi|</action> \ diff --git a/src/lib/Config.hs b/src/lib/Config.hs index 8351cce..7930a60 100644 --- a/src/lib/Config.hs +++ b/src/lib/Config.hs @@ -54,7 +54,11 @@ baseConfig p = defaultConfig { , borderColor = pBorder p , fgColor = (pForeground p) , bgColor = (pBackground p) - , additionalFonts = ["xft:Hack-7", "xft:Symbola-9", "xft:Symbola-8"] + , additionalFonts = [ "xft:Hack-7" + , "xft:Symbola-9" + , "xft:Symbola-8" + , "xft:IPA Gothic-10" + ] , border = NoBorder , alpha = (pAlpha p) , overrideRedirect = True diff --git a/src/lib/MPD.hs b/src/lib/MPD.hs index 6079bd3..986ce0d 100644 --- a/src/lib/MPD.hs +++ b/src/lib/MPD.hs @@ -2,6 +2,7 @@ module MPD where import Xmobar import Config (palette, defaultHeight) +import Monitors import qualified Bottom (config) mpd = MPD [ "-W", "12", "-b", "░", "-f", "▒", "-t" @@ -14,7 +15,6 @@ autoMPD = AutoMPD [ "-T", "150", "-E", "...", "-W", "10", "-t" \<fn=0><fc=dodgerblue4><artist></fc> \ \<fc=burlywood4><composer></fc> <date></fn>"] - config p = (Bottom.config [Run mpd, Run autoMPD] "|mpd| |autompd|" p) { textOffsets = [defaultHeight - 7, defaultHeight - 6] diff --git a/src/lib/Monitors.hs b/src/lib/Monitors.hs index fb51893..d118ba7 100644 --- a/src/lib/Monitors.hs +++ b/src/lib/Monitors.hs @@ -86,8 +86,7 @@ diskU p = 20 diskIO p = - DiskIO [("dm-1" - , "<total> <fn=2>⎗</fn><fn=1><readbar></fn><fn=2>⎘</fn><fn=1><writebar></fn>")] + DiskIO [("dm-1" , "<fn=2>⎗</fn> <read> <fn=2>⎘</fn> <write>")] (p <~> ["-f", "░", "-b", " ", "-L", "200000", "-H" , "10000000" , "-W", "5", "-w", "5", "-p", "3"]) 10 diff --git a/src/lib/Mpris.hs b/src/lib/Mpris.hs index 4ae98d1..35caa51 100644 --- a/src/lib/Mpris.hs +++ b/src/lib/Mpris.hs @@ -6,9 +6,9 @@ import qualified Bottom (config) mpris client = Mpris2 client -- "clementine" -- - ["-t", " <tracknumber>\ + ["-t", " <fn=4><tracknumber>\ \ <title> <fc=sienna4><artist></fc>\ - \ <album> <length>" + \ <album> <length></fn>" , "-T", "180", "-E", "...", "-M", "100", "-x", ""] 10 config client p = Bottom.config [Run (mpris client)] "|mpris2|" p diff --git a/src/lib/Music.hs b/src/lib/Music.hs new file mode 100644 index 0000000..480d419 --- /dev/null +++ b/src/lib/Music.hs @@ -0,0 +1,16 @@ +module Music where + +import Xmobar +import Mpris +import MPD +import Monitors +import qualified Bottom + +compMPD = concatMonitor " " mpd autoMPD + +alt x = altMonitor (Mpris.mpris x) compMPD + +config cl = + if cl == "mpd" + then MPD.config + else Bottom.config [Run (alt cl)] "|mpris2_mpd_autompd|" |