kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.49k stars 979 forks source link

envsubst not working with kitty.conf #4786

Closed samEngineering closed 2 years ago

samEngineering commented 2 years ago

I am attempting to pass a config file to kitty with environment variables, but kitty defaults to the default config. Here is the command:

envsubst < ~/.config/kitty/kitty.conf | kitty -c -

The type of variables in the config are of the form

color10     ${GREEN}

I checked the output of envsubst < ~/.config/kitty/kitty.conf by only setting a couple environment variables, and the output in the terminal is a correctly formatted config file. This is what the output looks like for the command above:


# Fonts
font_family          Hack Nerd Font
bold_font            auto
italic_font          auto
bold_italic_font     auto
font_size            12.0

# Grid
adjust_line_height   3
adjust_column_width  0
box_drawing_scale    0.001, 1, 1.5, 2
disable_ligatures    never

# Cursor
cursor                 white
cursor_shape           block
shell_integration      no_cursor
cursor_blink_interval  0
cursor_text_color      #111111

# Theme
foreground  #abb2bf
background  #282c34
color0      #282c34
color1      #e06c75
color2      #98c379
color3      #e5c07b
color4      #61afef
color5      #c678dd
color6      #56b6c2
color7      #abb2bf
color8      #596276
color9      #be5046
color10     #98c379
color11     #d19a66
color12     #61afef
color13     #c678dd
color14     #56b6c2
color15     #5c6370

# Scrollback
scrollback_lines         5000
wheel_scroll_multiplier  5

# Sounds
enable_audio_bell     no
window_alert_on_bell  no
bell_on_tab           no

# Window
remember_window_size        no
enabled_layouts *
draw_minimal_borders        yes
window_margin_width         0
window_padding_width        5
active_border_color         #abb2bf
inactive_border_color       #abb2bf
inactive_text_alpha         1
hide_window_decorations     yes

# System
shell                 zsh
editor                atom
term                  xterm-kitty
linux_display_server  auto

# Performance
sync_to_monitor yes

# Behavior
close_on_child_death  no
allow_remote_control  yes

# Keybindings
kitty_mod ctrl+shift
map kitty_mod+h         previous_window
map kitty_mod+l         next_window
map kitty_mod+left      previous_window
map kitty_mod+right     next_window
map kitty_mod+alt+h     move_window_backward
map kitty_mod+alt+l     move_window_forward
map kitty_mod+up        combine : scroll_line_up : scroll_line_up
map kitty_mod+down      combine : scroll_line_down : scroll_line_down
map kitty_mod+page_up   scroll_page_up
map kitty_mod+page_down scroll_page_down
map kitty_mod+end       scroll_end
map kitty_mod+plus      change_font_size all +2.0
map kitty_mod+minus     change_font_size all -2.0
map kitty_mod+backspace change_font_size all 0

I'm not sure what is going on here. Any help would be appreciated, thank you ^_^

Environment details

Arcolinux
bspwm
page-down commented 2 years ago

The config parameter does not support reading stdin. why would you think it could be used that way?

https://sw.kovidgoyal.net/kitty/invocation/

The configuration file will automatically expand the environment variables, why do you do that?

https://sw.kovidgoyal.net/kitty/conf/

Generate the configuration file from a template, check kitty --help and specify the configuration file path however you like.

samEngineering commented 2 years ago

The config parameter does not support reading stdin. why would you think it could be used that way? I use this method on every other config file, so I thought I would be able to with kitty. From my understanding, the envsubst command reads the file, expands all environment variables, and generates a new file with only strings in place of those variables. That new file is what I am passing to "kitty -c -". The config parameters are not actually reading stdin. I use this for polybar, bspwm, etc and it is successful.

The configuration file will automatically expand the environment variables, why do you do that? I'm not sure what you mean by this. I have had no luck with that, is there a certain way to write env vars in the config to achieve this?

Thanks.

On Fri, Mar 4, 2022 at 3:11 PM page-down @.***> wrote:

The config parameter does not support reading stdin. why would you think it could be used that way?

https://sw.kovidgoyal.net/kitty/invocation/

The configuration file will automatically expand the environment variables, why do you do that?

https://sw.kovidgoyal.net/kitty/conf/

Generate the configuration file from a template, check kitty --help and specify the configuration file path however you like.

— Reply to this email directly, view it on GitHub https://github.com/kovidgoyal/kitty/issues/4786#issuecomment-1059482387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHXQDBPA3Y4KLDI2NQ7QHLU6JU5NANCNFSM5P6NSSBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

samEngineering commented 2 years ago

If I do the steps separately, it works. First, I run envsubst < ~/.config/kitty/kitty.conf > temp.conf

then kitty -c temp.conf

Works as expected. But I cannot just pipe the output of envsubst directly into kitty. It will not work

On Fri, Mar 4, 2022 at 4:06 PM Sam Lee @.***> wrote:

The config parameter does not support reading stdin. why would you think it could be used that way?

I use this method on every other config file, so I thought I would be able to with kitty. From my understanding, the envsubst command reads the file, expands all environment variables, and generates a new file with only strings in place of those variables. That new file is what I am passing to "kitty -c -". The config parameters are not actually reading stdin. I use this for polybar, bspwm, etc and it is successful.

The configuration file will automatically expand the environment variables, why do you do that?

I'm not sure what you mean by this. I have had no luck with that, is there a certain way to write env vars in the config to achieve this?

Thanks.

On Fri, Mar 4, 2022 at 3:11 PM page-down @.***> wrote:

The config parameter does not support reading stdin. why would you think it could be used that way?

https://sw.kovidgoyal.net/kitty/invocation/

The configuration file will automatically expand the environment variables, why do you do that?

https://sw.kovidgoyal.net/kitty/conf/

Generate the configuration file from a template, check kitty --help and specify the configuration file path however you like.

— Reply to this email directly, view it on GitHub https://github.com/kovidgoyal/kitty/issues/4786#issuecomment-1059482387, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWHXQDBPA3Y4KLDI2NQ7QHLU6JU5NANCNFSM5P6NSSBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

kovidgoyal commented 2 years ago

You want kitty -c /dev/stdin

samEngineering commented 2 years ago

That did it! Thank you so much for the help ^_^