From f0c265b3b4359e866673954dbcc5a586c7ae51dd Mon Sep 17 00:00:00 2001 From: michaellilanushoober <30565219+michaellilanushoober@users.noreply.github.com> Date: Sun, 30 Jul 2017 17:43:41 +0200 Subject: Guard monitor 'Weather' behind flag 'with_weather' Hide the monitor 'Weather' behind a flag named 'with_weather'. This implies that the dependency on the module 'HTTP' is now optional. The default for 'with_weather' is True since we do not want to break backwards compatibility/user experience. Further moved the effect of the flag with_conduit within the branch of 'with_weather', since that flag only has some effect if 'with_weather' is true. --- src/Plugins/Monitors.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Plugins/Monitors.hs b/src/Plugins/Monitors.hs index 43068be..873130e 100644 --- a/src/Plugins/Monitors.hs +++ b/src/Plugins/Monitors.hs @@ -20,7 +20,9 @@ module Plugins.Monitors where import Plugins import Plugins.Monitors.Common (runM, runMD) +#ifdef WEATHER import Plugins.Monitors.Weather +#endif import Plugins.Monitors.Net import Plugins.Monitors.Mem import Plugins.Monitors.Swap @@ -53,8 +55,7 @@ import Plugins.Monitors.Volume import Plugins.Monitors.Mpris #endif -data Monitors = Weather Station Args Rate - | Network Interface Args Rate +data Monitors = Network Interface Args Rate | DynNetwork Args Rate | BatteryP Args Args Rate | BatteryN Args Args Rate Alias @@ -74,6 +75,9 @@ data Monitors = Weather Station Args Rate | TopMem Args Rate | Uptime Args Rate | CatInt Int FilePath Args Rate +#ifdef WEATHER + | Weather Station Args Rate +#endif #ifdef UVMETER | UVMeter Station Args Rate #endif @@ -104,7 +108,9 @@ type Rate = Int type DiskSpec = [(String, String)] instance Exec Monitors where +#ifdef WEATHER alias (Weather s _ _) = s +#endif alias (Network i _ _) = i alias (DynNetwork _ _) = "dynnetwork" alias (Thermal z _ _) = z @@ -148,7 +154,9 @@ instance Exec Monitors where start (MultiCpu a r) = startMultiCpu a r start (TopProc a r) = startTop a r start (TopMem a r) = runM a topMemConfig runTopMem r +#ifdef WEATHER start (Weather s a r) = runMD (a ++ [s]) weatherConfig runWeather r weatherReady +#endif start (Thermal z a r) = runM (a ++ [z]) thermalConfig runThermal r start (ThermalZone z a r) = runM (a ++ [show z]) thermalZoneConfig runThermalZone r -- cgit v1.2.3