467 lines
12 KiB
Plaintext
467 lines
12 KiB
Plaintext
let Vector2 = \(a : Type) -> { x : a, y : a }
|
|
|
|
let Point = Vector2 Natural
|
|
|
|
let Margin = Vector2 Natural
|
|
|
|
let FSPath = { name : Text, path : Text }
|
|
|
|
let TextGeo =
|
|
{-
|
|
Defines text dimensions for multiline visuals
|
|
|
|
text_spacing: gap between lines of text
|
|
-}
|
|
{ Type = { text_spacing : Natural }, default.text_spacing = 20 }
|
|
|
|
let SepGeo =
|
|
{-
|
|
Defines separator dimensions
|
|
|
|
sep_spacing: gap between the separator and either above or below
|
|
-}
|
|
{ Type = { sep_spacing : Natural }, default.sep_spacing = 20 }
|
|
|
|
let PlotGeo =
|
|
{-
|
|
Defines plot dimensions
|
|
|
|
sec_break: gap between the plot label and the plot itself
|
|
height: height of the plot (without the label)
|
|
ticks_y: number of ticks on the y axis
|
|
-}
|
|
{ Type = { sec_break : Natural, height : Natural, ticks_y : Natural }
|
|
, default = { sec_break = 20, height = 56, ticks_y = 4 }
|
|
}
|
|
|
|
let PlotGeo_ = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
|
|
|
let TableGeo =
|
|
{-
|
|
Defines table dimensions
|
|
|
|
sec_break: spacing between header and the first table row
|
|
-}
|
|
{ Type = { sec_break : Natural }, default.sec_break = 20 }
|
|
|
|
let TableGeo_ =
|
|
{ Type = { table : TableGeo.Type }, default.table = TableGeo::{=} }
|
|
|
|
let FSGeo =
|
|
{-
|
|
Defines Filesystem module dimensions
|
|
|
|
bar_spacing: spacing between percent usage bars
|
|
bar_pad: spacing between usage bars and the left edge of the panel
|
|
-}
|
|
{ Type = { bar_spacing : Natural, bar_pad : Natural } //\\ SepGeo.Type
|
|
, default = { bar_spacing = 20, bar_pad = 100 } /\ SepGeo::{=}
|
|
}
|
|
|
|
let GfxGeo =
|
|
{-
|
|
Defines Graphics module dimensions
|
|
|
|
See PlotGeo, TextGeo, and SepGeo for options included here
|
|
-}
|
|
{ Type = SepGeo.Type //\\ PlotGeo_.Type //\\ TextGeo.Type
|
|
, default = SepGeo::{=} /\ PlotGeo_::{=} /\ TextGeo::{=}
|
|
}
|
|
|
|
let MemGeo =
|
|
{-
|
|
Defines Memory module dimensions
|
|
|
|
See PlotGeo, TextGeo, and TableGeo for options included here
|
|
-}
|
|
{ Type = TextGeo.Type //\\ PlotGeo_.Type //\\ TableGeo_.Type
|
|
, default = TextGeo::{=} /\ PlotGeo_::{=} /\ TableGeo_::{=}
|
|
}
|
|
|
|
let ProcGeo =
|
|
{-
|
|
Defines Processor module dimensions
|
|
|
|
See GfxGeo and TableGeo for options included here
|
|
-}
|
|
{ Type = GfxGeo.Type //\\ TableGeo_.Type
|
|
, default = GfxGeo::{=} /\ TableGeo_::{=}
|
|
}
|
|
|
|
let PwrGeo =
|
|
{-
|
|
Defines Processor module dimensions
|
|
|
|
See TextGeo and PlotGeo for options included here
|
|
-}
|
|
{ Type = TextGeo.Type //\\ PlotGeo_.Type
|
|
, default = TextGeo::{=} /\ PlotGeo_::{=}
|
|
}
|
|
|
|
let AllGeo =
|
|
{ TextGeo, PlotGeo, TableGeo, FSGeo, GfxGeo, MemGeo, ProcGeo, PwrGeo }
|
|
|
|
let FileSystem =
|
|
{-
|
|
Defines Filesystem module configuration
|
|
|
|
show_smart: show SMART daemon indicator
|
|
show_seafile: show seafile daemon indicator
|
|
fs_paths: list of filesystem paths to monitor for percent usage
|
|
geometry: dimensional data for this module
|
|
-}
|
|
{ Type =
|
|
{ show_smart : Bool
|
|
, show_seafile : Bool
|
|
, fs_paths : List FSPath
|
|
, geometry : FSGeo.Type
|
|
}
|
|
, default.geometry = FSGeo::{=}
|
|
}
|
|
|
|
let Graphics =
|
|
{-
|
|
Defines Graphics module configuration
|
|
|
|
dev_power: show a power indicator
|
|
show_temp: show temperature in celsius
|
|
show_clock: show clock speed
|
|
show_gpu_util: show percent utilization
|
|
show_mem_util: show percent memory utilized
|
|
show_vid_util: show percent video utilized
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type =
|
|
{ dev_power : Text
|
|
, show_temp : Bool
|
|
, show_clock : Bool
|
|
, show_gpu_util : Bool
|
|
, show_mem_util : Bool
|
|
, show_vid_util : Bool
|
|
, geometry : GfxGeo.Type
|
|
}
|
|
, default.geometry = GfxGeo::{=}
|
|
}
|
|
|
|
let Memory =
|
|
{-
|
|
Defines Memory module configuration
|
|
|
|
show_stats: show total memory gauge, cache, buffers, shared, and slab
|
|
show_plot: show memory utilization plot
|
|
show_swap: show swap utilization gauge (only if 'show_stats' is true)
|
|
table_rows: top processes by memory to display in table (max 10)
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type =
|
|
{ show_stats : Bool
|
|
, show_plot : Bool
|
|
, show_swap : Bool
|
|
, table_rows : Natural
|
|
, geometry : MemGeo.Type
|
|
}
|
|
, default.geometry = MemGeo::{=}
|
|
}
|
|
|
|
let Network =
|
|
{-
|
|
Defines Network module configuration
|
|
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type = { geometry : PlotGeo_.Type }, default.geometry = PlotGeo_::{=} }
|
|
|
|
let CoreGroup =
|
|
{-
|
|
Defines a processor group for the Processor module
|
|
|
|
threads: the number of threads for each core in this group (usually 1 or 2)
|
|
rows: the number of rows over which to display the cores in this group
|
|
padding: the spacing to the left and right of the gauges in this group
|
|
-}
|
|
{ threads : Natural, rows : Natural, padding : Natural }
|
|
|
|
let Processor =
|
|
{-
|
|
Defines Network module configuration
|
|
|
|
core_groups: a list of core groups to display
|
|
show_stats: show frequency for each core group and HWP status
|
|
show_plot: show percent utilization plot
|
|
table_rows: top processes by cpu percent to display in table (max 10)
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type =
|
|
{ core_groups : List CoreGroup
|
|
, show_stats : Bool
|
|
, show_plot : Bool
|
|
, table_rows : Natural
|
|
, geometry : ProcGeo.Type
|
|
}
|
|
, default.geometry = ProcGeo::{=}
|
|
}
|
|
|
|
let Pacman =
|
|
{-
|
|
Defines Pacman module configuration
|
|
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type = { geometry : TextGeo.Type }, default.geometry = TextGeo::{=} }
|
|
|
|
let RaplSpec =
|
|
{-
|
|
Defines a RAPL endpoint to display in the Power module
|
|
|
|
name: nice name to display above plot
|
|
address: sysfs address to the directory containing the 'energy_uj' file
|
|
-}
|
|
{ name : Text, address : Text }
|
|
|
|
let Power =
|
|
{-
|
|
Defines Power module configuration
|
|
|
|
battery: sysfs path to the battery to display
|
|
rapl_specs: list of RAPL endpoints to display
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type =
|
|
{ battery : Text, rapl_specs : List RaplSpec, geometry : PwrGeo.Type }
|
|
, default.geometry = PwrGeo::{=}
|
|
}
|
|
|
|
let ReadWrite =
|
|
{-
|
|
Defines ReadWrite module configuration
|
|
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
{ Type = { devices : List Text, geometry : PlotGeo_.Type }
|
|
, default.geometry = PlotGeo_::{=}
|
|
}
|
|
|
|
let System =
|
|
{-
|
|
Defines System module configuration
|
|
|
|
geometry: dimensional configuration for this module
|
|
-}
|
|
Pacman
|
|
|
|
let AllModules =
|
|
{ FileSystem
|
|
, Graphics
|
|
, Memory
|
|
, Network
|
|
, Pacman
|
|
, Power
|
|
, Processor
|
|
, ReadWrite
|
|
, System
|
|
}
|
|
|
|
let ModType =
|
|
< filesystem : FileSystem.Type
|
|
| graphics : Graphics.Type
|
|
| memory : Memory.Type
|
|
| network : Network.Type
|
|
| pacman : Pacman.Type
|
|
| processor : Processor.Type
|
|
| power : Power.Type
|
|
| readwrite : ReadWrite.Type
|
|
| system : System.Type
|
|
>
|
|
|
|
let Annotated = \(a : Type) -> { type : Text, data : a }
|
|
|
|
let Block = < Pad : Natural | Mod : Annotated ModType >
|
|
|
|
let Column_ = { blocks : List Block, width : Natural }
|
|
|
|
let Column = < CPad : Natural | CCol : Column_ >
|
|
|
|
let Panel_ = { columns : List Column, margins : Margin }
|
|
|
|
let Panel = < PPad : Natural | PPanel : Panel_ >
|
|
|
|
let Layout = { anchor : Point, panels : List Panel }
|
|
|
|
let Sizes =
|
|
{ Type =
|
|
{ normal : Natural
|
|
, plot_label : Natural
|
|
, table : Natural
|
|
, header : Natural
|
|
}
|
|
, default = { normal = 13, plot_label = 8, table = 11, header = 15 }
|
|
}
|
|
|
|
let Font =
|
|
{ Type = { family : Text, sizes : Sizes.Type }
|
|
, default = { family = "Neuropolitical", sizes = Sizes::{=} }
|
|
}
|
|
|
|
let PlotGeometry =
|
|
{ Type = { seconds : Natural, ticks_x : Natural }
|
|
, default = { seconds = 90, ticks_x = 9 }
|
|
}
|
|
|
|
let TableGeometry =
|
|
{ Type =
|
|
{ name_chars : Natural
|
|
, padding : Margin
|
|
, header_padding : Natural
|
|
, row_spacing : Natural
|
|
}
|
|
, default =
|
|
{ name_chars = 8
|
|
, padding = { x = 6, y = 15 }
|
|
, header_padding = 20
|
|
, row_spacing = 16
|
|
}
|
|
}
|
|
|
|
let HeaderGeometry =
|
|
{ Type = { underline_offset : Natural, padding : Natural }
|
|
, default = { underline_offset = 26, padding = 19 }
|
|
}
|
|
|
|
let Geometry =
|
|
{ Type =
|
|
{ plot : PlotGeometry.Type
|
|
, table : TableGeometry.Type
|
|
, header : HeaderGeometry.Type
|
|
}
|
|
, default =
|
|
{ plot = PlotGeometry::{=}
|
|
, table = TableGeometry::{=}
|
|
, header = HeaderGeometry::{=}
|
|
}
|
|
}
|
|
|
|
let StopRGB = { color : Natural, stop : Double }
|
|
|
|
let StopRGBA = { color : Natural, stop : Double, alpha : Double }
|
|
|
|
let ColorAlpha = { color : Natural, alpha : Double }
|
|
|
|
let Pattern =
|
|
< RGB : Natural
|
|
| RGBA : ColorAlpha
|
|
| GradientRGB : List StopRGB
|
|
| GradientRGBA : List StopRGBA
|
|
>
|
|
|
|
let annotatePattern =
|
|
\(a : Pattern) ->
|
|
{ type = showConstructor a, data = a } : Annotated Pattern
|
|
|
|
let mod = \(a : ModType) -> Block.Mod { type = showConstructor a, data = a }
|
|
|
|
let APattern = Annotated Pattern
|
|
|
|
let symGradient =
|
|
\(c0 : Natural) ->
|
|
\(c1 : Natural) ->
|
|
annotatePattern
|
|
( Pattern.GradientRGB
|
|
[ { color = c0, stop = 0.0 }
|
|
, { color = c1, stop = 0.5 }
|
|
, { color = c0, stop = 1.0 }
|
|
]
|
|
)
|
|
|
|
let Patterns =
|
|
{ Type =
|
|
{ header : APattern
|
|
, panel : { bg : APattern }
|
|
, text :
|
|
{ active : APattern, inactive : APattern, critical : APattern }
|
|
, border : APattern
|
|
, plot :
|
|
{ grid : APattern
|
|
, outline : APattern
|
|
, data : { border : APattern, fill : APattern }
|
|
}
|
|
, indicator :
|
|
{ bg : APattern, fg : { active : APattern, critical : APattern } }
|
|
}
|
|
, default =
|
|
{ header = annotatePattern (Pattern.RGB 0xefefef)
|
|
, panel.bg
|
|
= annotatePattern (Pattern.RGBA { color = 0x121212, alpha = 0.7 })
|
|
, text =
|
|
{ active = annotatePattern (Pattern.RGB 0xbfe1ff)
|
|
, inactive = annotatePattern (Pattern.RGB 0xc8c8c8)
|
|
, critical = annotatePattern (Pattern.RGB 0xff8282)
|
|
}
|
|
, border = annotatePattern (Pattern.RGB 0x888888)
|
|
, plot =
|
|
{ grid = annotatePattern (Pattern.RGB 0x666666)
|
|
, outline = annotatePattern (Pattern.RGB 0x777777)
|
|
, data =
|
|
{ border =
|
|
annotatePattern
|
|
( Pattern.GradientRGB
|
|
[ { color = 0x003f7c, stop = 0.0 }
|
|
, { color = 0x1e90ff, stop = 1.0 }
|
|
]
|
|
)
|
|
, fill =
|
|
annotatePattern
|
|
( Pattern.GradientRGBA
|
|
[ { color = 0x316ece, stop = 0.2, alpha = 0.5 }
|
|
, { color = 0x8cc7ff, stop = 1.0, alpha = 1.0 }
|
|
]
|
|
)
|
|
}
|
|
}
|
|
, indicator =
|
|
{ bg = symGradient 0x565656 0xbfbfbf
|
|
, fg =
|
|
{ active = symGradient 0x316BA6 0x99CEFF
|
|
, critical = symGradient 0xFF3333 0xFFB8B8
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
let Theme =
|
|
{-
|
|
Defines the theme for displaying the window
|
|
|
|
font: the font to use
|
|
geometry: the global dimensions to use for each panel and widget (for
|
|
everything not define by individual modules)
|
|
patterns: colors and gradient definitions
|
|
-}
|
|
{ Type =
|
|
{ font : Font.Type
|
|
, geometry : Geometry.Type
|
|
, patterns : Patterns.Type
|
|
}
|
|
, default =
|
|
{ font = Font::{=}, geometry = Geometry::{=}, patterns = Patterns::{=} }
|
|
}
|
|
|
|
let Bootstrap = { update_interval : Natural, dimensions : Point }
|
|
|
|
let Config = { bootstrap : Bootstrap, theme : Theme.Type, layout : Layout }
|
|
|
|
let toConfig =
|
|
\(i : Natural) ->
|
|
\(x : Natural) ->
|
|
\(y : Natural) ->
|
|
\(t : Theme.Type) ->
|
|
\(l : Layout) ->
|
|
{ bootstrap = { update_interval = i, dimensions = { x, y } }
|
|
, theme = t
|
|
, layout = l
|
|
}
|
|
: Config
|
|
|
|
in { toConfig, Block, Column, ModType, Layout, Panel, FSPath, Theme, mod }
|
|
/\ AllModules
|
|
/\ AllGeo
|