How to access "Current Renoise" KeyBindings.xml?

hi, i wanna know how do i access the current Renoise KeyBindings.xml? it is stored, on macOS, at:

/Users/esaruoho/Library/Preferences/Renoise/V3.4.4/KeyBindings.xml

but i wanna get to there with a script. i mean, get the “path to KeyBindings.xml”.
cos i wanna show something from it.

okay, so, i need to figure out what the Linux or Windows paths are for these.

i don’t have linux or windows so i can’t verify, but does this work?

 (in windows: C/Users/THE_USER/AppData/Roaming/Renoise/V3.1.1/KeyBindings.xml)

what is the linux equivalent, please?

the method for creating the correct KeyBindings.xml url seems to be:

print (renoise.RENOISE_VERSION)

which for me outputs

3.4.4

so this coupled with

>>> oprint (os.getenv( "HOME" ))
/Users/esaruoho

lets me get to <home>/Library/Preferences/Renoise/V<version>/KeyBindings.xml

now how do i do the rest for windows + linux, please?
do i really need to guess what the path is?

There’s a notion of environment variable in Windows too, it’s referenced in %AppData% for this case.

Don’t guess it, as it’s not always on the same folder in C:\ drive

1 Like

I think roughly modern Linux deploys the Renoise configuration directory here.

  • $XDG_CONFIG_HOME/Renoise/V3.4.4

The environment variable $XDG_CONFIG_HOME can be specified by the user, but the default value is here if nothing is done.

  • ~/.config/Renoise/V3.4.4

https://wiki.archlinux.org/title/XDG_Base_Directory#User_directories

ok so the end result was this

function detectOSAndGetKeyBindingsPath()
  local os_name = os.platform()
  local renoise_version = renoise.RENOISE_VERSION
  local key_bindings_path

  if os_name == "WINDOWS" then
    local home = os.getenv("USERPROFILE") or os.getenv("HOME")
    key_bindings_path = home .. "\\AppData\\Roaming\\Renoise\\V" .. renoise_version .. "\\KeyBindings.xml"
  elseif os_name == "MACINTOSH" then
    local home = os.getenv("HOME")
    key_bindings_path = home .. "/Library/Preferences/Renoise/V" .. renoise_version .. "/KeyBindings.xml"
  else -- Assume Linux
    local home = os.getenv("HOME")
    key_bindings_path = home .. "/.config/Renoise/V" .. renoise_version .. "/KeyBindings.xml"
  end

  return key_bindings_path
end

verified as working on macOS, Linux and Windows.

Thanks y’all!

EDIT: I realize %AppData% could’ve been used, but i’ll burn that bridge when i cross it.

It is a good idea to use $HOME/.config if the value of $XDG_CONFIG_HOME does not exist.
If it does not exist there either, you should also look for $HOME/.renoise.

1 Like

hmm. now i wish i had linux/different flavors that i could try this stuff out
. i think i’m gonna have to rely on bugreports to make it work better. although maybe there’s a proper way to do this. maybe someone has already solved this elsewhere, on stackexchange or something.

But, well, I think it’s usually not a problem with modern Linux.
You may consider it after receiving a bug report.

1 Like