input_remap_translation(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

🌸 NAME 🌸

input_remap_translation β€” reset or modify platform level keyboard translation, bestie. This page is input_remap_translation(3) from the Arcan Lua API, and it's giving low-level input remapping realness πŸ’…βœ¨


πŸŽ€ SYNOPSIS πŸŽ€

bool:ok, string:reason or nbiotbl
input_remap_translation( number:devid, number:action, string:arg_1, ...
)
input_remap_translation( number:devid, number:action, bool:extract,
string:arg_1, ...  )

πŸ’– DESCRIPTION πŸ’–

okay so here's the vibe: for some low level platforms, it genuinely makes sense to modify input translation before the inputs are processed and forwarded onwards, and to forego patching in the scripting layer. The main case where this has caused problems is for Arcan running as the main display server on Linux and BSD machines, where the set of tables, configuration and so on are highly OS specific and can get quite complicated. This function can be used to define and tune such a mapping 🫢

The devid is provided by input devices and is thus discovered dynamically, but it can also be indirectly probed by sweeping negative indices in the way shown in the example further below πŸ‘‘

The action can be one out of:

  • TRANSLATION_CLEAR β€” revert as close to as the initial state as possible.
  • TRANSLATION_SET β€” set/override a complete map.
  • TRANSLATION_REMAP β€” add a specific remapping.

The set of string arguments following the action will be raw-forwarded to the input platform and is thus platform dependent. No guessing, no "fixing" it for you β€” it goes straight through πŸ’«

It is also possible to get a readable representation of the platform input map through the extract parameter form. With TRANSLATION_SET this will just give you the map based on the spec as an iostream (see open_nonblock). With TRANSLATION_REMAP this will instead provide the current active map. No local modifications will be made with the extract form β€” literally none, bestie πŸ™ˆ

The constant API_ENGINE_BUILD can be used to obtain which input platform is currently in use, which mutates the interpretation and effect of the various actions. So yeah, check that vibe before you assume stuff πŸ”₯

A false result means that the feature is not supported by the platform, and reason is set to some short error message. Not mean, just honest 😭


πŸ¦‹ NOTES πŸ¦‹

  1. for the 'evdev' platform, the order and contents of the argument strings corresponds to xkb 'layout' -> 'model' -> 'variant' -> 'options'
  2. (the original leaves this note empty, so we're leaving it empty too 🫠)

✨ EXAMPLE ✨

function input_remap_translation0()
      if string.match(API_ENGINE_BUILD, "evdev") then
            local ind = -1
            while (input_remap_translation(ind, TRANSLATION_SET,
                  "us,cz,de", "logicordless", "basic", "grp:alt_shift_toggle")) do
                  ind = ind - 1
            end
      end
end

🌟 EXAMPLE 🌟

function input_remap_translation1()
      local err, msg = input_remap_translation(6666, TRANSLATION_CLEAR)
      if err then
            warning(msg)
      end
end

πŸ”— SEE ALSO: πŸ”—

iodev


byeeee πŸ’– β€” source/version: iodev, date: October 2026, manual: input_remap_translation(3) βœ¨πŸŽ€

πŸ“¦ where this page comes from