Need help in designing new Input Keys

Currently I am writing on a massive sorting plugin, that needs two new input keys.
I am listening to those new input keys in Window_Selectables update function.
Everything is working currently fine. I just want to check if I used the correct approach, but I guess I didn't for the following
reasons:
- This is probably not compatible with any key board configuration plugin
- If someone has already matched all 26 latin letters to some functions it does nothing
- It doesn't support controllers instead of keyboard.

Here is a part of the code:
Code:
BurningOrca.SortingOptions.Input_initialize = Input.initialize;
Input.initialize = function() {
    BurningOrca.SortingOptions.Input_initialize.call(this);
    this._sortOrderKey = null;
    this._sortMethodKey = null;
    this.SetupKeysForSorting();
}

Input.SetupKeysForSorting = function() {
    var oKey = 'O'.charCodeAt(0);

    if( !this.keyMapper[oKey] )
    {
        this._sortOrderKey = oKey;
    }
    else
    {
        for( var key = 'A'.charCodeAt(0); key <= 'Z'.charCodeAt(0); key++ )
        {
            if( !this.keyMapper[key] )
            {
                this._sortOrderKey = key;
                break;
            }
        }
    }

    if( !this._sortMethodKey ) {
        var sKey = 'S'.charCodeAt(0);
        if( !this.keyMapper[sKey] )
        {
            this._sortMethodKey = sKey;
        }
        else
        {
            for( var key = 'A'.charCodeAt(0); key <= 'Z'.charCodeAt(0); key++ )
            {
                if( key !== this._sortOrderKey
                 && !this.keyMapper[key] )
                {
                    this._sortMethodKey = key;
                    break;
                }
            }
        }
    }
    if( this._sortOrderKey )
    {
        this.keyMapper[this._sortOrderKey] = 'toggleSortOrder';
    }
    if( this._sortMethodKey )
    {
        this.keyMapper[this._sortMethodKey] = 'showSortOptions';
    }
}

Input.getSortOrderKey = function() {
    if( !this._sortOrderKey ) return null;
    return String.fromCharCode(this._sortOrderKey);
}

Input.getSortMethodKey = function() {
    if( !this._sortMethodKey ) return null;
    return String.fromCharCode(this._sortMethodKey);
}

Could someone please advice me on how to do this correctly, maybe also supporting controllers or maybe tell me two of the default keys, that aren't used in Window_ItemList, Window_SkillList and Window_ShopBuy?

Original thread: https://forums.rpgmakerweb.com/threads/need-help-in-designing-new-input-keys.108317/