diff options
-rwxr-xr-x | bin/toggle-xmobar-bottom.sh | 2 | ||||
-rwxr-xr-x | bin/xmobars.sh | 1 | ||||
-rw-r--r-- | src/Bottom.hs | 8 | ||||
-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 | ||||
-rw-r--r-- | xmobar-config.cabal | 9 |
10 files changed, 34 insertions, 19 deletions
diff --git a/bin/toggle-xmobar-bottom.sh b/bin/toggle-xmobar-bottom.sh index b089adf..17abb3e 100755 --- a/bin/toggle-xmobar-bottom.sh +++ b/bin/toggle-xmobar-bottom.sh @@ -7,5 +7,5 @@ if pidof spotify>/dev/null; then elif pidof 'Google Play Music Desktop Player'>/dev/null; then xmobar-bottom $* google-play-music-desktop-player & else - xmobar-bottom $* mpd & + xmobar-bottom $* & fi diff --git a/bin/xmobars.sh b/bin/xmobars.sh index ff9ce87..4b49f08 100755 --- a/bin/xmobars.sh +++ b/bin/xmobars.sh @@ -6,4 +6,3 @@ run-trayer.sh & killall xmobar-top xmobar-top $* & toggle-xmobar-bottom.sh - diff --git a/src/Bottom.hs b/src/Bottom.hs index 4ff7265..a13662b 100644 --- a/src/Bottom.hs +++ b/src/Bottom.hs @@ -1,14 +1,12 @@ import Xmobar import Config -import qualified MPD -import qualified Mpris +import qualified Music import System.Environment (getArgs) + main :: IO () main = do args <- getArgs let mpris = if null args then "spotify" else last args - if mpris == "mpd" - then palette >>= configFromArgs . MPD.config >>= xmobar - else palette >>= configFromArgs . (Mpris.config mpris) >>= xmobar + palette >>= configFromArgs . Music.config mpris >>= xmobar 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|" diff --git a/xmobar-config.cabal b/xmobar-config.cabal index 6876bf9..3ad80bf 100644 --- a/xmobar-config.cabal +++ b/xmobar-config.cabal @@ -3,7 +3,7 @@ version: 0.1 description: xmobar configs author: jao maintainer: jao@gnu.org -copyright: 2018 Jose A Ortega Ruiz +copyright: 2018, 2019 Jose A Ortega Ruiz license: GPL-3 build-type: Simple cabal-version: >= 1.10 @@ -13,10 +13,9 @@ extra-source-files: library hs-source-dirs: src/lib - exposed-modules: Config, Monitors, Bottom, Mpris, MPD - build-depends: base >=4.7 && <5, xmobar - other-modules: - Paths_xmobar_config + exposed-modules: Config, Monitors, Bottom, Music + build-depends: base >=4.7 && <5, async > 2.2, stm >= 2.5, xmobar + other-modules: Paths_xmobar_config, MPD, Mpris default-language: Haskell2010 executable xmobar-top |