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

Custom palette support #39

Closed
Aetf opened this issue Feb 19, 2022 · 4 comments · Fixed by #40
Closed

Custom palette support #39

Aetf opened this issue Feb 19, 2022 · 4 comments · Fixed by #40
Milestone

Comments

@Aetf
Copy link
Owner

Aetf commented Feb 19, 2022

Aetf/libtsm#19.

The support has in libtsm for a while, but it needs support from kmscon side to feed the palette to libtsm.

Some ways to do it

  • Include an option in kmscon.conf that defines the palette at start up
  • support the OSC sequence ESC ] P nrrggbb to set the RGB value of individual color in the palette, same as the linux console.
@viccie30
Copy link

I don't know if you've already worked on this, but I would like to have a go at this if not.

My personal idea would be to do both: allow a default custom palette in kmscon.conf and allow changing on the fly through escape codes. I think that would have to be implemented on the side of libtsm then?

@Aetf
Copy link
Owner Author

Aetf commented Feb 21, 2022

Feel free to take this 😄

libtsm already has the necessary bits for both. There's tsm_vte_set_osc_cb that can be set from kmscon to handle any OSC sequences. The gtktsm example uses it to handle title changes. kmscon can call tsm_vte_set_custom_palette during the OSC callback to change colors.

@viccie30
Copy link

Libtsm definitely has the necessary bits to enable a custom palette from kmscon.conf. It nearly has everything to support the Linux code as well, except for one bit.

libtsm rightfully expects every OSC sequence to end with either '\x07' or '\9C' (https://github.com/Aetf/libtsm/blob/4faef1e0a04b54eefbd2245abeea197a702e2086/src/tsm/tsm-vte.c#L2335-L2338). https://man7.org/linux/man-pages/man4/console_codes.4.html calls out an issue with the Linux palette set and reset sequences: they don't need to end on ST ('\x9C'). Like xterm, libtsm would mishandle these sequences without special treatment. Is this something you'd want added to libtsm in some way? Or just not support this and just set palettes from the configuration file?

The other issue is related to the Linux palette reset sequence. Except for a custom palette, there is no way for kmscon to reset the palette to the defaults for a built-in libtsm palette. Either kmscon should be able to query the current palette or the default palette from libtsm, or the whole machinery should be added to libtsm after all.

@Aetf
Copy link
Owner Author

Aetf commented Feb 22, 2022

Let's forget about it then. Setting a custom palette from the config file should be good enough for most use cases.

@Aetf Aetf added this to the kmscon-9 milestone Apr 28, 2022
@Aetf Aetf closed this as completed in #40 Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants