Name Chrome streams after their browser tabs
A browser extension reports audible tabs to moonmix-tabs-host, which matches them to PipeWire streams by time and publishes the names for the mixer; streams of one tab share a row. Ambiguous streams keep the browser's name. Without the extension, a browser's only running stream shows its MPRIS title. The smoke test no longer claims real audio hardware. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b61d504234
commit
e16cc1b2ad
31 files changed
+1830
-15
No files matched your search
@@ -24,6 +24,12 @@ pub const MIN_UI_CONTRAST : Double = 3.0
|
||||
|
||||
pub const NORM_PERCENT : Double = 100.0
|
||||
|
||||
pub const TAB_SETTLE_MS : Int64 = 3000
|
||||
|
||||
pub const TAB_SLOP_MS : Int64 = 400
|
||||
|
||||
pub const TAB_WINDOW_MS : Int64 = 1500
|
||||
|
||||
pub const WHEEL_STEP_PERCENT : Double = 2.0
|
||||
|
||||
pub fn accent_css(Rgb, Bool) -> String
|
||||
@@ -70,10 +76,16 @@ pub fn linear_to_percent(Double) -> Double
|
||||
|
||||
pub fn linked_percent(Array[Double]) -> Double
|
||||
|
||||
pub fn merge_tab_files(Array[TabFile]) -> Map[String, TabName]
|
||||
|
||||
pub fn meter_level(Double) -> Double
|
||||
|
||||
pub fn meter_step(Double, Double) -> Double
|
||||
|
||||
pub fn parse_media_titles(String) -> Map[Int32, String]
|
||||
|
||||
pub fn parse_tabs(String) -> Array[BrowserTab]?
|
||||
|
||||
pub fn percent_to_linear(Double) -> Double
|
||||
|
||||
pub fn readable_fg(Rgb) -> Rgb
|
||||
@@ -110,6 +122,13 @@ pub(all) struct AccentColors {
|
||||
}
|
||||
pub fn AccentColors::new(Rgb, Bool) -> Self
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct BrowserTab {
|
||||
id : Int32
|
||||
title : String
|
||||
audible : Bool
|
||||
}
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum ColorScheme {
|
||||
NoPreference
|
||||
@@ -138,6 +157,8 @@ pub(all) enum Event {
|
||||
Remove(Int32)
|
||||
Links(Array[Link])
|
||||
Defaults(sink~ : Int32, source~ : Int32)
|
||||
TabNames(Map[String, TabName])
|
||||
MediaTitles(Map[Int32, String])
|
||||
Reset
|
||||
}
|
||||
|
||||
@@ -160,11 +181,14 @@ pub(all) struct Node {
|
||||
bus : String
|
||||
app_binary : String
|
||||
app_id : String
|
||||
serial : String
|
||||
parent_pid : Int32
|
||||
running : Bool
|
||||
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
|
||||
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, serial? : String, parent_pid? : Int32, running? : Bool, volumes? : Array[Double], mute? : Bool) -> Self
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum NodeKind {
|
||||
@@ -191,6 +215,7 @@ pub fn Rgb::to_hex(Self) -> String
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct Row {
|
||||
id : Int32
|
||||
members : Array[Int32]
|
||||
title : String
|
||||
subtitle : String
|
||||
icons : Array[String]
|
||||
@@ -224,11 +249,15 @@ pub(all) struct State {
|
||||
mut links : Array[Link]
|
||||
mut default_sink : Int32
|
||||
mut default_source : Int32
|
||||
mut tab_names : Map[String, TabName]
|
||||
mut media_titles : Map[Int32, String]
|
||||
}
|
||||
pub fn State::apply(Self, Event) -> Bool
|
||||
pub fn State::media_title(Self, Node) -> String?
|
||||
pub fn State::new() -> Self
|
||||
pub fn State::nodes_of(Self, NodeKind) -> Array[Node]
|
||||
pub fn State::stream_device(Self, Int32) -> Int32?
|
||||
pub fn State::tab_of(Self, Node) -> TabName?
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum Tab {
|
||||
@@ -244,6 +273,35 @@ pub fn Tab::icon_chain(Self) -> Array[String]
|
||||
pub fn Tab::label(Self) -> String
|
||||
pub fn Tab::node_kind(Self) -> NodeKind
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct TabFile {
|
||||
browser : Int32
|
||||
streams : Array[(String, Int32, String)]
|
||||
}
|
||||
pub fn TabFile::parse(String) -> Self?
|
||||
pub fn TabFile::to_text(Self) -> String
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) struct TabName {
|
||||
key : String
|
||||
title : String
|
||||
}
|
||||
|
||||
pub struct TabTracker {
|
||||
streams : Map[String, TrackedStream]
|
||||
tabs : Map[Int32, TrackedTab]
|
||||
mut got_tabs : Bool
|
||||
}
|
||||
pub fn TabTracker::matches(Self) -> Array[(String, Int32, String)]
|
||||
pub fn TabTracker::new() -> Self
|
||||
pub fn TabTracker::set_streams(Self, Array[String], Int64, initial? : Bool) -> Unit
|
||||
pub fn TabTracker::set_tabs(Self, Array[BrowserTab], Int64) -> Unit
|
||||
pub fn TabTracker::settle(Self, Int64, eliminate? : Bool) -> Unit
|
||||
|
||||
type TrackedStream
|
||||
|
||||
type TrackedTab
|
||||
|
||||
#derive(Eq, @debug.Debug)
|
||||
pub(all) enum WheelRoute {
|
||||
Slider
|
||||
|
||||
Reference in new issue
Block a user