archboot/usr/bin/archboot-detect-vconsole.sh

31 lines
978 B
Bash
Raw Permalink Normal View History

2023-11-18 17:20:34 +01:00
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
2023-11-19 18:27:13 +01:00
# archboot-detect-vconsole.sh:
2023-11-18 21:25:48 +01:00
# sets bigger font on bigger display resolutions
# by Tobias Powalowski <tpowa@archlinux.org>
2023-11-18 17:20:34 +01:00
#
2024-08-01 12:32:39 +02:00
. /usr/lib/archboot/common.sh
2024-08-01 12:34:52 +02:00
_usage() {
2024-08-01 12:32:39 +02:00
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Detect Big Screen\e[m"
2024-08-01 17:54:50 +02:00
echo -e "\e[1m----------------------------\e[m"
2024-08-01 12:32:39 +02:00
echo "Detect big screen on boot and change to bigger font afterwards."
echo ""
echo -e "Usage: \e[1m${_BASENAME} run\e[m"
exit 0
}
[[ -z "${1}" || "${1}" != "run" ]] && _usage
_root_check
# wait for modules to initialize completely
2023-11-20 21:27:23 +01:00
udevadm wait --settle /dev/fb0
2023-11-18 21:48:54 +01:00
# get screen setting mode from /sys
_FB_SIZE="$(rg -o ':(.*)x' -r '$1' /sys/class/graphics/fb0/modes 2>/dev/null)"
2023-11-20 13:52:19 +01:00
if [[ "${_FB_SIZE}" -gt '1900' ]]; then
_SIZE="32"
2023-11-18 17:20:34 +01:00
else
2023-11-20 13:52:19 +01:00
_SIZE="16"
2023-11-18 17:20:34 +01:00
fi
2023-11-18 21:48:54 +01:00
# update vconsole.conf accordingly
2023-11-18 17:20:34 +01:00
echo KEYMAP=us >/etc/vconsole.conf
2023-11-20 13:52:19 +01:00
echo FONT=ter-v${_SIZE}n >>/etc/vconsole.conf
2023-11-19 09:39:38 +01:00
/lib/systemd/systemd-vconsole-setup