Write the contents of a .conf file into a variable located in a separate .conf file
3
votes
1
answer
174
views
I am configuring my hyprland.conf file and I am attempting to do it in a clean and modular fashion. I am trying for a modular fashion so that I can share my dotfiles and someone else can change which components they are using without directly modifying the hyprland.conf file. Near the top of my hyprland.conf file I would like to create variables for use in other parts of the file, such as the keybindings. If I explicitly set the variables, such as $terminal = kitty, they work fine. However, when I attempt to populate the variable with the contents of a separate .conf file, it doesn't seem to populate.
The terminal.conf file that I am attempting to retrieve the contents of contains only the following:
kitty
The code I am using to populate the variable in my hyprland.conf file is as follows:
exec-once = export TERMINAL="$(cat ~/.config/hypr/settings/terminal.conf)"
If I open a terminal and enter
echo "$(cat ~/.config/hypr/settings/terminal.conf)"
I get
kitty
as a response, which is what I am expecting to see in the variable.
For the keybinding section of my hyprland.conf file, I am attempting to use the variable as follows:
bind = SUPER, T, exec, "$TERMINAL"
However, when I use that keybind to open a terminal, nothing happens. Therefore, I attempted to check the contents of the $TERMINAL variable in my hyprland.conf file by executing the following command:
exec = echo "$TERMINAL" >> ~/.config/hypr/hyprland.conf
All it adds to the file are empty lines. What am I doing wrong?
Asked by PrismaPixel Studios
(221 rep)
Dec 11, 2024, 07:43 PM
Last activity: Dec 11, 2024, 08:07 PM
Last activity: Dec 11, 2024, 08:07 PM