Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color issues when running the program under a systemd service #45

Closed
ynerant opened this issue May 4, 2022 · 6 comments
Closed

Color issues when running the program under a systemd service #45

ynerant opened this issue May 4, 2022 · 6 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@ynerant
Copy link

ynerant commented May 4, 2022

Hi!

First, thanks for the great framework to make pretty terminal applications :)

I am currently working on a SSH application, using Wish and BubbleTea. In particular, I am using somewhere a colored progress bar. This is working well.

To manage and start properly my application, I am using a simple systemd service:

[Unit]
Description=My SSH application
After=network.target

[Service]
ExecStart=/path/to/binary
WorkingDirectory=/path/to/
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target

And when I start this service, the SSH server is working well, but my terminal has no color, all is black and white. This happens only when I run the application through the systemd service. When I manually launch the binary, the colors are well displayed.

Do you know the origin of the issue, and how to fix it? I don't really want to keep my application opened in a tmux :D

@caarlos0
Copy link
Member

are you using the bubbletea middleware? it does set a color profile, so that should work
https://github.com/charmbracelet/wish/blob/main/bubbletea/tea.go#L39

@bashbunni
Copy link
Member

@aymanbagabas is this related to charmbracelet/bubbles#152 do you think? Seems similar to a discussion I saw in the Slack 🤔

@bashbunni bashbunni added bug Something isn't working question Further information is requested labels May 23, 2022
@taigrr
Copy link

taigrr commented May 24, 2022

Related PR: muesli/termenv#81

For an example of how to do autodetection of clients using wish and passing through to lipgloss, see ssh-wars

Note that I forked and modified bubbles and lipgloss, so check my go.mod for replace directives

@caarlos0
Copy link
Member

caarlos0 commented Sep 27, 2022

fwiw, for now you can force a profile: https://github.com/charmbracelet/wish/blob/v0.5.0/bubbletea/tea.go#L46

Keep in mind it will apply to all sessions though

@caarlos0
Copy link
Member

FWIW just to clarify: you can use wish.MiddlewareWithColorProfile to force a color profile for all sessions in the meantime.

@caarlos0
Copy link
Member

this should be fixed by #197 (on main)

example: 0337c4b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants