[Addon Request] Shortened keybind display

Discuss and share any vanilla addons, macros, or interface mods that other users may find useful.
Post Reply
DethLH
Posts: 1
Joined: Wed May 16, 2018 5:25 am

Wed May 16, 2018 5:35 am

Hey guys.

I'm really annoyed by some keybinds not fitting into their action bar buttons. Example - shift+mouse4 is displayed as "S...", Middle mouse is displayed as "Mi..." etc. It really is frustrating learning a new class with new keybinds when you have 5 skills next to each other and you have no idea what the actual keybinds are..

I'm using bartender2, but I believe it takes the default blizzard code for this, as i think this happens without addons too.

Thing is, Modui does exactly what I want. For example it shows Shift+Mouse4 as S-M4. I would like to also modify it even more. Example: S-M4 to sM4, just to save that little bit more space in case you are using a thicker font, smaller scaled action bars etc. Problem is I cant use modui for alot of reasons... I have my own UI that I've been improving on for years and making it all work together with modui would be a massive challenge.

From what I found, in Modui this is defined by a single .lua file - https://github.com/obble/modui/blob/mas ... hotkey.lua

Code: Select all

local orig = {}

    orig.ActionButton_UpdateHotkeys = ActionButton_UpdateHotkeys

    local replacements = {
        ['(s%-)']                               = 'S-',
        ['(a%-)']                               = 'A-',
        ['(c%-)']                               = 'C-',
        ['(st%-)']                              = 'C-',       -- german control 'Steuerung'
        ['('..KEY_BUTTON3..')']                 = 'M3',
        ['('..gsub(KEY_BUTTON4, '4', '')..')']  = 'M',
        ['('..gsub(KEY_NUMPAD0, '0', '')..')']  = 'Nu',
        ['('..KEY_NUMPADDECIMAL..')']           = 'Nu.',
        ['('..KEY_NUMPADDIVIDE..')']        = 'Nu/',
        ['('..KEY_NUMPADMINUS..')']         = 'Nu-',
        ['('..KEY_NUMPADMULTIPLY..')']          = 'Nu*',
        ['('..KEY_NUMPADPLUS..')']              = 'Nu+',
        ['('..KEY_MOUSEWHEELDOWN..')']          = 'M▼',
        ['('..KEY_MOUSEWHEELUP..')']            = 'M▲',
        ['('..KEY_DOWN..')']                    = '▼',
        ['('..KEY_UP..')']                      = '▲',
        ['('..KEY_LEFT..')']                    = '◄',
        ['('..KEY_RIGHT..')']                   = '►',
        ['('..KEY_PAGEDOWN..')']                = 'P▼',
        ['('..KEY_PAGEUP..')']                  = 'P▲',
        ['('..KEY_SPACE..')']                   = '_',
        ['('..KEY_INSERT..')']                  = 'Ins',
        ['('..KEY_BACKSPACE..')']               = 'Bs',
        ['('..KEY_DELETE..')']                  = 'Del',
        ['('..KEY_HOME..')']                    = 'Hm',
        ['('..KEY_NUMLOCK..')']                 = 'NuL',
        ['('..KEY_NUMLOCK_MAC..')']             = 'Clr',
        ['('..KEY_ENTER..')']                   = 'Ent',
        ['('..KEY_ENTER_MAC..')']               = 'Ret',
        ['('..KEY_ESCAPE..')']                  = 'Esc',
    }

    local UpdateHotkeys = function(actionButtonType)
        if not actionButtonType then actionButtonType = 'ACTIONBUTTON' end
        local ho = _G[this:GetName()..'HotKey']
        local text = GetBindingText(GetBindingKey(actionButtonType..this:GetID()), 'KEY_', 1)
        if text == '' then
            ho:Hide()
        else
            for k, v in pairs(replacements) do
                text = gsub(text, k, v)
            end
            ho:SetText(text)
            ho:SetTextHeight(12)
            ho:SetDrawLayer'OVERLAY'
            ho:Show()
        end
    end

    function ActionButton_UpdateHotkeys(actionButtonType)
        orig.ActionButton_UpdateHotkeys(actionButtonType)
        UpdateHotkeys(actionButtonType)
    end

    --
I've tried to make a standalone addon using just this 1 file, but it didnt work. I have no experience with coding, so I dont know why.. maybe it calls for some other file in modui directory but it doesnt appear so to me atleast.

Anyway, if this is doable and not too time consuming I would really appreciate some help as I'm not that good with this stuff

Thanks!
Post Reply

Return to “UI, Addons, & Macros”