ENH use module-specific geometries
This commit is contained in:
parent
c50a704c0f
commit
99ce64bbb6
|
@ -6,48 +6,113 @@ let Margin = Vector2 Natural
|
||||||
|
|
||||||
let FSPath = { name : Text, path : Text }
|
let FSPath = { name : Text, path : Text }
|
||||||
|
|
||||||
let FileSystem = { show_smart : Bool, fs_paths : List FSPath }
|
let FSGeo =
|
||||||
|
{ Type = { spacing : Natural, bar_pad : Natural, sep_spacing : Natural }
|
||||||
|
, default = { spacing = 20, bar_pad = 100, sep_spacing = 20 }
|
||||||
|
}
|
||||||
|
|
||||||
|
let FileSystem =
|
||||||
|
{ Type =
|
||||||
|
{ show_smart : Bool, fs_paths : List FSPath, geometry : FSGeo.Type }
|
||||||
|
, default.geometry = FSGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let PlotGeo =
|
||||||
|
{ Type = { sec_break : Natural, height : Natural }
|
||||||
|
, default = { sec_break = 20, height = 56 }
|
||||||
|
}
|
||||||
|
|
||||||
|
let GfxGeo =
|
||||||
|
{ Type =
|
||||||
|
{ sep_spacing : Natural, text_spacing : Natural, plot : PlotGeo.Type }
|
||||||
|
, default = { sep_spacing = 20, text_spacing = 20, plot = PlotGeo::{=} }
|
||||||
|
}
|
||||||
|
|
||||||
let Graphics =
|
let Graphics =
|
||||||
|
{ Type =
|
||||||
{ dev_power : Text
|
{ dev_power : Text
|
||||||
, show_temp : Bool
|
, show_temp : Bool
|
||||||
, show_clock : Bool
|
, show_clock : Bool
|
||||||
, show_gpu_util : Bool
|
, show_gpu_util : Bool
|
||||||
, show_mem_util : Bool
|
, show_mem_util : Bool
|
||||||
, show_vid_util : Bool
|
, show_vid_util : Bool
|
||||||
|
, geometry : GfxGeo.Type
|
||||||
|
}
|
||||||
|
, default.geometry = GfxGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let MemGeo =
|
||||||
|
{ Type = { text_spacing : Natural, plot : PlotGeo.Type }
|
||||||
|
, default = { plot = PlotGeo::{=}, text_spacing = 20 }
|
||||||
}
|
}
|
||||||
|
|
||||||
let Memory =
|
let Memory =
|
||||||
|
{ Type =
|
||||||
{ show_stats : Bool
|
{ show_stats : Bool
|
||||||
, show_plot : Bool
|
, show_plot : Bool
|
||||||
, show_swap : Bool
|
, show_swap : Bool
|
||||||
, table_rows : Natural
|
, table_rows : Natural
|
||||||
|
, geometry : MemGeo.Type
|
||||||
|
}
|
||||||
|
, default.geometry = MemGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let Network =
|
||||||
|
{ Type = { geometry : { plot : PlotGeo.Type } }
|
||||||
|
, default.geometry.plot = PlotGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let ProcGeo = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
||||||
|
|
||||||
let Processor =
|
let Processor =
|
||||||
|
{ Type =
|
||||||
{ core_rows : Natural
|
{ core_rows : Natural
|
||||||
, core_padding : Natural
|
, core_padding : Natural
|
||||||
, show_stats : Bool
|
, show_stats : Bool
|
||||||
, show_plot : Bool
|
, show_plot : Bool
|
||||||
, table_rows : Natural
|
, table_rows : Natural
|
||||||
|
, geometry : ProcGeo.Type
|
||||||
|
}
|
||||||
|
, default.geometry = ProcGeo::{=}
|
||||||
}
|
}
|
||||||
|
|
||||||
let RaplSpec = { name : Text, address : Text }
|
let RaplSpec = { name : Text, address : Text }
|
||||||
|
|
||||||
let Power = { battery : Text, rapl_specs : List RaplSpec }
|
let PwrGeo =
|
||||||
|
{ Type = { text_spacing : Natural, plot : PlotGeo.Type }
|
||||||
|
, default = { text_spacing = 20, plot = PlotGeo::{=} }
|
||||||
|
}
|
||||||
|
|
||||||
let ReadWrite = { devices : List Text }
|
let Pacman =
|
||||||
|
{ Type = { geometry : { text_spacing : Natural } }
|
||||||
|
, default.geometry.text_spacing = 20
|
||||||
|
}
|
||||||
|
|
||||||
|
let Power =
|
||||||
|
{ Type =
|
||||||
|
{ battery : Text, rapl_specs : List RaplSpec, geometry : PwrGeo.Type }
|
||||||
|
, default.geometry = PwrGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let RWGeo = { Type = { plot : PlotGeo.Type }, default.plot = PlotGeo::{=} }
|
||||||
|
|
||||||
|
let ReadWrite =
|
||||||
|
{ Type = { devices : List Text, geometry : RWGeo.Type }
|
||||||
|
, default.geometry = RWGeo::{=}
|
||||||
|
}
|
||||||
|
|
||||||
|
let System = Pacman
|
||||||
|
|
||||||
let ModType =
|
let ModType =
|
||||||
< filesystem : FileSystem
|
< filesystem : FileSystem.Type
|
||||||
| graphics : Graphics
|
| graphics : Graphics.Type
|
||||||
| memory : Memory
|
| memory : Memory.Type
|
||||||
| network
|
| network : Network.Type
|
||||||
| pacman
|
| pacman : Pacman.Type
|
||||||
| processor : Processor
|
| processor : Processor.Type
|
||||||
| power : Power
|
| power : Power.Type
|
||||||
| readwrite : ReadWrite
|
| readwrite : ReadWrite.Type
|
||||||
| system
|
| system : System.Type
|
||||||
>
|
>
|
||||||
|
|
||||||
let Annotated = \(a : Type) -> { type : Text, data : a }
|
let Annotated = \(a : Type) -> { type : Text, data : a }
|
||||||
|
@ -246,9 +311,12 @@ in { toConfig
|
||||||
, FileSystem
|
, FileSystem
|
||||||
, Graphics
|
, Graphics
|
||||||
, Memory
|
, Memory
|
||||||
|
, Network
|
||||||
|
, Pacman
|
||||||
, Processor
|
, Processor
|
||||||
, Power
|
, Power
|
||||||
, ReadWrite
|
, ReadWrite
|
||||||
|
, System
|
||||||
, Theme
|
, Theme
|
||||||
, mod
|
, mod
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,8 @@ let C = ./config.dhall
|
||||||
|
|
||||||
let memory =
|
let memory =
|
||||||
C.ModType.memory
|
C.ModType.memory
|
||||||
{ show_stats = False
|
C.Memory::{
|
||||||
|
, show_stats = False
|
||||||
, show_swap = False
|
, show_swap = False
|
||||||
, show_plot = True
|
, show_plot = True
|
||||||
, table_rows = 3
|
, table_rows = 3
|
||||||
|
@ -10,7 +11,8 @@ let memory =
|
||||||
|
|
||||||
let processor =
|
let processor =
|
||||||
C.ModType.processor
|
C.ModType.processor
|
||||||
{ core_rows = 0
|
C.Processor::{
|
||||||
|
, core_rows = 0
|
||||||
, core_padding = 0
|
, core_padding = 0
|
||||||
, show_stats = False
|
, show_stats = False
|
||||||
, show_plot = True
|
, show_plot = True
|
||||||
|
@ -24,7 +26,7 @@ let layout =
|
||||||
{ columns =
|
{ columns =
|
||||||
[ C.Column.CCol
|
[ C.Column.CCol
|
||||||
{ blocks =
|
{ blocks =
|
||||||
[ C.mod C.ModType.network
|
[ C.mod (C.ModType.network C.Network::{=})
|
||||||
, C.Block.Pad 10
|
, C.Block.Pad 10
|
||||||
, C.mod memory
|
, C.mod memory
|
||||||
, C.Block.Pad 10
|
, C.Block.Pad 10
|
||||||
|
|
|
@ -3,9 +3,10 @@ local pure = require 'pure'
|
||||||
local impure = require 'impure'
|
local impure = require 'impure'
|
||||||
|
|
||||||
return function(main_state, config, common, width, point)
|
return function(main_state, config, common, width, point)
|
||||||
local SPACING = 20
|
local geo = config.geometry
|
||||||
local BAR_PAD = 100
|
local SPACING = geo.spacing
|
||||||
local SEPARATOR_SPACING = 20
|
local BAR_PAD = geo.bar_pad
|
||||||
|
local SEPARATOR_SPACING = geo.sep_spacing
|
||||||
|
|
||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- smartd
|
-- smartd
|
||||||
|
|
|
@ -2,10 +2,11 @@ local pure = require 'pure'
|
||||||
local i_o = require 'i_o'
|
local i_o = require 'i_o'
|
||||||
|
|
||||||
return function(update_freq, config, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
local SEPARATOR_SPACING = 20
|
local geo = config.geometry
|
||||||
local TEXT_SPACING = 20
|
local SEPARATOR_SPACING = geo.sep_spacing
|
||||||
local PLOT_SEC_BREAK = 20
|
local TEXT_SPACING = geo.text_spacing
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_SEC_BREAK = geo.plot.sec_break
|
||||||
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
local NA = 'N/A'
|
local NA = 'N/A'
|
||||||
local NVIDIA_EXE = 'nvidia-settings'
|
local NVIDIA_EXE = 'nvidia-settings'
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
|
@ -5,14 +5,15 @@ local pure = require 'pure'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, config, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
|
local geo = config.geometry
|
||||||
local DIAL_THICKNESS = 8
|
local DIAL_THICKNESS = 8
|
||||||
local DIAL_RADIUS = 32
|
local DIAL_RADIUS = 32
|
||||||
local DIAL_SPACING = 40
|
local DIAL_X_SPACING = 40
|
||||||
local CACHE_Y_OFFSET = 7
|
local CACHE_Y_OFFSET = 7
|
||||||
local CACHE_X_OFFSET = 50
|
local CACHE_X_OFFSET = 50
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = geo.text_spacing
|
||||||
local PLOT_SECTION_BREAK = 23
|
local PLOT_SECTION_BREAK = geo.plot.sec_break
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
local TABLE_SECTION_BREAK = 20
|
local TABLE_SECTION_BREAK = 20
|
||||||
|
|
||||||
local __math_floor = math.floor
|
local __math_floor = math.floor
|
||||||
|
@ -54,7 +55,7 @@ return function(update_freq, config, common, width, point)
|
||||||
local CACHE_X
|
local CACHE_X
|
||||||
local SWAP_X
|
local SWAP_X
|
||||||
if _show_swap == true then
|
if _show_swap == true then
|
||||||
SWAP_X = MEM_X + DIAL_DIAMETER + DIAL_SPACING
|
SWAP_X = MEM_X + DIAL_DIAMETER + DIAL_X_SPACING
|
||||||
CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
CACHE_X = SWAP_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
||||||
else
|
else
|
||||||
CACHE_X = MEM_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
CACHE_X = MEM_X + CACHE_X_OFFSET + DIAL_DIAMETER / 2
|
||||||
|
|
|
@ -3,9 +3,10 @@ local pure = require 'pure'
|
||||||
local i_o = require 'i_o'
|
local i_o = require 'i_o'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, _, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
local PLOT_SEC_BREAK = 20
|
local geo = config.geometry
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_SEC_BREAK = geo.plot.sec_break
|
||||||
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
local interface_paths = sys.get_net_interface_paths()
|
local interface_paths = sys.get_net_interface_paths()
|
||||||
|
|
||||||
local get_bits = function(path)
|
local get_bits = function(path)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local pure = require 'pure'
|
local pure = require 'pure'
|
||||||
|
|
||||||
return function(main_state, _, common, width, point)
|
return function(main_state, config, common, width, point)
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = config.geometry.text_spacing
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
local __string_gmatch = string.gmatch
|
local __string_gmatch = string.gmatch
|
||||||
|
|
|
@ -3,9 +3,10 @@ local pure = require 'pure'
|
||||||
local sys = require 'sys'
|
local sys = require 'sys'
|
||||||
|
|
||||||
return function(update_freq, config, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
local TEXT_SPACING = 20
|
local geo = config.geometry
|
||||||
local PLOT_SEC_BREAK = 20
|
local TEXT_SPACING = geo.text_spacing
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_SEC_BREAK = geo.plot.sec_break
|
||||||
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
|
|
||||||
local power_label_function = function(plot_max)
|
local power_label_function = function(plot_max)
|
||||||
local fmt = common.y_label_format_string(plot_max, 'W')
|
local fmt = common.y_label_format_string(plot_max, 'W')
|
||||||
|
|
|
@ -5,8 +5,9 @@ local i_o = require 'i_o'
|
||||||
local impure = require 'impure'
|
local impure = require 'impure'
|
||||||
|
|
||||||
return function(update_freq, config, common, width, point)
|
return function(update_freq, config, common, width, point)
|
||||||
local PLOT_SEC_BREAK = 20
|
local geo = config.geometry
|
||||||
local PLOT_HEIGHT = 56
|
local PLOT_SEC_BREAK = geo.plot.sec_break
|
||||||
|
local PLOT_HEIGHT = geo.plot.height
|
||||||
|
|
||||||
local mod_state = {read = 0, write = 0}
|
local mod_state = {read = 0, write = 0}
|
||||||
local device_paths = sys.get_disk_paths(config.devices)
|
local device_paths = sys.get_disk_paths(config.devices)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
local i_o = require 'i_o'
|
local i_o = require 'i_o'
|
||||||
local pure = require 'pure'
|
local pure = require 'pure'
|
||||||
|
|
||||||
return function(main_state, _, common, width, point)
|
return function(main_state, config, common, width, point)
|
||||||
local TEXT_SPACING = 20
|
local TEXT_SPACING = config.geometry.text_spacing
|
||||||
|
|
||||||
local __string_match = string.match
|
local __string_match = string.match
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue