lirc-config-tool(1)

πŸ’… lirc-config-tool β€” bestie edition πŸ’…

okay so you found the lirc-config-tool(1) page, it lives in the General Commands Manual section, and honestly? it's giving "tiny script, big opinions". here's the whole thing, nothing skipped, no cap. 🫢


✨ NAME ✨

lirc-config-tool β€” the tool that scans and generates lirc config files. that's it, that's the whole job description, and it ate. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

lirc-config-tool   -s|-u [ -c FILE]

lirc-config-tool  [-o DIR] [-d] [-c FILE] [FILES]

lirc-config-tool   -l

three whole moods. pick one. ✨


🌸 OPTIONS 🌸

okay so real talk, if you run it with no options at all, it just generates all the available application specific lircrc files in ~/.config/lirc. and that optional [files] at the end? that's a list of files to build or dump, exactly as they're listed by -l. πŸ¦‹

  • -s β€” scan the lircd file for key symbols that are duplicated or not in namespace. it's the vibe check for your symbols. πŸ”
  • -u β€” update an existing lircd file so it uses key symbols that are actually in namespace. glow-up mode. πŸ’…
  • -l β€” list the available files you could generate. window shopping, no commitment. πŸ›οΈ
  • -d β€” dump the file templates to stdout, so you can use them as stdin later. it's giving "here's the raw material". πŸ“€
  • -o <dir> β€” output directory, defaults to ~/.config/lirc. 🏠
  • -c <lircd-filename> β€” the lircd(8) config file, defaults to /etc/lirc/lircd.conf. πŸ“„
  • -h β€” print the help message. the "bestie I'm lost" button. πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

so the script is designed to assist in the setup of the lirc(8) configuration files for ordinary remote controls. and like β€” it is not aimed at handling full-blown keyboards or joystick devices, so don't come for it about that. the generated lircrc files represent a starting point, which will need further, manual refinements, but might "work" in a basic sense in many cases. lowkey humble of it. 😌

the setup involves normalizing the lircd.conf to use symbols in the legal namespace, and creating application specific lircrc files which use those normalized symbols.

to assist normalizing /etc/lircd.conf, the script can report symbols used which are not in the namespace. it can also update many of these symbols to corresponding symbols within the namespace.

the script also can create application specific lircrc files, such as mythtv.lircrc or vlc.lircrc. it then uses the normalized key symbols in /etc/lirdc.conf. (yep, that's literally how it's spelled in the original, don't @ me 😭) by default, files are created in ~/.config/lirc.

generated lircrc files basically combine known keys from /etc/lirc/lircd.conf with template data for an application. the process results in a lircrc file, a list of unused keys, and some entries which don't match any existing key. the unused keys and unmatched entries get written as comments into the generated file. cute little receipts. 🧾

an 'illegal' key β€” i.e., a key not in namespace β€” will not match any entry and will thus always be unused. however, it's perfectly possible to use it later on while manually modifying the lircrc files. so it's not cancelled forever, just benched. πŸͺ‘

when updating files, the script always makes backup copies. always. every single time. queen behavior. πŸ‘‘

the generated lircrc files are intended to be included in a main ~/.config/lircrc file. a minimal such might look like

include ~/.config/lirc/mythtv.lircrc

🌈 EXAMPLES 🌈

scan /etc/lirc/lircd.conf for duplicated symbols and symbols not in namespace:

lirc-config-tool -s

update a local lircd.conf file to use symbols in namespace:

lirc-config-tool -uc ./lircd.conf

list available files to generate:

lirc-config-tool -l

generate one of the files listed by -l, creates ~/.config/lirc/mythtv.lircrc:

lirc-config-tool mythtv

dump template data for mythtv:

lirc-config-tool -d mythtv >mythtv.lircdata

use possibly edited data to create a modified mythtv.lircrc in the current dir:

lirc-config-tool -o . stdin < mythtv.lircdata

πŸ”₯ LIRCD.CONF CONVERSIONS πŸ”₯

the -s option simply reports all key symbols not in namespace. it also reports some symbols which, although legal, are inappropriate in this context β€” notably KEY_NUMERIC_0..KEY_NUMERIC_9. if present, duplicated keys are also reported. it's the "not to be shady but…" option. πŸ’€

the -u option converts several known symbols to their corresponding KEY_* symbols. symbols which have names like KEY_WINDOWS but are not in namespace get an X_ prefix, e.g., KEY_WINDOWS -> X_KEY_WINDOWS. the converted file thus guarantees that any key symbol starting with KEY_ is a legal symbol. no fakes allowed. 🚫

all known numeric keys such as '1', KEY_1, KEY_KP_1, KEY_NUMERIC_1 are converted to KEY_1. one key to rule them all. πŸ‘‘

all modifications are marked by comments in the file, so you can always see what it did. transparency, periodt. πŸ’…


🧚 EXTENDING 🧚

the script can be extended to support more applications by providing a shell function named *.lircdata. e.g., to add a new application named "my_app" based on the built-in vlc application:

$ lirc-config-tool -d vlc >my_app.lircdata
$ function my_app_lircdata()
> {
>    cat my_app.lircdata
> }
$ export -f my_app_lircdata
$ lirc-config-tool  my_app

literally building your own plugin with like six lines. main character energy fr fr. 🌟


πŸ“ DATA FORMAT πŸ“

the script uses a simple, line-oriented format to represent the lircrc files. the purpose of the format is to be compact (so you get a good overview) and also to be easy to parse. each line is divided into comma-separated tokens. there are four kinds of lines. four. count 'em. πŸ–οΈ

  • comment lines begin with a '#'. these are copied verbatim to the output file.
  • the first data line represents global items, applicable to all entries. the first word is the program name β€” it's used in the first 'program=' line. following words, if present, are optional lines which will be appended to each entry in the file.
  • a data line starting with 'begin' or 'end' is a mode block designator. it's copied verbatim to the output file.
  • all other data lines represent a button/config entry. the format is
<button> <config> [extra]...

the button value is used in the button = line, and the config item is used in the config = line. both are mandatory. following items, if any, are copied as verbatim lines to the entry.

an unlikely example: the data format

myprog, flags = quit
begin volume_mode
KEY_VOLUMEUP, volume-up, delay=4, repeat=1
KEY_VOLUMEDOWN, volume-down
end volume_mode

translates to:

begin volume_mode
    begin
        program = myprog
        button  = KEY_VOLUME_UP
        config  = volume-up
        delay   = 4
        repeat  = 1
        flags   = quit
    end
    begin
        program = myprog
        button  = KEY_VOLUME_DOWN
        config  = volume-down
        flags   = quit
    end
end volume_mode

see how it just blooms into a whole config. obsessed. 🌸


License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

NO WARRANTY bestie, I said what I said. 😀

πŸ’– SEE ALSO πŸ’–


and that's the whole page, start to finish, no notes. πŸ’œ this one's from User Commands, dated Aug 2015, and it's signed lirc-config-tool(1). go configure something gorgeous. πŸ¦‹βœ¨πŸŽ€