function hilite(keys, how) { // need to check if existing key combo is overridden by undefining it if (keys && keys[1][0] !== undefined) { return how + keys.flat(2).join('+').replace('Mod', 'Ctrl') + how; } else { return how + '–' + how; } }
function getHotkey(arr, highlight=true) { let hi = highlight ? '**' : ''; let defkeys = arr.hotkeys ? [[getNestedObject(arr.hotkeys, [0, 'modifiers'])], [getNestedObject(arr.hotkeys, [0, 'key'])]] : undefined; let ck = app.hotkeyManager.customKeys[arr.id]; var hotkeys = ck ? [[getNestedObject(ck, [0, 'modifiers'])], [getNestedObject(ck, [0, 'key'])]] : undefined; return hotkeys ? hilite(hotkeys, hi) : hilite(defkeys, ''); }