From aaa54fcfd0557ba5e22c95edad90a97b00ca4848 Mon Sep 17 00:00:00 2001 From: iainsaxonhome <40520516+iainsaxonhome@users.noreply.github.com> Date: Thu, 10 Feb 2022 22:26:40 +1100 Subject: [PATCH 1/7] WIP adding keyboard support to OSC --- mordenx.lua | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) diff --git a/mordenx.lua b/mordenx.lua index 409336e..2c8f13f 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -104,6 +104,29 @@ local osc_styles = { Title = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs38\\q2\\fn' .. user_opts.font .. '}', WinCtrl = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs20\\fnmpv-osd-symbols}', elementDown = '{\\1c&H999999&}', + elementHighlight = '{\\1c&H000000&}', +} + +local keyboard_controls = { + [0] = { + 'minimize', + 'maximize', + 'close' + }, + [1] = { + 'seekbar' + }, + [2] = { + 'cy_audio', + 'cy_sub', + 'pl_prev', + 'skipback', + 'playpause', + 'skipfrwd', + 'pl_next', + 'tog_info', + 'tog_fs' + }, } -- internal states, do not touch @@ -138,6 +161,9 @@ local state = { osd = mp.create_osd_overlay('ass-events'), lastvisibility = user_opts.visibility, -- save last visibility on pause if showonpause fulltime = user_opts.timems, + highlight_element = 'cy_audio', + highlight_row = nil, + highlight_col = nil, } local window_control_box_width = 138 @@ -149,6 +175,8 @@ if builtin_osc_enabled then mp.set_property_native('osc', false) end +-- + -- -- Helperfunctions -- @@ -552,12 +580,28 @@ end -- function render_elements(master_ass) + --state.highlight_element = nil + for n=1, #elements do local element = elements[n] local style_ass = assdraw.ass_new() style_ass:merge(element.style_ass) ass_append_alpha(style_ass, element.layout.alpha, 0) + if mouse_hit(element) then + -- mouse down styling + if (element.styledown) then + --style_ass:append(osc_styles.elementHighlight) + -- TODO allow keyboard to alter this + state.highlight_element = element.name + end + + end + + if state.highlight_element == element.name then + style_ass:append(osc_styles.elementHighlight) + end + if element.eventresponder and (state.active_element == n) then -- run render event functions if not (element.eventresponder.render == nil) then @@ -845,6 +889,7 @@ end function new_element(name, type) elements[name] = {} elements[name].type = type + elements[name].name = name -- add default stuff elements[name].eventresponder = {} @@ -1218,6 +1263,10 @@ function osc_init() function () show_message(get_chapterlist()) end --function () mp.command('seek -60') end --function () mp.commandv('seek', -60, 'relative', 'keyframes') end + ne.eventresponder['enter'] = + --function () mp.command('seek -5') end + --function () mp.commandv('seek', -5, 'relative', 'keyframes') end + function () mp.commandv("add", "chapter", -1) end --skipfrwd ne = new_element('skipfrwd', 'button') @@ -1235,6 +1284,10 @@ function osc_init() function () show_message(get_chapterlist()) end --function () mp.command('seek +60') end --function () mp.commandv('seek', 60, 'relative', 'keyframes') end + ne.eventresponder['enter'] = + --function () mp.command('seek +5') end + --function () mp.commandv('seek', 5, 'relative', 'keyframes') end + function () mp.commandv("add", "chapter", 1) end -- update_tracklist() @@ -1268,6 +1321,8 @@ function osc_init() function () set_track('audio', -1) end ne.eventresponder['mbtn_mid_up'] = function () show_message(get_tracklist('audio')) end + ne.eventresponder['enter'] = + function () set_track('audio', 1); show_message(get_tracklist('audio')) end --cy_sub ne = new_element('cy_sub', 'button') @@ -1298,6 +1353,8 @@ function osc_init() function () set_track('sub', -1) end ne.eventresponder['mbtn_mid_up'] = function () show_message(get_tracklist('sub')) end + ne.eventresponder['enter'] = + function () set_track('sub', 1); show_message(get_tracklist('sub')) end --tog_fs ne = new_element('tog_fs', 'button') @@ -1498,6 +1555,7 @@ function show_osc() state.showtime = mp.get_time() osc_visible(true) + osc_enable_key_bindings() if (user_opts.fadeduration > 0) then state.anitype = nil @@ -1511,6 +1569,7 @@ function hide_osc() -- no-op and won't render again to remove the osc, so do that manually. state.osc_visible = false render_wipe() + osc_disable_key_bindings() elseif (user_opts.fadeduration > 0) then if not(state.osc_visible == false) then state.anitype = 'out' @@ -2070,6 +2129,199 @@ function visibility_mode(mode, no_osd) request_tick() end + +-- KeyboardControl +-- + +local osc_key_bindings = {} + +function osc_kb_control_up() + visibility_mode('always', true) + + local rows = {} + local active_row_index = 0 + local active_row_name = nil + + local row_index = -1 + for row_name, row_controls in pairs(keyboard_controls) do + row_index = row_index + 1 + rows[row_index] = row_name + for i, control in pairs(row_controls) do + if control == state.highlight_element then + active_row_index = row_index + active_row_name = row_name + end + end + end + + if active_row_index - 1 < 0 then + return + end + + local next_row_index = active_row_index - 1 + + local new_active_row_name = rows[next_row_index] + local new_active_row = keyboard_controls[new_active_row_name] + + for i, control in pairs(new_active_row) do + state.highlight_element = control + return + end +end + +function osc_kb_control_down() + visibility_mode('always', true) + local rows = {} + local active_row_index = 0 + local active_row_name = nil + + local row_index = -1 + for row_name, row_controls in pairs(keyboard_controls) do + row_index = row_index + 1 + rows[row_index] = row_name + for i, control in pairs(row_controls) do + if control == state.highlight_element then + active_row_index = row_index + active_row_name = row_name + end + end + end + + if active_row_index + 1 > #rows then + return + end + + local next_row_index = active_row_index + 1 + + local new_active_row_name = rows[next_row_index] + local new_active_row = keyboard_controls[new_active_row_name] + + for i, control in pairs(new_active_row) do + state.highlight_element = control + return + end + +end + +function osc_kb_control_left() + visibility_mode('always', true) + + local active_control_name = nil + for row_name, row_controls in pairs(keyboard_controls) do + local controls = {} + local controls_index = -1 + for i, control in pairs(row_controls) do + controls_index = controls_index + 1 + controls[controls_index] = control + if control == state.highlight_element then + active_control_index = controls_index + active_control_name = control + end + end + + if active_control_name then + if active_control_index - 1 < 0 then + return + end + + local next_control_index = active_control_index - 1 + state.highlight_element = controls[next_control_index] + return + end + end + +end + +function osc_kb_control_right() + visibility_mode('always', true) + + local active_control_name = nil + for row_name, row_controls in pairs(keyboard_controls) do + local controls = {} + local controls_index = -1 + for i, control in pairs(row_controls) do + controls_index = controls_index + 1 + controls[controls_index] = control + if control == state.highlight_element then + active_control_index = controls_index + active_control_name = control + end + end + + if active_control_name then + if active_control_index + 1 > #controls then + return + end + + local next_control_index = active_control_index + 1 + state.highlight_element = controls[next_control_index] + return + end + end + +end + +function osc_kb_control_back() + print('BACK') + visibility_mode('auto', true) +end + +function osc_kb_control_enter() + print('ENTER') + visibility_mode('always', true) + for n = 1, #elements do + if elements[n].name == state.highlight_element then + + local action = 'enter' + if element_has_action(elements[n], action) then + elements[n].eventresponder[action](elements[n]) + return + end + + local action = 'mbtn_left_up' + if element_has_action(elements[n], action) then + elements[n].eventresponder[action](elements[n]) + return + end + end + end + +end + +function osc_add_key_binding(key, name, fn, flags) + osc_key_bindings[#osc_key_bindings + 1] = name + mp.add_forced_key_binding(key, name, fn, flags) +end + +function osc_enable_key_bindings() + osc_key_bindings = {} + -- The `mp.set_key_bindings()` method would be easier here, but that + -- doesn't support 'repeatable' flag, so we are stuck with this monster. + osc_add_key_binding('up', 'osc-kb-control-prev1', osc_kb_control_up, 'repeatable') + osc_add_key_binding('down', 'osc-kb-control-next1', osc_kb_control_down, 'repeatable') + osc_add_key_binding('left', 'osc-kb-control-left1', osc_kb_control_left, 'repeatable') + osc_add_key_binding('right', 'osc-kb-control-right1', osc_kb_control_right, 'repeatable') + -- osc_add_key_binding('shift+right', 'osc-kb-control-select-soft1', self:create_action('open_selected_item_soft')) + -- osc_add_key_binding('shift+mbtn_left', 'osc-kb-control-select-soft', self:create_action('open_selected_item_soft')) + + -- osc_add_key_binding('mbtn_back', 'osc-kb-control-back-alt3', self:create_action('back')) + -- osc_add_key_binding('bs', 'osc-kb-control-back-alt4', self:create_action('back')) + osc_add_key_binding('enter', 'osc-kb-control-select-alt3', osc_kb_control_enter, 'repeatable') + -- osc_add_key_binding('kp_enter', 'osc-kb-control-select-alt4', self:create_action('open_selected_item')) + osc_add_key_binding('esc', 'osc-kb-control-close', osc_kb_control_back, 'repeatable') + -- osc_add_key_binding('pgup', 'osc-kb-control-page-up', self:create_action('on_pgup')) + -- osc_add_key_binding('pgdwn', 'osc-kb-control-page-down', self:create_action('on_pgdwn')) + -- osc_add_key_binding('home', 'osc-kb-control-home', self:create_action('on_home')) + -- osc_add_key_binding('end', 'osc-kb-control-end', self:create_action('on_end')) +end + +function osc_disable_key_bindings() + for _, name in ipairs(osc_key_bindings) do mp.remove_key_binding(name) end + osc_key_bindings = {} +end + + + visibility_mode(user_opts.visibility, true) mp.register_script_message('osc-visibility', visibility_mode) mp.add_key_binding(nil, 'visibility', function() visibility_mode('cycle') end) From 59da6d22fd4b2fa24967361029f18359b956c4fe Mon Sep 17 00:00:00 2001 From: iainsaxonhome <40520516+iainsaxonhome@users.noreply.github.com> Date: Sun, 13 Feb 2022 21:03:34 +1100 Subject: [PATCH 2/7] Configurable, highlights, seek controls --- mordenx.lua | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/mordenx.lua b/mordenx.lua index 2c8f13f..46a98d4 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -45,6 +45,8 @@ local user_opts = { visibility = 'auto', -- only used at init to set visibility_mode(...) windowcontrols = 'auto', -- whether to show window controls language = 'eng', -- eng=English, chs=Chinese + + keyboardnavigation = false, -- enable directional keyboard navigation } -- Localization @@ -104,7 +106,7 @@ local osc_styles = { Title = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs38\\q2\\fn' .. user_opts.font .. '}', WinCtrl = '{\\blur1\\bord0.5\\1c&HFFFFFF&\\3c&H0\\fs20\\fnmpv-osd-symbols}', elementDown = '{\\1c&H999999&}', - elementHighlight = '{\\1c&H000000&}', + elementHighlight = '{\\blur1\\bord1\\1c&HFFC033&}', } local keyboard_controls = { @@ -598,10 +600,6 @@ function render_elements(master_ass) end - if state.highlight_element == element.name then - style_ass:append(osc_styles.elementHighlight) - end - if element.eventresponder and (state.active_element == n) then -- run render event functions if not (element.eventresponder.render == nil) then @@ -621,6 +619,10 @@ function render_elements(master_ass) end end + if state.highlight_element == element.name then + style_ass:append(osc_styles.elementHighlight) + end + local elem_ass = assdraw.ass_new() elem_ass:merge(style_ass) @@ -1555,7 +1557,10 @@ function show_osc() state.showtime = mp.get_time() osc_visible(true) - osc_enable_key_bindings() + + if user_opts.keyboardnavigation == true then + osc_enable_key_bindings() + end if (user_opts.fadeduration > 0) then state.anitype = nil @@ -1569,7 +1574,9 @@ function hide_osc() -- no-op and won't render again to remove the osc, so do that manually. state.osc_visible = false render_wipe() - osc_disable_key_bindings() + if user_opts.keyboardnavigation == true then + osc_disable_key_bindings() + end elseif (user_opts.fadeduration > 0) then if not(state.osc_visible == false) then state.anitype = 'out' @@ -2219,6 +2226,11 @@ function osc_kb_control_left() end end + if active_control_name == 'seekbar' then + mp.commandv('seek', -5, 'exact', 'keyframes') + return + end + if active_control_name then if active_control_index - 1 < 0 then return @@ -2248,6 +2260,11 @@ function osc_kb_control_right() end end + if active_control_name == 'seekbar' then + mp.commandv('seek', 5, 'exact', 'keyframes') + return + end + if active_control_name then if active_control_index + 1 > #controls then return @@ -2262,12 +2279,10 @@ function osc_kb_control_right() end function osc_kb_control_back() - print('BACK') visibility_mode('auto', true) end function osc_kb_control_enter() - print('ENTER') visibility_mode('always', true) for n = 1, #elements do if elements[n].name == state.highlight_element then @@ -2293,6 +2308,7 @@ function osc_add_key_binding(key, name, fn, flags) mp.add_forced_key_binding(key, name, fn, flags) end +-- This is based on code from https://github.com/darsain/uosc function osc_enable_key_bindings() osc_key_bindings = {} -- The `mp.set_key_bindings()` method would be easier here, but that @@ -2301,18 +2317,8 @@ function osc_enable_key_bindings() osc_add_key_binding('down', 'osc-kb-control-next1', osc_kb_control_down, 'repeatable') osc_add_key_binding('left', 'osc-kb-control-left1', osc_kb_control_left, 'repeatable') osc_add_key_binding('right', 'osc-kb-control-right1', osc_kb_control_right, 'repeatable') - -- osc_add_key_binding('shift+right', 'osc-kb-control-select-soft1', self:create_action('open_selected_item_soft')) - -- osc_add_key_binding('shift+mbtn_left', 'osc-kb-control-select-soft', self:create_action('open_selected_item_soft')) - - -- osc_add_key_binding('mbtn_back', 'osc-kb-control-back-alt3', self:create_action('back')) - -- osc_add_key_binding('bs', 'osc-kb-control-back-alt4', self:create_action('back')) osc_add_key_binding('enter', 'osc-kb-control-select-alt3', osc_kb_control_enter, 'repeatable') - -- osc_add_key_binding('kp_enter', 'osc-kb-control-select-alt4', self:create_action('open_selected_item')) osc_add_key_binding('esc', 'osc-kb-control-close', osc_kb_control_back, 'repeatable') - -- osc_add_key_binding('pgup', 'osc-kb-control-page-up', self:create_action('on_pgup')) - -- osc_add_key_binding('pgdwn', 'osc-kb-control-page-down', self:create_action('on_pgdwn')) - -- osc_add_key_binding('home', 'osc-kb-control-home', self:create_action('on_home')) - -- osc_add_key_binding('end', 'osc-kb-control-end', self:create_action('on_end')) end function osc_disable_key_bindings() From 84d363d139c50bbd0f48aeac9a8fcf3d132dd4dd Mon Sep 17 00:00:00 2001 From: iainsaxonhome Date: Tue, 15 Feb 2022 19:05:16 +1100 Subject: [PATCH 3/7] Moved keyboard_controls to function --- mordenx.lua | 55 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/mordenx.lua b/mordenx.lua index b702504..1933882 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -125,27 +125,34 @@ local osc_styles = { elementHighlight = '{\\blur1\\bord1\\1c&HFFC033&}', } -local keyboard_controls = { - [0] = { - 'minimize', - 'maximize', - 'close' - }, - [1] = { - 'seekbar' - }, - [2] = { - 'cy_audio', - 'cy_sub', - 'pl_prev', - 'skipback', - 'playpause', - 'skipfrwd', - 'pl_next', - 'tog_info', - 'tog_fs' - }, -} +function build_keyboard_controls() + return { + [0] = { + 'minimize', + 'maximize', + 'close' + }, + [1] = { + 'seekbar' + }, + [2] = { + 'cy_audio', + 'cy_sub', + 'pl_prev', + 'skipback', + 'jumpback', + 'playpause', + 'jumpfrwd', + 'skipfrwd', + 'pl_next', + 'tog_info', + 'tog_fs' + }, + } +end + + +local keyboard_controls = build_keyboard_controls() -- internal states, do not touch local state = { @@ -1334,6 +1341,9 @@ function osc_init() ne.eventresponder['mbtn_right_down'] = --function () mp.command('seek -60') end function () mp.commandv('seek', -60, jumpmode) end + ne.eventresponder['enter'] = + --function () mp.command('seek -5') end + function () mp.commandv('seek', -jumpamount, jumpmode) end --jumpfrwd @@ -1349,6 +1359,9 @@ function osc_init() ne.eventresponder['mbtn_right_down'] = --function () mp.command('seek +60') end function () mp.commandv('seek', 60, jumpmode) end + ne.eventresponder['enter'] = + --function () mp.command('seek +5') end + function () mp.commandv('seek', jumpamount, jumpmode) end end From 0e8ff6466571e77416e56891bab976e2e56884af Mon Sep 17 00:00:00 2001 From: iainsaxonhome Date: Tue, 15 Feb 2022 19:37:06 +1100 Subject: [PATCH 4/7] The keyboard mapping is now dynamic --- mordenx.lua | 97 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/mordenx.lua b/mordenx.lua index 1933882..8ece6b9 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -125,35 +125,6 @@ local osc_styles = { elementHighlight = '{\\blur1\\bord1\\1c&HFFC033&}', } -function build_keyboard_controls() - return { - [0] = { - 'minimize', - 'maximize', - 'close' - }, - [1] = { - 'seekbar' - }, - [2] = { - 'cy_audio', - 'cy_sub', - 'pl_prev', - 'skipback', - 'jumpback', - 'playpause', - 'jumpfrwd', - 'skipfrwd', - 'pl_next', - 'tog_info', - 'tog_fs' - }, - } -end - - -local keyboard_controls = build_keyboard_controls() - -- internal states, do not touch local state = { showtime, -- time of last invocation (last mouse move) @@ -201,6 +172,59 @@ end -- + +-- WindowControl helpers +function window_controls_enabled() + val = user_opts.windowcontrols + if val == 'auto' then + return (not state.border) or state.fullscreen + else + return val ~= 'no' + end +end + + + +function build_keyboard_controls() + + -- prepare the main button row + local bottom_button_line = {} + table.insert(bottom_button_line, 'cy_audio') + table.insert(bottom_button_line, 'cy_sub') + table.insert(bottom_button_line, 'pl_prev') + table.insert(bottom_button_line, 'skipback') + if user_opts.showjump then + table.insert(bottom_button_line, 'jumpback') + end + table.insert(bottom_button_line, 'playpause') + if user_opts.showjump then + table.insert(bottom_button_line, 'jumpfrwd') + end + table.insert(bottom_button_line, 'skipfrwd') + table.insert(bottom_button_line, 'pl_next') + table.insert(bottom_button_line, 'tog_info') + table.insert(bottom_button_line, 'tog_fs') + + -- build up the main mapping object + local mapping = {} + local window_controls_enabled = window_controls_enabled() + print(window_controls_enabled) + if window_controls_enabled then + table.insert(mapping, { + 'minimize', + 'maximize', + 'close' + }) + end + table.insert(mapping, { + 'seekbar' + }) + table.insert(mapping, bottom_button_line) + + return mapping +end + + -- -- Helperfunctions -- @@ -478,16 +502,6 @@ function get_track(type) return 0 end --- WindowControl helpers -function window_controls_enabled() - val = user_opts.windowcontrols - if val == 'auto' then - return (not state.border) or state.fullscreen - else - return val ~= 'no' - end -end - -- -- Element Management -- @@ -2308,7 +2322,7 @@ local osc_key_bindings = {} function osc_kb_control_up() visibility_mode('always', true) - + local keyboard_controls = build_keyboard_controls() local rows = {} local active_row_index = 0 local active_row_name = nil @@ -2342,6 +2356,7 @@ end function osc_kb_control_down() visibility_mode('always', true) + local keyboard_controls = build_keyboard_controls() local rows = {} local active_row_index = 0 local active_row_name = nil @@ -2376,6 +2391,7 @@ end function osc_kb_control_left() visibility_mode('always', true) + local keyboard_controls = build_keyboard_controls() local active_control_name = nil for row_name, row_controls in pairs(keyboard_controls) do @@ -2410,6 +2426,7 @@ end function osc_kb_control_right() visibility_mode('always', true) + local keyboard_controls = build_keyboard_controls() local active_control_name = nil for row_name, row_controls in pairs(keyboard_controls) do From 52ee885afc546ace40483cf3bf73206d13ec1444 Mon Sep 17 00:00:00 2001 From: iainsaxonhome Date: Tue, 15 Feb 2022 19:43:44 +1100 Subject: [PATCH 5/7] Cleaned up unwanted `print()` --- mordenx.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mordenx.lua b/mordenx.lua index 8ece6b9..d65999e 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -207,9 +207,7 @@ function build_keyboard_controls() -- build up the main mapping object local mapping = {} - local window_controls_enabled = window_controls_enabled() - print(window_controls_enabled) - if window_controls_enabled then + if window_controls_enabled() then table.insert(mapping, { 'minimize', 'maximize', From 5dfda84116193ceb7069a767f45d2735941c1f0b Mon Sep 17 00:00:00 2001 From: iainsaxonhome Date: Thu, 24 Feb 2022 20:30:10 +1100 Subject: [PATCH 6/7] Removed mouse highlighting --- mordenx.lua | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/mordenx.lua b/mordenx.lua index 0a9d458..cda4449 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -654,16 +654,6 @@ function render_elements(master_ass) style_ass:merge(element.style_ass) ass_append_alpha(style_ass, element.layout.alpha, 0) - if mouse_hit(element) then - -- mouse down styling - if (element.styledown) then - --style_ass:append(osc_styles.elementHighlight) - -- TODO allow keyboard to alter this - state.highlight_element = element.name - end - - end - if element.eventresponder and (state.active_element == n) then -- run render event functions if not (element.eventresponder.render == nil) then @@ -2284,16 +2274,6 @@ end -- mode can be auto/always/never/cycle -- the modes only affect internal variables and not stored on its own. function visibility_mode(mode, no_osd) - if mode == "cycle" then - if not state.enabled then - mode = "auto" - elseif user_opts.visibility ~= "always" then - mode = "always" - else - mode = "never" - end - end - if mode == 'auto' then always_on(false) enable_osc(true) @@ -2306,10 +2286,9 @@ function visibility_mode(mode, no_osd) msg.warn('Ignoring unknown visibility mode \"' .. mode .. '\"') return end - + user_opts.visibility = mode - utils.shared_script_property_set("osc-visibility", mode) - + if not no_osd and tonumber(mp.get_property('osd-level')) >= 1 then mp.osd_message('OSC visibility: ' .. mode) end From e1b3bc5f52a391341c97e11392a6c3314b1ed2a8 Mon Sep 17 00:00:00 2001 From: iainsaxonhome Date: Sun, 27 Feb 2022 19:34:07 +1100 Subject: [PATCH 7/7] Highlights only for keyboardnavigation --- mordenx.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mordenx.lua b/mordenx.lua index cda4449..fd83621 100644 --- a/mordenx.lua +++ b/mordenx.lua @@ -673,7 +673,7 @@ function render_elements(master_ass) end end - if state.highlight_element == element.name then + if user_opts.keyboardnavigation and state.highlight_element == element.name then style_ass:append(osc_styles.elementHighlight) end