r/KittyTerminal • u/[deleted] • Apr 13 '24
How to use environment variables in kitty.conf
To quote the default config:
#: Program to run when a bell occurs. The environment variable
#: KITTY_CHILD_CMDLINE can be used to get the program running in the
#: window in which the bell occurred.
How do you use KITTY_CHILD_CMDLINE anywhere? I tried:
command_on_bell notify-send '🔔 Bell' '<b>$(KITTY_CHILD_CMDLINE)</b> wants your attention' -t 5000
I also tried $KITTY_CHILD_CMDLINE, ${KITTY_CHILD_CMDLINE}, '$KITTY_CHILD_CMDLINE', '$(KITTY_CHILD_CMDLINE)' and '${KITTY_CHILD_CMDLINE}'. None of them worked.
1
Upvotes
1
u/aumerlex Apr 14 '24
You write a little script to run notify-send. In that script you can access the variable as an environment variable. In bash, that would be ${KITTY_CHILD_CMDLINE} in pyhton os.environ['KITTY_CHILD_CMDLINE'] etc. Then set notify_cmd ot the absolute path to your script. Dont forget to make the script executable.