diff options
-rw-r--r-- | Plugins/Monitors/CoreCommon.hs | 8 | ||||
-rw-r--r-- | Plugins/Monitors/CoreTemp.hs | 8 | ||||
-rw-r--r-- | Plugins/Monitors/CpuFreq.hs | 7 | ||||
-rw-r--r-- | Plugins/Monitors/Thermal.hs | 4 | ||||
-rw-r--r-- | README | 35 |
5 files changed, 60 insertions, 2 deletions
diff --git a/Plugins/Monitors/CoreCommon.hs b/Plugins/Monitors/CoreCommon.hs index de737d4..9a19cd5 100644 --- a/Plugins/Monitors/CoreCommon.hs +++ b/Plugins/Monitors/CoreCommon.hs @@ -18,6 +18,10 @@ import Plugins.Monitors.Common import System.Posix.Files (fileExist) import System.Directory +-- | +-- Function checks the existence of first file specified by pattern and if the +-- file doesn't exists failure message is shown, otherwise the data retrieval +-- is performed. checkedDataRetrieval :: String -> String -> String -> String -> Double -> Monitor String checkedDataRetrieval failureMessage dir file pattern divisor = do exists <- io $ fileExist $ foldl (++) dir ["/", pattern, "0/", file] @@ -25,6 +29,10 @@ checkedDataRetrieval failureMessage dir file pattern divisor = do False -> return failureMessage True -> retrieveData dir file pattern divisor +-- | +-- Function retrieves data from files in directory dir specified by pattern. +-- String values are converted to double and adjusted with divisor. Final array +-- is processed by template parser function and returned as monitor string. retrieveData :: String -> String -> String -> Double -> Monitor String retrieveData dir file pattern divisor = do count <- io $ dirCount dir pattern diff --git a/Plugins/Monitors/CoreTemp.hs b/Plugins/Monitors/CoreTemp.hs index e59f0d3..f014335 100644 --- a/Plugins/Monitors/CoreTemp.hs +++ b/Plugins/Monitors/CoreTemp.hs @@ -17,11 +17,19 @@ module Plugins.Monitors.CoreTemp where import Plugins.Monitors.Common import Plugins.Monitors.CoreCommon +-- | +-- Core temperature default configuration. Default template contains only one +-- core temperature, user should specify custom template in order to get more +-- core frequencies. coreTempConfig :: IO MConfig coreTempConfig = mkMConfig "Temp: <core0>C" -- template (zipWith (++) (repeat "core") (map show [0 :: Int ..])) -- available -- replacements + +-- | +-- Function retrieves monitor string holding the core temperature +-- (or temperatures) runCoreTemp :: [String] -> Monitor String runCoreTemp _ = do let dir = "/sys/bus/platform/devices" diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs index 0258037..0bd99bb 100644 --- a/Plugins/Monitors/CpuFreq.hs +++ b/Plugins/Monitors/CpuFreq.hs @@ -17,11 +17,18 @@ module Plugins.Monitors.CpuFreq where import Plugins.Monitors.Common import Plugins.Monitors.CoreCommon +-- | +-- Cpu frequency default configuration. Default template contains only one +-- core frequency, user should specify custom template in order to get more +-- cpu frequencies. cpuFreqConfig :: IO MConfig cpuFreqConfig = mkMConfig "Freq: <core0>GHz" -- template (zipWith (++) (repeat "core") (map show [0 :: Int ..])) -- available -- replacements + +-- | +-- Function retrieves monitor string holding the cpu frequency (or frequencies) runCpuFreq :: [String] -> Monitor String runCpuFreq _ = do let dir = "/sys/devices/system/cpu" diff --git a/Plugins/Monitors/Thermal.hs b/Plugins/Monitors/Thermal.hs index 4814aa5..a3ffe6d 100644 --- a/Plugins/Monitors/Thermal.hs +++ b/Plugins/Monitors/Thermal.hs @@ -18,11 +18,15 @@ import qualified Data.ByteString.Lazy.Char8 as B import Plugins.Monitors.Common import System.Posix.Files (fileExist) +-- | Default thermal configuration. thermalConfig :: IO MConfig thermalConfig = mkMConfig "Thm: <temp>C" -- template ["temp"] -- available replacements +-- | Retrieves thermal information. Argument is name of thermal directory in +-- \/proc\/acpi\/thermal_zone. Returns the monitor string parsed according to +-- template (either default or user specified). runThermal :: [String] -> Monitor String runThermal args = do let zone = head args @@ -197,8 +197,8 @@ External Commands). All other commands are provided by plugins. [Xmobar] comes with some plugins, providing a set of system monitors, a standard input reader, an Unix named pipe reader, and a configurable date plugin. These plugins install the following internal commands: -`Weather`, `Network`, `Memory`, `Swap`, `Cpu`, `Battery`, `Date`, -`StdinReader`, and `PipeReader`. +`Weather`, `Network`, `Memory`, `Swap`, `Cpu`, `Battery`, `Thermal`, +`CpuFreq`, `CoreTemp`, `Date`, `StdinReader` and `PipeReader`. To remove them see below Installing/Removing a Plugin @@ -263,6 +263,37 @@ Monitors have default aliases. `left` - Default template: `Batt: <left>` +`Thermal Zone Args RefreshRate` + +- aliases to the Zone: so `Zone "THRM" []` can be used in template as `%THRM%` +- Args: the argument list (see below) +- Variables that can be used with the `-t`/`--template` argument: + `temp` +- Default template: `Thm: <temp>C` +- This plugin works only on sytems with devices having thermal zone. + Check directories in /proc/acpi/thermal_zone for possible values. +- Example: Run Thermal "THRM" ["-t","iwl4965-temp: \<temp\>C"] + +`CpuFreq Args RefreshRate` + +- aliases to `cpufreq` +- Args: the argument list (see below) +- Variables that can be used with the `-t`/`--template` argument: + `core0`, `core1`, .., `coreN` +- Default template: `Freq: <core0>GHz` +- This monitor requires acpi_cpufreq module to be loaded in kernel +- Example: Run CpuFreq ["-t","Freq:\<core0\>|\<core1\>GHz","-L","0","-H","2","-l","lightblue","-n","white","-h","red"] 50 + +`CoreTemp Args RefreshRate` + +- aliases to `coretemp` +- Args: the argument list (see below) +- Variables that can be used with the `-t`/`--template` argument: + `core0`, `core1`, .., `coreN` +- Default template: `Temp: <core0>C` +- This monitor requires coretemp module to be loaded in kernel +- Example: Run CoreTemp ["-t","Temp:\<core0\>|\<core1\>C","-L","40","-H","60","-l","lightblue","-n","gray90","-h","red"] 50 + ### Monitor Plugins Commands Arguments These are the arguments that can be used for internal commands in the |