• Dear Guest,

    You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode.
    To view all forum nodes and be able to create threads/posts please register or log-in with your existing account.

    TwinStar team

[Addon request] Shortened keybind display

Sato

New Member
Joined
Feb 18, 2016
Likes
0
#1
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/master/actionbar/hotkey.lua

Code:
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!
 
Top Bottom