From 6c08422615c98ca66cf8f5f7fb4c2beae7b88466 Mon Sep 17 00:00:00 2001 From: Justawildwolf <62820836+blusewill@users.noreply.github.com> Date: Tue, 1 Oct 2024 06:21:15 +0800 Subject: [PATCH] New Feature : Setting Default TTY Fonts to Terminus Fonts (#698) * Terminus Fonts TTY Setup * Update the dectection of the Terminus Fonts * Undo the Commit * Update Fedora Path * Fixing Fedora issues * Fix Fedora issues * Switch to another method * Fix Debian Message and Add Change to Terminus Font after Applied * Update tty command * Randomly trying things to see if it work or not * Adding Debug messages * Remove Debug Command and specifiy tty terminal * Fix the setfont issue * Set only tty1 to terminus font * Execute using sudo * Remove Debug Messages * Add comment for easy to understand * Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski * Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski * Update the Docs and Fixing the Typo by @adamperkowski * From Utilitys to System Setup * Update core/tabs/system-setup/tab_data.toml Co-authored-by: Adam Perkowski * Remove Comments --------- Co-authored-by: Adam Perkowski --- core/tabs/system-setup/tab_data.toml | 6 +++ core/tabs/system-setup/terminus-tty.sh | 62 ++++++++++++++++++++++++++ docs/userguide.md | 1 + 3 files changed, 69 insertions(+) create mode 100755 core/tabs/system-setup/terminus-tty.sh diff --git a/core/tabs/system-setup/tab_data.toml b/core/tabs/system-setup/tab_data.toml index b95d4730..080c06d9 100644 --- a/core/tabs/system-setup/tab_data.toml +++ b/core/tabs/system-setup/tab_data.toml @@ -100,3 +100,9 @@ name = "Remove Snaps" description = "This script is designed to remove snap" script = "remove-snaps.sh" task_list = "RP" + +[[data]] +name = "TTY Fonts" +description = "This Script will set the default TTY font to Terminus size 32 Bold" +script = "terminus-tty.sh" +task_list = "I PFM" diff --git a/core/tabs/system-setup/terminus-tty.sh b/core/tabs/system-setup/terminus-tty.sh new file mode 100755 index 00000000..16a8f3b0 --- /dev/null +++ b/core/tabs/system-setup/terminus-tty.sh @@ -0,0 +1,62 @@ +#!/bin/sh -e + +. ../common-script.sh +InstallTermiusFonts() { + if [ ! -f "/usr/share/kbd/consolefonts/ter-c18b.psf.gz" ] && + [ ! -f "/usr/share/consolefonts/Uni3-TerminusBold18x10.psf.gz" ] && + [ ! -f "/usr/lib/kbd/consolefonts/ter-p32n.psf.gz" ]; then + printf "%b\n" "${YELLOW}Installing Terminus Fonts...${RC}" + case "$PACKAGER" in + pacman) + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm terminus-font + ;; + apt-get|nala) + "$ESCALATION_TOOL" "$PACKAGER" install -y fonts-terminus + ;; + dnf) + "$ESCALATION_TOOL" "$PACKAGER" install -y terminus-fonts-console + ;; + esac + else + printf "%b\n" "${GREEN}Terminus Fonts is already installed.${RC}" + fi +} + +SetTermiusFonts() { + case "$DTYPE" in + arch) + printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}" + "$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf + if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then + "$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b + fi + printf "%b\n" "${GREEN}Terminus font set for TTY.${RC}" + ;; + debian) + + printf "%b\n" "${YELLOW}Updating console-setup configuration...${RC}" + "$ESCALATION_TOOL" sed -i 's/^CODESET=.*/CODESET="guess"/' /etc/default/console-setup + "$ESCALATION_TOOL" sed -i 's/^FONTFACE=.*/FONTFACE="TerminusBold"/' /etc/default/console-setup + "$ESCALATION_TOOL" sed -i 's/^FONTSIZE=.*/FONTSIZE="16x32"/' /etc/default/console-setup + printf "%b\n" "${GREEN}Console-setup configuration updated for Terminus font.${RC}" + # Editing console-setup requires initramfs to be regenerated + "$ESCALATION_TOOL" update-initramfs -u + if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then + "$ESCALATION_TOOL" setfont -C /dev/tty1 /usr/share/consolefonts/Uni3-TerminusBold32x16.psf.gz + fi + printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}" + ;; + fedora) + printf "%b\n" "${YELLOW}Updating FONT= line in /etc/vconsole.conf...${RC}" + "$ESCALATION_TOOL" sed -i 's/^FONT=.*/FONT=ter-v32b/' /etc/vconsole.conf + if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ]; then + "$ESCALATION_TOOL" setfont -C /dev/tty1 ter-v32b + fi + printf "%b\n" "${GREEN}Terminus font has been set for TTY.${RC}" + ;; + esac +} + +checkEnv +InstallTermiusFonts +SetTermiusFonts diff --git a/docs/userguide.md b/docs/userguide.md index b72a9aa0..ede99331 100644 --- a/docs/userguide.md +++ b/docs/userguide.md @@ -8,6 +8,7 @@ - **Gaming Setup**: Configures Steam, Lutris, etc. - **Global Theming**: Sets up and manages global themes. - **Remove Snaps**: Removes snap packages. +- **TTY Fonts**: This Script will set the default TTY font to Terminus size 32 Bold ### Arch Setup