How Can I Tie the cooldown of Anything in an ActionSlot Into a WeakAuras Icon?

Every time I pick up this game again I try to polish and minimalize my UI, and currently one aspect involves putting my longer offensive/defensive/utility cooldowns on a separate, invisible actionbar pushed away into a corner. I then have 3 WeakAura groups around my character that show me when my stuff is on cooldown. So basically if I see nothing, I can cast whatever I want.
But the thing is, I’m pretty tired of making several auras for new trinkets, specs and classes. So if I could just link these action slots themselves into their own WeakAura icons, it’d solve everything!

I figure what I want should be possible based on tweaking some code from the Wowwiki page for ActionSlots:

/run local l = 0;
for l = 49, 49 do local t = GetActionText(l);
local x = GetActionTexture(l);
if x then local m = "Slot " .. l .. ": [" .. x .. "]";
if t then m = m .. " \"" .. t .. "\"";
end DEFAULT_CHAT_FRAME:AddMessage(m);
end end

…but I just don’t know how to properly link the code and spell ID output into a WA icon. So any help would really be appreciated!

Here’s my best go at it.

https://wago.io/Xq9kiJOJx

It uses a “trigger state updater” style custom trigger to manage multiple icons from one function.

Use the custom options tab to set the slots you want to watch.

Here’s the trigger

function(allstates, event, ...)
    
    local firstSlot = aura_env.config.firstSlot
    local lastSlot = aura_env.config.lastSlot
    if firstSlot>lastSlot then
        print('Error in WeakAuras',aura_env.id,': firstSlot must be <= lastSlot')
        return false
    end
    
    local time = GetTime()
    local _,gcd = GetSpellCooldown(61304)
    local fullUpdate = next(allstates)==nil or event=='PLAYER_SPECIALIZATION_CHANGED'
    
    if event == 'ACTIONBAR_SLOT_CHANGED' then
        local changedSlot = ...
        if changedSlot and changedSlot >= firstSlot and changedSlot <= lastSlot then
            firstSlot = changedSlot
            lastSlot = changedSlot
            fullUpdate = true
        else return
        end
    end --ACTIONBAR_SLOT_CHANGED
    
    
    for slot=firstSlot, lastSlot do
        if fullUpdate then
            
            allstates[slot]={
                show = true,
                progressType = "timed",
                name = 'Slot'..slot,
                icon = GetActionTexture(slot),
                autoHide = aura_env.config.autohide,
                index = slot
            }
        end --fullUpdate
        
        local state = allstates[slot]
        state.changed = true
        local start, duration, enable, modRate = GetActionCooldown(slot)
        local expiration = duration~=gcd and start+duration or time-1
        
        state.duration = duration
        state.expirationTime = expiration
        
    end --slot
    
    return true
end

Thanks for your trouble, but it seems the wago link leads to a 404… Any chance you could re-upload it? TIA!

Oops, it was set to private. It should work now.

This works great, thanks again!