From ce808913ec7b1acbe181742624b8ebde42ddafad Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Tue, 26 Aug 2025 18:54:00 +0200 Subject: [PATCH] Detect resolution for grub2 themes --- mymachine.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/mymachine.sh b/mymachine.sh index 5762ebb..4551dcc 100755 --- a/mymachine.sh +++ b/mymachine.sh @@ -193,14 +193,21 @@ fi # Install dotfiles, without overwriting source "${script_dir}/dotfiles.sh" -# Setup GRUB theme +# Setup GRUB theme, detecting screen resolution echo "Setting up GRUB theme..." +Xaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1) +if [ $? -ne 0 ]; then + Xaxis=1920 +fi +Yaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2) +if [ $? -ne 0 ]; then + Yaxis=1080 +fi git clone https://github.com/vinceliuice/grub2-themes >/dev/null 2>&1 if [ $? -ne 0 ]; then echo -e "${BRed}Could not download grub2 theme. Skipping.${NC}" else - # TODO: auto-detect screen resolution - cd grub2-themes && chmod +x install.sh && ./install.sh -t vimix >/dev/null 2>&1 && cd .. + cd grub2-themes && chmod +x install.sh && ./install.sh -t vimix -c ${Xaxis}x${Yaxis} >/dev/null 2>&1 && cd .. if [ $? -ne 0 ]; then echo -e "${BRed}Could not install grub2 theme. Skipping.${NC}" fi