Adding lots of cool stuff to dotfiles

This commit is contained in:
Antoine Phan
2024-02-29 01:00:26 -05:00
parent b5ad2b6c39
commit dd2ef8ddac
390 changed files with 35966 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
components = {}
function load_module(m, a)
assert(type(m) == "string", "module name is mandatory, bail out");
if not components[m] then
components[m] = { "libwireplumber-module-" .. m, type = "module", args = a }
end
end
function load_optional_module(m, a)
assert(type(m) == "string", "module name is mandatory, bail out");
if not components[m] then
components[m] = { "libwireplumber-module-" .. m, type = "module", args = a, optional = true }
end
end
function load_pw_module(m)
assert(type(m) == "string", "module name is mandatory, bail out");
if not components[m] then
components[m] = { "libpipewire-module-" .. m, type = "pw_module" }
end
end
function load_script(s, a)
if not components[s] then
components[s] = { s, type = "script/lua", args = a }
end
end
function load_monitor(s, a)
load_script("monitors/" .. s .. ".lua", a)
end
function load_access(s, a)
load_script("access/access-" .. s .. ".lua", a)
end

View File

@@ -0,0 +1,81 @@
default_policy = {}
default_policy.enabled = true
default_policy.properties = {}
default_policy.endpoints = {}
default_policy.policy = {
["move"] = true, -- moves session items when metadata target.node changes
["follow"] = true, -- moves session items to the default device when it has changed
-- Whether to forward the ports format of filter stream nodes to their
-- associated filter device nodes. This is needed for application to stream
-- surround audio if echo-cancel is enabled.
["filter.forward-format"] = false,
-- Set to 'true' to disable channel splitting & merging on nodes and enable
-- passthrough of audio in the same format as the format of the device.
-- Note that this breaks JACK support; it is generally not recommended
["audio.no-dsp"] = false,
-- how much to lower the volume of lower priority streams when ducking
-- note that this is a linear volume modifier (not cubic as in pulseaudio)
["duck.level"] = 0.3,
}
bluetooth_policy = {}
bluetooth_policy.policy = {
-- Whether to store state on the filesystem.
["use-persistent-storage"] = true,
-- Whether to use headset profile in the presence of an input stream.
["media-role.use-headset-profile"] = true,
-- Application names correspond to application.name in stream properties.
-- Applications which do not set media.role but which should be considered
-- for role based profile switching can be specified here.
["media-role.applications"] = {
"Firefox", "Chromium input", "Google Chrome input", "Brave input",
"Microsoft Edge input", "Vivaldi input", "ZOOM VoiceEngine",
"Telegram Desktop", "telegram-desktop", "linphone", "Mumble",
"WEBRTC VoiceEngine", "Skype", "Firefox Developer Edition",
},
}
function default_policy.enable()
if default_policy.enabled == false then
return
end
-- Session item factories, building blocks for the session management graph
-- Do not disable these unless you really know what you are doing
load_module("si-node")
load_module("si-audio-adapter")
load_module("si-standard-link")
load_module("si-audio-endpoint")
-- API to access default nodes from scripts
load_module("default-nodes-api")
-- API to access mixer controls, needed for volume ducking
load_module("mixer-api")
-- Create endpoints statically at startup
load_script("static-endpoints.lua", default_policy.endpoints)
-- Create items for nodes that appear in the graph
load_script("create-item.lua", default_policy.policy)
-- Link nodes to each other to make media flow in the graph
load_script("policy-node.lua", default_policy.policy)
-- Link client nodes with endpoints to make media flow in the graph
load_script("policy-endpoint-client.lua", default_policy.policy)
load_script("policy-endpoint-client-links.lua", default_policy.policy)
-- Link endpoints with device nodes to make media flow in the graph
load_script("policy-endpoint-device.lua", default_policy.policy)
-- Switch bluetooth profile based on media.role
load_script("policy-bluetooth.lua", bluetooth_policy.policy)
end

View File

@@ -0,0 +1,95 @@
-- uncomment to enable role-based endpoints
-- this is not yet ready for desktop use
--
--[[
default_policy.policy.roles = {
["Capture"] = {
["alias"] = { "Multimedia", "Music", "Voice", "Capture" },
["priority"] = 25,
["action.default"] = "cork",
["action.capture"] = "mix",
["media.class"] = "Audio/Source",
},
["Multimedia"] = {
["alias"] = { "Movie", "Music", "Game" },
["priority"] = 25,
["action.default"] = "cork",
},
["Speech-Low"] = {
["priority"] = 30,
["action.default"] = "cork",
["action.Speech-Low"] = "mix",
},
["Custom-Low"] = {
["priority"] = 35,
["action.default"] = "cork",
["action.Custom-Low"] = "mix",
},
["Navigation"] = {
["priority"] = 50,
["action.default"] = "duck",
["action.Navigation"] = "mix",
},
["Speech-High"] = {
["priority"] = 60,
["action.default"] = "cork",
["action.Speech-High"] = "mix",
},
["Custom-High"] = {
["priority"] = 65,
["action.default"] = "cork",
["action.Custom-High"] = "mix",
},
["Communication"] = {
["priority"] = 75,
["action.default"] = "cork",
["action.Communication"] = "mix",
},
["Emergency"] = {
["alias"] = { "Alert" },
["priority"] = 99,
["action.default"] = "cork",
["action.Emergency"] = "mix",
},
}
default_policy.endpoints = {
["endpoint.capture"] = {
["media.class"] = "Audio/Source",
["role"] = "Capture",
},
["endpoint.multimedia"] = {
["media.class"] = "Audio/Sink",
["role"] = "Multimedia",
},
["endpoint.speech_low"] = {
["media.class"] = "Audio/Sink",
["role"] = "Speech-Low",
},
["endpoint.custom_low"] = {
["media.class"] = "Audio/Sink",
["role"] = "Custom-Low",
},
["endpoint.navigation"] = {
["media.class"] = "Audio/Sink",
["role"] = "Navigation",
},
["endpoint.speech_high"] = {
["media.class"] = "Audio/Sink",
["role"] = "Speech-High",
},
["endpoint.custom_high"] = {
["media.class"] = "Audio/Sink",
["role"] = "Custom-High",
},
["endpoint.communication"] = {
["media.class"] = "Audio/Sink",
["role"] = "Communication",
},
["endpoint.emergency"] = {
["media.class"] = "Audio/Sink",
["role"] = "Emergency",
},
}
]]--

View File

@@ -0,0 +1 @@
default_policy.enable()