Announcement

Collapse
No announcement yet.

How To fix tiny GRUB menus and TTY size when using 4k screens.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To fix tiny GRUB menus and TTY size when using 4k screens.

    I use dual 28" 4k monitors and I got tired of leaning in and squinting when I need to do something with my grub menu, so I set out to enlarge the menu size. At the same time I decided to make the TTY terminal more readable for the same reason.

    To make it complicated, I have a nested grub setup; Initial boot goes to a dedicated grub install which lets me select another grub menu from another install to boot from, and my primary distro is KDEneon which uses a GRUB theme making things more difficult.

    First the TTY terminal:
    For both installs, the solution is easy. Edit /etc/default/console-setup and change FONTSIZE="8x16" to FONTSIZE="16x32" and reboot. That's it.

    Next, the dedicated grub install menu:
    This one was fairly easy since it's basic grub.​

    First, I made a new font to use with grub. I picked "Dejavu-sans". To make a grub font this command is needed:

    sudo grub-mkfont -s 32 -o /boot/grub/dejavu-sans-mono.pf2 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

    The "-s 32" means 32 point size font. If you prefer the default grub font - Unicode - you'll have to get a TTF version of it to convert to pf2. I wasn't able to easily locate the Unicode TTF file, so I decided on DejaVu instead.

    Then I edited /etc/default/grub and added this line:

    GRUB_FONT=/boot/grub/fonts/dejavu-sans-mono.pf2

    I also have my GRUB_GFXMODE set to 3840x2160

    Now update grub;

    sudo update-grub

    and reboot. Now my grub install has a nice easily readable menu in 4k.

    Finally, the grub theme in KDEneon:

    **NOTE** This part is very "hacky" so have a backup and a plan to restore the original file if things break! You've been warned!**


    KDEneon uses the "breeze" theme to control it's menu look. This is more complicated to enlarge. The theme look is defined in: /boot/grub/themes/breeze/theme.txt

    This file contains sizes and fonts and spacing and lots of other stuff. I made a backup of the original file then tore into it.

    This theme uses 3 Unicode fonts: Regular 14, Regular 16, and Bold 16. Again, not having easy access to the Unicode family, I decided to use "Hack". It has the needed Regular and Bold options and is a simple font. I decided to just double the sizes and see how it looked. This time, I made three grub fonts:
    sudo grub-mkfont -s 32 -o /boot/grub/themes/breeze/hack-bold-32.pf2 /usr/share/fonts/truetype/hack/Hack-Bold.ttf
    sudo grub-mkfont -s 32 -o /boot/grub/themes/breeze/hack-regular-32.pf2 /usr/share/fonts/truetype/hack/Hack-Regular.ttf
    sudo grub-mkfont -s 28 -o /boot/grub/themes/breeze/hack-regular-28.pf2 /usr/share/fonts/truetype/hack/Hack-Regular.ttf

    ​Now I had my three fonts. I put them in the same folder as the theme Unicode fonts.

    Now to editing the theme file:

    First I replaced these:
    Code:
    "Unifont Regular 14"
    "Unifont Regular 16"
    "Unifont Bold 16"
    with these:
    Code:
    "Hack Regular 28"
    "Hack Regular 32"
    "Hack Bold 32"
    I noticed the theme file had several lines in the "Show text progress bar" that set some sizes - all nicely commented so I could see them right away.

    Code:
    top = 50%+66 # (50+16) half menu + spacer
    width = 400 # same as menu
    height = 19 # 14pt
    so I doubled the parts that seemed like the font would have a effect on.

    Code:
    top = 50%+82 # (50+32) half menu + spacer
    width = 800 # same as menu
    height = 38 # 28pt
    and left it at that. Ran sudo update-grub to lock it in and make sure I didn't muck anything up, and rebooted.

    The results:
    Before:
    Click image for larger version  Name:	neongrub-old-crop.jpg Views:	56 Size:	24.0 KB ID:	678160

    After:
    Click image for larger version  Name:	neongrub-new-crop.jpg Views:	52 Size:	34.7 KB ID:	678161

    The size is MUCH better but the not all the menu items got placed correctly. I need to widen the menu space and center the timer. Otherwise, I'm very happy.
    Last edited by oshunluvr; May 15, 2024, 09:44 AM.

    Please Read Me

    #2
    This is better:
    Click image for larger version

Name:	PXL_20240412_154003800.jpg
Views:	393
Size:	43.9 KB
ID:	678165

    Please Read Me

    Comment


      #3
      A bit of a shame that Kubuntu does not provide its own GRUB theme for this case AFAIK (or does it?) - in Linux Mint for example one could either install grub2-theme-mint-2k for this case or install grub2-theme-mint for monitors with lower resolutions…
      Last edited by Schwarzer Kater; Apr 13, 2024, 02:52 AM.
      Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
      Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

      get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
      install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

      Comment

      Working...
      X