-
-
Save psyke83/2a320e8b75692bc5b8cef58c8758e281 to your computer and use it in GitHub Desktop.
Console Font Tweak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This file is part of The RetroPie Project | |
# | |
# The RetroPie Project is the legal property of its developers, whose names are | |
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source. | |
# | |
# See the LICENSE.md file at the top-level directory of this distribution and | |
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md | |
# | |
rp_module_id="consolefonttweak" | |
rp_module_desc="Configure default console font size/type" | |
rp_module_section="config" | |
function config_consolefonttweak() { | |
iniConfig "=" '"' "/etc/default/console-setup" | |
iniSet "FONTFACE" "$1" | |
iniSet "FONTSIZE" "$2" | |
service console-setup restart | |
# force font configuration update if running from a pseudo-terminal | |
[ "$(tty | egrep '/dev/tty[1-6]')" == "" ] && setupcon -f --force | |
[ "$3" != "quiet" ] && printMsgs "dialog" "New font configuration applied: $1 $2" | |
} | |
function install_consolefonttweak() { | |
config_consolefonttweak "TerminusBold" "14x28" "quiet" | |
} | |
function remove_consolefonttweak() { | |
config_consolefonttweak "Fixed" "8x16" "quiet" | |
} | |
function gui_consolefonttweak() { | |
local fontface | |
local fontsize | |
local cmd | |
local options | |
local choices | |
iniConfig "=" '"' "/etc/default/console-setup" | |
iniGet "FONTFACE" | |
fontface="$ini_value" | |
iniGet "FONTSIZE" | |
fontsize="$ini_value" | |
cmd=(dialog --backtitle "$__backtitle" --menu "Choose the desired console font configuration: \n(Current configuration: $fontface $fontsize)" 22 86 16) | |
options=( | |
1 "Large (VGA 16x32)" | |
2 "Large (TerminusBold 16x32)" | |
3 "Medium (VGA 16x28)" | |
4 "Medium (TerminusBold 14x28)" | |
5 "Default (Fixed 8x16)" | |
) | |
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) | |
if [[ -n "$choices" ]]; then | |
case $choices in | |
1) | |
config_consolefonttweak "VGA" "16x32" | |
;; | |
2) | |
config_consolefonttweak "TerminusBold" "16x32" | |
;; | |
3) | |
config_consolefonttweak "VGA" "16x28" | |
;; | |
4) | |
config_consolefonttweak "TerminusBold" "14x28" | |
;; | |
5) | |
config_consolefonttweak "Fixed" "8x16" | |
;; | |
esac | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment