From 0c5f9ddc26e2f581a79f0a32c29f97a0a9ed35b5 Mon Sep 17 00:00:00 2001 From: jao Date: Wed, 21 Nov 2018 22:58:07 +0000 Subject: Cabal file adapted to the library split --- src/Xmobar/Plugins/Monitors/Alsa.hs | 9 +- test/Plugins/Monitors/AlsaSpec.hs | 2 +- xmobar.cabal | 229 +++++++++++++++++++++--------------- 3 files changed, 137 insertions(+), 103 deletions(-) diff --git a/src/Xmobar/Plugins/Monitors/Alsa.hs b/src/Xmobar/Plugins/Monitors/Alsa.hs index c231303..21a2786 100644 --- a/src/Xmobar/Plugins/Monitors/Alsa.hs +++ b/src/Xmobar/Plugins/Monitors/Alsa.hs @@ -24,8 +24,7 @@ import Control.Concurrent.Async import Control.Exception import Control.Monad import Xmobar.Plugins.Monitors.Common -import Xmobar.Plugins.Monitors.Volume(volumeConfig, VolumeOpts, runVolumeWith) -import qualified Plugins.Monitors.Volume as Volume; +import qualified Xmobar.Plugins.Monitors.Volume as Volume; import System.Console.GetOpt import System.Directory import System.Exit @@ -33,7 +32,7 @@ import System.IO import System.Process data AlsaOpts = AlsaOpts - { aoVolumeOpts :: VolumeOpts + { aoVolumeOpts :: Volume.VolumeOpts , aoAlsaCtlPath :: Maybe FilePath } @@ -75,10 +74,10 @@ startAlsaPlugin mixerName controlName args cb = do -- it, which probably isn't going to happen with the default -- optimization settings). opts2 <- io $ parseOpts args2 - runVolumeWith (aoVolumeOpts opts2) mixerName controlName + Volume.runVolumeWith (aoVolumeOpts opts2) mixerName controlName withMonitorWaiter mixerName (aoAlsaCtlPath opts) $ \wait_ -> - runMB args volumeConfig run wait_ cb + runMB args Volume.volumeConfig run wait_ cb withMonitorWaiter :: String -> Maybe FilePath -> (IO () -> IO a) -> IO a withMonitorWaiter mixerName alsaCtlPath cont = do diff --git a/test/Plugins/Monitors/AlsaSpec.hs b/test/Plugins/Monitors/AlsaSpec.hs index 77845e0..e775900 100644 --- a/test/Plugins/Monitors/AlsaSpec.hs +++ b/test/Plugins/Monitors/AlsaSpec.hs @@ -7,7 +7,7 @@ module Plugins.Monitors.AlsaSpec import Control.Concurrent import Control.Concurrent.Async import Control.Monad -import Plugins.Monitors.Alsa +import Xmobar.Plugins.Monitors.Alsa import System.FilePath import System.IO import System.IO.Temp diff --git a/xmobar.cabal b/xmobar.cabal index 5061507..ecd0f4b 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -17,66 +17,11 @@ cabal-version: >= 1.8 build-type: Simple extra-source-files: readme.md, changelog.md, + samples/padding-icon.sh, samples/xmobar.config, samples/xmonadpropwrite.hs samples/Plugins/helloworld.config, samples/Plugins/HelloWorld.hs -test-suite XmobarTest - type: exitcode-stdio-1.0 - hs-source-dirs: - src, - test - main-is: Spec.hs - other-modules: - Xmobar, Actions, Bitmap, Config, Parsers, Commands, Localize, - XUtil, StatFS, Runnable, ColorCache, Window, Signal, - Environment, Paths_xmobar, - Plugins, Plugins.BufferedPipeReader, - Plugins.CommandReader, Plugins.Date, Plugins.EWMH, - Plugins.PipeReader, Plugins.MarqueePipeReader, - Plugins.StdinReader, Plugins.XMonadLog, - Plugins.Utils, Plugins.Kbd, Plugins.Locks, Plugins.Monitors, - Plugins.Monitors.Batt, Plugins.Monitors.Common, - Plugins.Monitors.CoreCommon, Plugins.Monitors.CoreTemp, - Plugins.Monitors.CpuFreq, Plugins.Monitors.Cpu, - Plugins.Monitors.Disk, Plugins.Monitors.Mem, - Plugins.Monitors.MultiCpu, Plugins.Monitors.Net, - Plugins.Monitors.Swap, Plugins.Monitors.Thermal, - Plugins.Monitors.ThermalZone, Plugins.Monitors.Top, - Plugins.Monitors.Uptime, - Plugins.Monitors.Bright, Plugins.Monitors.CatInt, - Plugins.Monitors.CommonSpec - - build-depends: - base >= 4.9.1.0 && < 4.13, - hspec == 2.*, - containers, - regex-compat, - process, - old-locale, - bytestring, - directory, - unix, - time, - filepath, - transformers, - X11 >= 1.6.1, - mtl >= 2.1 && < 2.3, - parsec == 3.1.*, - parsec-numbers == 0.1.0, - stm >= 2.3 && < 2.6, - temporary, - async - - if flag(with_alsa) || flag(all_extensions) - build-depends: alsa-mixer > 0.2.0.2 - build-depends: alsa-core == 0.5.*, - process >= 1.4.3.0 - other-modules: Plugins.Monitors.Volume - Plugins.Monitors.Alsa - Plugins.Monitors.AlsaSpec - cpp-options: -DALSA - source-repository head type: git location: git://github.com/jaor/xmobar.git @@ -123,7 +68,7 @@ flag with_dbus default: False flag with_xpm - description: Enable usage of xpm for icons + description: Enable usage of xpm for icons. default: False flag with_threaded @@ -131,7 +76,7 @@ flag with_threaded default: False flag with_rtsopts - description: Use -with-rtsopts=-V0 to reduce wakeups + description: Use -with-rtsopts=-V0 to reduce wakeups. default: True flag with_uvmeter @@ -139,38 +84,65 @@ flag with_uvmeter default: False flag with_weather - description: Enable weather plugin + description: Enable weather plugin. default: True flag with_conduit - description: Use http-conduits for getting weather data, only has an effect if with_weather is set. + description: Use http-conduits for weather data, used only if with_weather. default: False -executable xmobar - hs-source-dirs: src - main-is: Main.hs - other-modules: - Xmobar, Actions, Bitmap, Config, Parsers, Commands, Localize, - XUtil, StatFS, Runnable, ColorCache, Window, Signal, - Environment, Paths_xmobar, - Plugins, Plugins.BufferedPipeReader, - Plugins.CommandReader, Plugins.Date, Plugins.EWMH, - Plugins.PipeReader, Plugins.MarqueePipeReader, - Plugins.StdinReader, Plugins.XMonadLog, - Plugins.Utils, Plugins.Kbd, Plugins.Locks, Plugins.Monitors, - Plugins.Monitors.Batt, Plugins.Monitors.Common, - Plugins.Monitors.CoreCommon, Plugins.Monitors.CoreTemp, - Plugins.Monitors.CpuFreq, Plugins.Monitors.Cpu, - Plugins.Monitors.Disk, Plugins.Monitors.Mem, - Plugins.Monitors.MultiCpu, Plugins.Monitors.Net, - Plugins.Monitors.Swap, Plugins.Monitors.Thermal, - Plugins.Monitors.ThermalZone, Plugins.Monitors.Top, - Plugins.Monitors.Uptime, - Plugins.Monitors.Bright, Plugins.Monitors.CatInt +library + hs-source-dirs: src + + exposed-modules: Xmobar, + Xmobar.Actions, + Xmobar.Bitmap, + Xmobar.Config, + Xmobar.Parsers, + Xmobar.Commands, + Xmobar.Localize, + Xmobar.XUtil, + Xmobar.StatFS, + Xmobar.Runnable, + Xmobar.ColorCache, + Xmobar.Window, + Xmobar.Signal, + Xmobar.Environment, + Xmobar.Plugins, + Xmobar.Plugins.BufferedPipeReader, + Xmobar.Plugins.CommandReader, + Xmobar.Plugins.Date, + Xmobar.Plugins.EWMH, + Xmobar.Plugins.PipeReader, + Xmobar.Plugins.MarqueePipeReader, + Xmobar.Plugins.StdinReader, + Xmobar.Plugins.XMonadLog, + Xmobar.Plugins.Utils, + Xmobar.Plugins.Kbd, + Xmobar.Plugins.Locks, + Xmobar.Plugins.Monitors, + Xmobar.Plugins.Monitors.Batt, + Xmobar.Plugins.Monitors.Common, + Xmobar.Plugins.Monitors.CoreCommon, + Xmobar.Plugins.Monitors.CoreTemp, + Xmobar.Plugins.Monitors.CpuFreq, + Xmobar.Plugins.Monitors.Cpu, + Xmobar.Plugins.Monitors.Disk, + Xmobar.Plugins.Monitors.Mem, + Xmobar.Plugins.Monitors.MultiCpu, + Xmobar.Plugins.Monitors.Net, + Xmobar.Plugins.Monitors.Swap, + Xmobar.Plugins.Monitors.Thermal, + Xmobar.Plugins.Monitors.ThermalZone, + Xmobar.Plugins.Monitors.Top, + Xmobar.Plugins.Monitors.Uptime, + Xmobar.Plugins.Monitors.Bright, + Xmobar.Plugins.Monitors.CatInt - ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind extra-libraries: Xrandr Xrender + ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind + build-depends: base >= 4.9.1.0 && < 4.13, containers, @@ -204,12 +176,9 @@ executable xmobar ghc-options: -threaded cpp-options: -DTHREADED_RUNTIME - if flag(with_rtsopts) - ghc-options: -with-rtsopts=-V0 - if flag(with_xft) || flag(all_extensions) build-depends: utf8-string >= 0.3 && < 1.1, X11-xft >= 0.2 && < 0.4 - other-modules: MinXft + other-modules: Xmobar.MinXft cpp-options: -DXFT if flag(with_utf8) || flag(all_extensions) @@ -218,51 +187,51 @@ executable xmobar if flag(with_inotify) || flag(all_extensions) build-depends: hinotify >= 0.3 && < 0.5 - other-modules: Plugins.Mail, Plugins.MBox + other-modules: Xmobar.Plugins.Mail, Xmobar.Plugins.MBox cpp-options: -DINOTIFY if flag(with_iwlib) || flag(all_extensions) extra-libraries: iw build-depends: iwlib >= 0.1.0 && < 0.2 - other-modules: Plugins.Monitors.Wireless + other-modules: Xmobar.Plugins.Monitors.Wireless cpp-options: -DIWLIB if flag(with_mpd) || flag(all_extensions) build-depends: libmpd >= 0.9.0.6 - other-modules: Plugins.Monitors.MPD + other-modules: Xmobar.Plugins.Monitors.MPD cpp-options: -DLIBMPD if flag(with_alsa) || flag(all_extensions) build-depends: alsa-mixer > 0.2.0.2 build-depends: alsa-core == 0.5.*, process >= 1.4.3.0 - other-modules: Plugins.Monitors.Volume - Plugins.Monitors.Alsa + other-modules: Xmobar.Plugins.Monitors.Volume + Xmobar.Plugins.Monitors.Alsa cpp-options: -DALSA if flag(with_datezone) || flag(all_extensions) build-depends: timezone-olson == 0.1.*, timezone-series == 0.1.* - other-modules: Plugins.DateZone + other-modules: Xmobar.Plugins.DateZone cpp-options: -DDATEZONE if flag(with_mpris) || flag(all_extensions) build-depends: dbus >= 1 - other-modules: Plugins.Monitors.Mpris + other-modules: Xmobar.Plugins.Monitors.Mpris cpp-options: -DMPRIS if flag(with_dbus) || flag(all_extensions) build-depends: dbus >= 1 - other-modules: IPC.DBus + other-modules: Xmobar.IPC.DBus cpp-options: -DDBUS if flag(with_xpm) || flag(all_extensions) extra-libraries: Xpm - other-modules: XPMFile + other-modules: Xmobar.XPMFile cpp-options: -DXPM if flag(with_weather) || flag(all_extensions) build-depends: HTTP >= 4000.2.4 - other-modules: Plugins.Monitors.Weather + other-modules: Xmobar.Plugins.Monitors.Weather cpp-options: -DWEATHER if flag(with_conduit) -- use http-conduit instead of simple-http @@ -270,6 +239,72 @@ executable xmobar cpp-options: -DHTTP_CONDUIT if flag(with_uvmeter) && flag(with_conduit) - other-modules: Plugins.Monitors.UVMeter + other-modules: Xmobar.Plugins.Monitors.UVMeter build-depends: http-conduit, http-types cpp-options: -DUVMETER + +executable xmobar + hs-source-dirs: app + main-is: Main.hs + other-modules: Paths_xmobar + build-depends: base, + containers, + async, + X11, + directory, + filepath, + unix, + xmobar + + ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind + + if flag(with_rtsopts) + ghc-options: -with-rtsopts=-V0 + + if flag(with_threaded) + -- -threaded is a workaround for 100% CPU busy loop + -- (http://hackage.haskell.org/trac/ghc/ticket/4934). + -- See also comments in https://github.com/jaor/xmobar/pull/36 + ghc-options: -threaded + cpp-options: -DTHREADED_RUNTIME + +test-suite XmobarTest + type: exitcode-stdio-1.0 + hs-source-dirs: src, test + main-is: Spec.hs + build-depends: base, + containers, + regex-compat, + process, + old-locale, + bytestring, + directory, + unix, + time, + filepath, + transformers, + X11, + mtl, + parsec, + parsec-numbers, + stm, + async, + temporary, + hspec == 2.*, + xmobar + + other-modules: Plugins.Monitors.CommonSpec, + Xmobar.Commands, + Xmobar.Signal, + Xmobar.Plugins, + Xmobar.Plugins.Utils, + Xmobar.Plugins.Monitors.Common + + if flag(with_alsa) || flag(all_extensions) + build-depends: alsa-mixer > 0.2.0.2 + build-depends: alsa-core == 0.5.*, + process >= 1.4.3.0 + other-modules: Xmobar.Plugins.Monitors.Volume, + Xmobar.Plugins.Monitors.Alsa, + Plugins.Monitors.AlsaSpec + cpp-options: -DALSA -- cgit v1.2.3