26 lines
677 B
Lua
Executable File
26 lines
677 B
Lua
Executable File
#!/usr/bin/env lua
|
|
local games = {"mpv Media Player"}
|
|
for k,v in pairs(games) do
|
|
games[v] = true
|
|
end
|
|
|
|
local sinkname = "combined"
|
|
|
|
local running = {}
|
|
local input
|
|
for line in io.popen("pactl list sink-inputs 2>&1","r"):read("*a"):gmatch("[^\n]+") do
|
|
if line:match("Sink Input #(%d+)") then
|
|
input = line:match("Sink Input #(%d+)")
|
|
elseif line:match('application.name = "([^"]+)') then
|
|
running[line:match('application.name = "([^"]+)')] = input
|
|
end
|
|
end
|
|
|
|
for k,v in pairs(running) do
|
|
if games[k] then
|
|
print("Match",k)
|
|
print(string.format("pacmd move-sink-input '%d' '%s'",v,sinkname))
|
|
os.execute(string.format("pacmd move-sink-input '%d' '%s'",v,sinkname))
|
|
end
|
|
end
|