2022-08-10 22:22:50 -04:00
|
|
|
let Vector2 = \(a : Type) -> { x : a, y : a }
|
|
|
|
|
|
|
|
let Point = Vector2 Natural
|
|
|
|
|
|
|
|
let Margin = Vector2 Natural
|
|
|
|
|
2022-08-11 00:05:06 -04:00
|
|
|
let FSPath = { name : Text, path : Text }
|
|
|
|
|
2022-08-16 00:14:04 -04:00
|
|
|
let TextGeo = { Type = { text_spacing : Natural }, default.text_spacing = 20 }
|
2022-08-15 23:23:15 -04:00
|
|
|
|
2022-08-16 00:14:04 -04:00
|
|
|
let SepGeo = { Type = { sep_spacing : Natural }, default.sep_spacing = 20 }
|
2022-08-15 23:23:15 -04:00
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let PlotGeo =
|
2022-08-16 23:49:13 -04:00
|
|
|
{ Type = { sec_break : Natural, height : Natural, ticks_y : Natural }
|
|
|
|
, default = { sec_break = 20, height = 56, ticks_y = 4 }
|
2022-08-15 23:23:15 -04:00
|
|
|
}
|
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let PlotGeo_ = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
2022-08-16 00:14:04 -04:00
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let TableGeo = { Type = { sec_break : Natural }, default.sec_break = 20 }
|
2022-08-16 00:14:04 -04:00
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let TableGeo_ =
|
|
|
|
{ Type = { table : TableGeo.Type }, default.table = TableGeo::{=} }
|
2022-08-16 00:14:04 -04:00
|
|
|
|
|
|
|
let FSGeo =
|
|
|
|
{ Type = { bar_spacing : Natural, bar_pad : Natural } //\\ SepGeo.Type
|
|
|
|
, default = { bar_spacing = 20, bar_pad = 100 } /\ SepGeo::{=}
|
|
|
|
}
|
|
|
|
|
2022-08-15 23:23:15 -04:00
|
|
|
let GfxGeo =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = SepGeo.Type //\\ PlotGeo_.Type //\\ TextGeo.Type
|
|
|
|
, default = SepGeo::{=} /\ PlotGeo_::{=} /\ TextGeo::{=}
|
2022-08-16 00:14:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
let MemGeo =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = TextGeo.Type //\\ PlotGeo_.Type //\\ TableGeo_.Type
|
|
|
|
, default = TextGeo::{=} /\ PlotGeo_::{=} /\ TableGeo_::{=}
|
2022-08-16 00:14:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
let ProcGeo =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = GfxGeo.Type //\\ TableGeo_.Type
|
|
|
|
, default = GfxGeo::{=} /\ TableGeo_::{=}
|
2022-08-16 00:14:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
let PwrGeo =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = TextGeo.Type //\\ PlotGeo_.Type
|
|
|
|
, default = TextGeo::{=} /\ PlotGeo_::{=}
|
2022-08-16 00:14:04 -04:00
|
|
|
}
|
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let AllGeo =
|
|
|
|
{ TextGeo, PlotGeo, TableGeo, FSGeo, GfxGeo, MemGeo, ProcGeo, PwrGeo }
|
|
|
|
|
2022-08-16 00:14:04 -04:00
|
|
|
let FileSystem =
|
2022-08-15 23:23:15 -04:00
|
|
|
{ Type =
|
2023-01-08 12:12:57 -05:00
|
|
|
{ show_smart : Bool
|
|
|
|
, show_seafile : Bool
|
|
|
|
, fs_paths : List FSPath
|
|
|
|
, geometry : FSGeo.Type
|
|
|
|
}
|
2022-08-16 00:14:04 -04:00
|
|
|
, default.geometry = FSGeo::{=}
|
2022-08-15 23:23:15 -04:00
|
|
|
}
|
2022-08-10 22:22:50 -04:00
|
|
|
|
|
|
|
let Graphics =
|
2022-08-15 23:23:15 -04:00
|
|
|
{ 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::{=}
|
|
|
|
}
|
|
|
|
|
2022-08-10 22:22:50 -04:00
|
|
|
let Memory =
|
2022-08-15 23:23:15 -04:00
|
|
|
{ Type =
|
|
|
|
{ show_stats : Bool
|
|
|
|
, show_plot : Bool
|
|
|
|
, show_swap : Bool
|
|
|
|
, table_rows : Natural
|
|
|
|
, geometry : MemGeo.Type
|
|
|
|
}
|
|
|
|
, default.geometry = MemGeo::{=}
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
|
2022-08-15 23:23:15 -04:00
|
|
|
let Network =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = { geometry : PlotGeo_.Type }, default.geometry = PlotGeo_::{=} }
|
2022-08-15 23:23:15 -04:00
|
|
|
|
2022-08-10 22:22:50 -04:00
|
|
|
let Processor =
|
2022-08-15 23:23:15 -04:00
|
|
|
{ Type =
|
|
|
|
{ core_rows : Natural
|
|
|
|
, core_padding : Natural
|
|
|
|
, show_stats : Bool
|
|
|
|
, show_plot : Bool
|
|
|
|
, table_rows : Natural
|
|
|
|
, geometry : ProcGeo.Type
|
|
|
|
}
|
|
|
|
, default.geometry = ProcGeo::{=}
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
let RaplSpec = { name : Text, address : Text }
|
|
|
|
|
2022-08-15 23:23:15 -04:00
|
|
|
let Pacman =
|
2022-08-16 00:14:04 -04:00
|
|
|
{ Type = { geometry : TextGeo.Type }, default.geometry = TextGeo::{=} }
|
2022-08-15 23:23:15 -04:00
|
|
|
|
|
|
|
let Power =
|
|
|
|
{ Type =
|
|
|
|
{ battery : Text, rapl_specs : List RaplSpec, geometry : PwrGeo.Type }
|
|
|
|
, default.geometry = PwrGeo::{=}
|
|
|
|
}
|
|
|
|
|
|
|
|
let ReadWrite =
|
2022-08-28 23:52:09 -04:00
|
|
|
{ Type = { devices : List Text, geometry : PlotGeo_.Type }
|
|
|
|
, default.geometry = PlotGeo_::{=}
|
2022-08-15 23:23:15 -04:00
|
|
|
}
|
2022-08-10 22:22:50 -04:00
|
|
|
|
2022-08-15 23:23:15 -04:00
|
|
|
let System = Pacman
|
2022-08-10 22:22:50 -04:00
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
let AllModules =
|
|
|
|
{ FileSystem
|
|
|
|
, Graphics
|
|
|
|
, Memory
|
|
|
|
, Network
|
|
|
|
, Pacman
|
|
|
|
, Power
|
|
|
|
, Processor
|
|
|
|
, ReadWrite
|
|
|
|
, System
|
|
|
|
}
|
|
|
|
|
2022-08-10 22:22:50 -04:00
|
|
|
let ModType =
|
2022-08-15 23:23:15 -04:00
|
|
|
< 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
|
2022-08-10 22:22:50 -04:00
|
|
|
>
|
|
|
|
|
2022-08-12 00:20:01 -04:00
|
|
|
let Annotated = \(a : Type) -> { type : Text, data : a }
|
|
|
|
|
|
|
|
let Block = < Pad : Natural | Mod : Annotated ModType >
|
2022-08-10 22:22:50 -04:00
|
|
|
|
2022-08-11 00:27:16 -04:00
|
|
|
let Column_ = { blocks : List Block, width : Natural }
|
2022-08-10 22:22:50 -04:00
|
|
|
|
2022-08-11 00:27:16 -04:00
|
|
|
let Column = < CPad : Natural | CCol : Column_ >
|
|
|
|
|
|
|
|
let Panel_ = { columns : List Column, margins : Margin }
|
|
|
|
|
|
|
|
let Panel = < PPad : Natural | PPanel : Panel_ >
|
2022-08-10 22:22:50 -04:00
|
|
|
|
|
|
|
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 =
|
2022-08-16 23:53:45 -04:00
|
|
|
{ Type = { seconds : Natural, ticks_x : Natural }
|
|
|
|
, default = { seconds = 90, ticks_x = 9 }
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2022-08-11 00:27:16 -04:00
|
|
|
, row_spacing = 16
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
>
|
|
|
|
|
2022-08-12 00:20:01 -04:00
|
|
|
let annotatePattern =
|
2022-08-11 23:03:33 -04:00
|
|
|
\(a : Pattern) ->
|
|
|
|
{ type = showConstructor a, data = a } : Annotated Pattern
|
|
|
|
|
2022-08-12 00:20:01 -04:00
|
|
|
let mod = \(a : ModType) -> Block.Mod { type = showConstructor a, data = a }
|
|
|
|
|
2022-08-11 23:03:33 -04:00
|
|
|
let APattern = Annotated Pattern
|
|
|
|
|
|
|
|
let symGradient =
|
|
|
|
\(c0 : Natural) ->
|
|
|
|
\(c1 : Natural) ->
|
2022-08-12 00:20:01 -04:00
|
|
|
annotatePattern
|
2022-08-11 23:03:33 -04:00
|
|
|
( Pattern.GradientRGB
|
|
|
|
[ { color = c0, stop = 0.0 }
|
|
|
|
, { color = c1, stop = 0.5 }
|
|
|
|
, { color = c0, stop = 1.0 }
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
2022-08-10 22:22:50 -04:00
|
|
|
let Patterns =
|
|
|
|
{ Type =
|
2022-08-11 23:03:33 -04:00
|
|
|
{ header : APattern
|
|
|
|
, panel : { bg : APattern }
|
|
|
|
, text :
|
|
|
|
{ active : APattern, inactive : APattern, critical : APattern }
|
|
|
|
, border : APattern
|
2022-08-10 22:22:50 -04:00
|
|
|
, plot :
|
2022-08-11 23:03:33 -04:00
|
|
|
{ grid : APattern
|
|
|
|
, outline : APattern
|
|
|
|
, data : { border : APattern, fill : APattern }
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
, indicator :
|
2022-08-11 23:03:33 -04:00
|
|
|
{ bg : APattern, fg : { active : APattern, critical : APattern } }
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
, default =
|
2022-08-12 00:20:01 -04:00
|
|
|
{ header = annotatePattern (Pattern.RGB 0xefefef)
|
|
|
|
, panel.bg
|
|
|
|
= annotatePattern (Pattern.RGBA { color = 0x121212, alpha = 0.7 })
|
2022-08-10 22:22:50 -04:00
|
|
|
, text =
|
2022-08-12 00:20:01 -04:00
|
|
|
{ active = annotatePattern (Pattern.RGB 0xbfe1ff)
|
|
|
|
, inactive = annotatePattern (Pattern.RGB 0xc8c8c8)
|
|
|
|
, critical = annotatePattern (Pattern.RGB 0xff8282)
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
2022-08-12 00:20:01 -04:00
|
|
|
, border = annotatePattern (Pattern.RGB 0x888888)
|
2022-08-10 22:22:50 -04:00
|
|
|
, plot =
|
2022-08-12 00:20:01 -04:00
|
|
|
{ grid = annotatePattern (Pattern.RGB 0x666666)
|
|
|
|
, outline = annotatePattern (Pattern.RGB 0x777777)
|
2022-08-10 22:22:50 -04:00
|
|
|
, data =
|
|
|
|
{ border =
|
2022-08-12 00:20:01 -04:00
|
|
|
annotatePattern
|
2022-08-11 23:03:33 -04:00
|
|
|
( Pattern.GradientRGB
|
|
|
|
[ { color = 0x003f7c, stop = 0.0 }
|
|
|
|
, { color = 0x1e90ff, stop = 1.0 }
|
|
|
|
]
|
|
|
|
)
|
2022-08-10 22:22:50 -04:00
|
|
|
, fill =
|
2022-08-12 00:20:01 -04:00
|
|
|
annotatePattern
|
2022-08-11 23:03:33 -04:00
|
|
|
( Pattern.GradientRGBA
|
|
|
|
[ { color = 0x316ece, stop = 0.2, alpha = 0.5 }
|
|
|
|
, { color = 0x8cc7ff, stop = 1.0, alpha = 1.0 }
|
|
|
|
]
|
|
|
|
)
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
, indicator =
|
2022-08-11 23:03:33 -04:00
|
|
|
{ bg = symGradient 0x565656 0xbfbfbf
|
2022-08-10 22:22:50 -04:00
|
|
|
, fg =
|
2022-08-11 23:03:33 -04:00
|
|
|
{ active = symGradient 0x316BA6 0x99CEFF
|
|
|
|
, critical = symGradient 0xFF3333 0xFFB8B8
|
2022-08-10 22:22:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let Theme =
|
|
|
|
{ Type =
|
|
|
|
{ font : Font.Type
|
|
|
|
, geometry : Geometry.Type
|
|
|
|
, patterns : Patterns.Type
|
|
|
|
}
|
|
|
|
, default =
|
|
|
|
{ font = Font::{=}, geometry = Geometry::{=}, patterns = Patterns::{=} }
|
|
|
|
}
|
|
|
|
|
2022-08-11 00:05:06 -04:00
|
|
|
let Bootstrap = { update_interval : Natural, dimensions : Point }
|
|
|
|
|
2022-08-12 00:20:01 -04:00
|
|
|
let Config = { bootstrap : Bootstrap, theme : Theme.Type, layout : Layout }
|
2022-08-10 22:22:50 -04:00
|
|
|
|
2022-08-11 00:05:06 -04:00
|
|
|
let toConfig =
|
|
|
|
\(i : Natural) ->
|
2022-08-12 00:20:01 -04:00
|
|
|
\(x : Natural) ->
|
|
|
|
\(y : Natural) ->
|
2022-08-11 00:05:06 -04:00
|
|
|
\(t : Theme.Type) ->
|
|
|
|
\(l : Layout) ->
|
2022-08-12 00:20:01 -04:00
|
|
|
{ bootstrap = { update_interval = i, dimensions = { x, y } }
|
2022-08-11 00:05:06 -04:00
|
|
|
, theme = t
|
|
|
|
, layout = l
|
|
|
|
}
|
|
|
|
: Config
|
|
|
|
|
2022-08-28 23:52:09 -04:00
|
|
|
in { toConfig, Block, Column, ModType, Layout, Panel, FSPath, Theme, mod }
|
|
|
|
/\ AllModules
|
|
|
|
/\ AllGeo
|