Skip to content

Commit

Permalink
Add toggle hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalikL committed May 10, 2024
1 parent a0a2f99 commit 6f04e52
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions script.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,43 @@ function hotkey_callback_next(pressed)
print("Hotkey Pressed - URL Updated")
end
end
function hotkey_callback_toggle(pressed)
if pressed then
if selected_source_name then
send_hotkey_tbs1(selected_source_name, "OBS_KEY_SPACE", false)
end
print("Hotkey Pressed - URL Updated")
end
end

function script_load(settings)
hotkey_id_prev = obslua.obs_hotkey_register_frontend("update_browser_url_hotkey_prev", "SDA Hymnal Prev", hotkey_callback_prev)
hotkey_id_next = obslua.obs_hotkey_register_frontend("update_browser_url_hotkey_next", "SDA Hymnal Next", hotkey_callback_next)
hotkey_id_toggle = obslua.obs_hotkey_register_frontend("update_browser_url_hotkey_toggle", "SDA Hymnal Toggle Show / Hide", hotkey_callback_toggle)
local hotkey_id_prev_save_array = obslua.obs_data_get_array(settings, "update_browser_url_hotkey_prev")
local hotkey_id_next_save_array = obslua.obs_data_get_array(settings, "update_browser_url_hotkey_next")
local hotkey_id_toggle_save_array = obslua.obs_data_get_array(settings, "update_browser_url_hotkey_toggle")

obslua.obs_hotkey_load(hotkey_id_prev, hotkey_id_prev_save_array)
obslua.obs_hotkey_load(hotkey_id_next, hotkey_id_next_save_array)
obslua.obs_hotkey_load(hotkey_id_toggle, hotkey_id_toggle_save_array)
obslua.obs_data_array_release(hotkey_id_prev_save_array)
obslua.obs_data_array_release(hotkey_id_next_save_array)
obslua.obs_data_array_release(hotkey_id_toggle_save_array)
end

function script_save(settings)
local hotkey_save_array_prev = obslua.obs_hotkey_save(hotkey_id_prev)
local hotkey_save_array_next = obslua.obs_hotkey_save(hotkey_id_next)
local hotkey_save_array_toggle = obslua.obs_hotkey_save(hotkey_id_toggle)

obslua.obs_data_set_array(settings, "update_browser_url_hotkey_prev", hotkey_save_array_prev)
obslua.obs_data_set_array(settings, "update_browser_url_hotkey_next", hotkey_save_array_next)
obslua.obs_data_set_array(settings, "update_browser_url_hotkey_toggle", hotkey_save_array_toggle)

obslua.obs_data_array_release(hotkey_save_array_prev)
obslua.obs_data_array_release(hotkey_save_array_next)
obslua.obs_data_array_release(hotkey_save_array_toggle)
end


Expand Down

0 comments on commit 6f04e52

Please sign in to comment.