stylix icon indicating copy to clipboard operation
stylix copied to clipboard

limine: add target

Open boomshroom opened this issue 9 months ago • 10 comments

https://github.com/NixOS/nixpkgs/pull/386368 has been merged into nixpkgs-unstable, and it offers various style options that stylix could set, including:

  • boot.loader.limine.style.wallpapers
  • boot.loader.limine.style.wallpaperStyle
  • boot.loader.limine.style.backdrop
  • boot.loader.limine.style.graphicalTerminal.palette
  • boot.loader.limine.style.graphicalTerminal.brightPalette
  • boot.loader.limine.style.graphicalTerminal.foreground
  • boot.loader.limine.style.graphicalTerminal.background
  • boot.loader.limine.style.graphicalTerminal.brightForeground
  • boot.loader.limine.style.graphicalTerminal.brightBackground

There are a few other style options including spacing, but they don't mesh as well with stylix's existing options. The full config also has an option for font which isn't directly exposed by the module, but the font in question doesn't use a standard format so it wouldn't work with stylix's existing font options (unless it wanted to render the user's chosen font at build-time into the format expected by Limine, which would be pretty cool).

boomshroom avatar Mar 13 '25 09:03 boomshroom

We do a font conversion for the GRUB bootloader here:

https://github.com/danth/stylix/blob/5053a63c87fea3508439b7e9c1a66fa6979a4694/modules/grub/nixos.nix#L14-L32

So it should be possible to support fonts, so long as there is a program to convert from {ttf, otf} to the expected format.

danth avatar Mar 13 '25 15:03 danth

We do a font conversion for the GRUB bootloader here:

So it should be possible to support fonts, so long as there is a program to convert from {ttf, otf} to the expected format.

That's cool! Didn't know about that.

Regarding Limine, it doesn't provide any tool for converting existing fonts. It only says the format they should be in and gives a link to a repository of compatable formats:

https://github.com/limine-bootloader/limine/blob/214a5be88cdd5aa5c7e9fd1c8c8333c038ef1e49/CONFIG.md?plain=1#L128-L134

  • term_font - Path to a font file to be used instead of the default one for the menu and terminal. The font file must be a code page 437 character set comprised of 256 consecutive glyph bitmaps. Each glyph's bitmap must be expressed left to right (1 byte per row), and top to bottom (16 bytes per whole glyph by default; see term_font_size). See e.g. the VGA text mode font collection for fonts.

boomshroom avatar Mar 14 '25 00:03 boomshroom

After an initial test, I want to add that background has an extra (hex) byte for transparency. It's notably not an alpha channel, as 00 is fully opaque, and I'd assume that FF (or ff) would be fully transparent. This could be hooked into stylix's opacity settings, but would need to be subtracted from 1 first.

Which opacity setting would be best in this case? the four are desktop, terminal, popups, and applications, and it's not entirely clear which would be best at this point. (It's presented kind of like a popup, but also the desktop doesn't exist yet.)

boomshroom avatar Mar 14 '25 23:03 boomshroom

background has an extra (hex) byte for transparency... Which opacity setting would be best in this case?

in the gallery at the bottom of Limine's website, does the background opacity refer to the opacity of the cat picture or of the dark box on top of the cat?

if it is the picture itself, i would use desktop. if it is the overlay-type box, i would use either applications or popups, likely the latter, or entirely omit setting the opacity. this is an unfortunate case of "we don't have an option specific enough to do this well".

Flameopathic avatar Mar 18 '25 01:03 Flameopathic

background has an extra (hex) byte for transparency... Which opacity setting would be best in this case?

in the gallery at the bottom of Limine's website, does the background opacity refer to the opacity of the cat picture or of the dark box on top of the cat?

My initial test set it to 00, which made the menu itself opaque, revealing the background image only at the very edges of the screen.

boomshroom avatar Mar 18 '25 02:03 boomshroom

in the gallery at the bottom of Limine's website, does the background opacity refer to the opacity of the cat picture or of the dark box on top of the cat?

My initial test set it to 00, which made the menu itself opaque, revealing the background image only at the very edges of the screen.

unfortunately, it may be better that we chose a constant value here, as none of the opacity settings that we have will work well. does Limine (or nixpkgs) have a default for this?

Flameopathic avatar Mar 18 '25 19:03 Flameopathic

It looks like by default Limine uses 0x00 when no wallpaper is set (which shouldn't actually do anything) and 0x80 when a wallpaper is set. Most of my personal stylix opacity settings that aren't 100% are instead 80%, which would translate to a transparency of 0x33.

I could accept not setting the transparency from the default stylix opacity settings though, if you think it's best. The palette and wallpaper I'd consider more important to match the global stylix settings.

boomshroom avatar Mar 18 '25 20:03 boomshroom

I would venture to guess that most Stylix users don't set the opacity options, and they all default to 1.0. i don't think that the default behavior of the module should be to practically entirely hide the wallpaper, so it is likely best to simply use the Limine default.

Flameopathic avatar Mar 18 '25 22:03 Flameopathic

After successfully installing and booting with Limine, with the opacity being set based on Stylix, I can confirm that 80% opacity didn't look that great and it would've probably been better at the default 50%.

I think Stylix would still need to do something with this though since the transparency is baked into the same option as the background color, so I can see stylix either always setting the transparency to 50% (or possibly 0% if stylix.image isn't set to match Limine's defaults), and requiring the user to override the entire background option to change it, or adding its own additional option to set the transparency that defaults to 50%, and then merging that with the global theme's background color.

boomshroom avatar Mar 19 '25 20:03 boomshroom

I can see stylix either always setting the transparency to 50% (or possibly 0% if stylix.image isn't set to match Limine's defaults), and requiring the user to override the entire background option to change it, or adding its own additional option to set the transparency that defaults to 50%, and then merging that with the global theme's background color.

the latter sounds good

Flameopathic avatar Mar 19 '25 20:03 Flameopathic

@boomshroom and @Flameopathic, do you mind giving https://github.com/nix-community/stylix/pull/1952 a review? Currently, it only partially supports colors.

trueNAHO avatar Oct 30 '25 13:10 trueNAHO