Files
moonmix/model/pkg.generated.mbti
T
SpriteandClaude Opus 5.5 74d85ecdfc
CI / check (pull_request) Successful in 10s
CI / native (pull_request) Successful in 1m18s
Follow the desktop accent colour and colour scheme (XDG portal)
Read org.freedesktop.appearance accent-color and color-scheme from
org.freedesktop.portal.Settings over GDBus in the GTK stub and follow
SettingChanged. The accent recolours the selected tab, sliders, peak
meters and the checked Default button through an application-priority
GtkCssProvider (named colours and --accent-* variables too, for themes
that use them); the colour scheme sets the theme's dark/light variant.
Without a portal or accent the theme's own stays.

Colour conversion, WCAG contrast (readable foreground on the accent,
readable accent text on the window) and the CSS live in model/accent.mbt
with unit tests. The smoke test runs a fake portal on a private session
bus, switches the accent live from green to orange and renders the tabs
again (docs/screenshots/accent-*.png).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 01:28:19 +00:00

221 lines
4.5 KiB
Plaintext

// Generated using `moon info`, DON'T EDIT IT
package "geordi/moonmix/model"
import {
"moonbitlang/core/debug",
}
// Values
pub const APP_LOOKUP_PREFIX : String = "app:"
pub const ICON_MISSING : String = "image-missing"
pub const MAX_PERCENT : Double = 150.0
pub const METER_DECAY : Double = 0.04
pub const MIN_TEXT_CONTRAST : Double = 4.5
pub const MIN_UI_CONTRAST : Double = 3.0
pub const NORM_PERCENT : Double = 100.0
pub fn accent_css(Rgb, Bool) -> String
pub fn accent_text_color(Rgb, Bool) -> Rgb
pub let black : Rgb
pub fn clamp_percent(Double) -> Double
pub fn compare_text(String, String) -> Int32
pub fn contrast_ratio(Rgb, Rgb) -> Double
pub fn default_button_icons() -> Array[String]
pub fn device_bus(Node) -> String
pub fn device_icon_chain(Node) -> Array[String]
pub fn diff_rows(Array[Row], Array[Row]) -> Diff
pub fn display_title(Node) -> String
pub fn form_factor_icon(String, NodeKind) -> String
pub fn format_db(Double) -> String
pub fn format_percent(Double) -> String
pub fn format_volume(Array[Double]) -> String
pub fn icon_fallback_device() -> Array[String]
pub fn icon_fallback_stream() -> Array[String]
pub fn linear_to_db(Double) -> Double?
pub fn linear_to_percent(Double) -> Double
pub fn linked_percent(Array[Double]) -> Double
pub fn meter_level(Double) -> Double
pub fn meter_step(Double, Double) -> Double
pub fn percent_to_linear(Double) -> Double
pub fn readable_fg(Rgb) -> Rgb
pub fn rows(State, Tab) -> Array[Row]
pub fn scale_linked(Array[Double], Double) -> Array[Double]
pub fn should_apply_remote(Int64, Int64, window_us? : Int64) -> Bool
pub fn stream_icon_chain(Node) -> Array[String]
pub fn symbolic(String) -> String
pub fn volume_icon(Double, Bool) -> String
pub let white : Rgb
pub fn window_bg(Bool) -> Rgb
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) struct AccentColors {
bg : Rgb
fg : Rgb
text : Rgb
border : Rgb
}
pub fn AccentColors::new(Rgb, Bool) -> Self
#derive(Eq, @debug.Debug)
pub(all) enum ColorScheme {
NoPreference
Dark
Light
}
pub fn ColorScheme::from_portal(Int32) -> Self
#derive(Eq, @debug.Debug)
pub(all) struct DeviceChoice {
id : Int32
name : String
label : String
}
#derive(Eq, @debug.Debug)
pub(all) struct Diff {
removed : Array[Int32]
added : Array[Int32]
updated : Array[Int32]
}
#derive(@debug.Debug)
pub(all) enum Event {
Upsert(Node)
Remove(Int32)
Links(Array[Link])
Defaults(sink~ : Int32, source~ : Int32)
Reset
}
#derive(Eq, @debug.Debug)
pub(all) struct Link {
output_node : Int32
input_node : Int32
}
#derive(Eq, @debug.Debug)
pub(all) struct Node {
id : Int32
name : String
description : String
media_class : String
app_name : String
media_name : String
icon_hints : Array[String]
form_factor : String
bus : String
app_binary : String
app_id : String
volumes : Array[Double]
mute : Bool
}
pub fn Node::kind(Self) -> NodeKind
pub fn Node::new(Int32, String, name? : String, description? : String, app_name? : String, media_name? : String, icon_hints? : Array[String], form_factor? : String, bus? : String, app_binary? : String, app_id? : String, volumes? : Array[Double], mute? : Bool) -> Self
#derive(Eq, @debug.Debug)
pub(all) enum NodeKind {
Sink
Source
PlaybackStream
RecordStream
Other
}
pub fn NodeKind::from_media_class(String) -> Self
#derive(Eq, @debug.Debug)
pub(all) struct Rgb {
r : Double
g : Double
b : Double
}
pub fn Rgb::from_portal(Double, Double, Double) -> Self?
pub fn Rgb::luminance(Self) -> Double
pub fn Rgb::mix(Self, Self, Double) -> Self
pub fn Rgb::parse_hex(String) -> Self?
pub fn Rgb::to_hex(Self) -> String
#derive(Eq, @debug.Debug)
pub(all) struct Row {
id : Int32
title : String
subtitle : String
icons : Array[String]
volume_icon : String
volumes : Array[Double]
percent : Double
volume_text : String
mute : Bool
has_volume : Bool
is_default : Bool
choices : Array[DeviceChoice]
current_choice : Int32
}
pub(all) struct State {
nodes : Map[Int32, Node]
mut links : Array[Link]
mut default_sink : Int32
mut default_source : Int32
}
pub fn State::apply(Self, Event) -> Bool
pub fn State::new() -> Self
pub fn State::nodes_of(Self, NodeKind) -> Array[Node]
pub fn State::stream_device(Self, Int32) -> Int32?
#derive(Eq, @debug.Debug)
pub(all) enum Tab {
Playback
Recording
OutputDevices
InputDevices
}
pub fn Tab::all() -> Array[Self]
pub fn Tab::empty_text(Self) -> String
pub fn Tab::icon(Self) -> String
pub fn Tab::label(Self) -> String
pub fn Tab::node_kind(Self) -> NodeKind
// Type aliases
// Traits