2024-11-15 13:04:36 +01:00
#!/bin/sh
2024-11-15 14:31:15 +01:00
2024-11-17 11:38:47 +01:00
# Function to detect if the system is Ubuntu
is_ubuntu( ) {
[ -f /etc/os-release ] && grep -qi 'ubuntu' /etc/os-release
}
2024-11-18 08:45:20 +01:00
# Function to detect screen resolution and set font size
set_font_size( ) {
resolution = $( xdpyinfo | grep dimensions | awk '{print $2}' )
width = $( echo $resolution | cut -d 'x' -f 1)
2024-11-18 08:59:36 +01:00
# Do not change this font size, it actually makes i3blocks unbearable to look at:
# Icons (like for slack) are too small and i3blocks are too big
# Network monitor jumping becomes annoying
2024-11-18 08:45:20 +01:00
if [ " $width " -gt 1920 ] ; then
2024-11-18 08:59:36 +01:00
echo "8"
2024-11-18 08:45:20 +01:00
else
echo "8"
fi
}
2024-11-15 14:31:15 +01:00
# Check if Intel GPU is detected
if lspci | grep -i 'vga' | grep -i 'intel' ; then
2024-11-17 11:38:47 +01:00
if is_ubuntu; then
sudo apt-get update
sudo apt-get install -y intel-gpu-tools
sudo setcap cap_perfmon+ep /usr/bin/intel_gpu_top
else
yes | sudo pacman -S --needed intel-gpu-tools
sudo setcap cap_perfmon+ep /usr/bin/intel_gpu_top
fi
fi
if is_ubuntu; then
sudo apt-get update
2024-11-18 08:16:27 +01:00
sudo apt-get install -y fonts-dejavu-core fonts-noto fonts-font-awesome bc jq iw
2024-11-17 11:38:47 +01:00
else
yes | sudo pacman -S --needed ttf-dejavu noto-fonts ttf-font-awesome bc jq iw
2024-11-15 14:31:15 +01:00
fi
2024-11-18 08:45:20 +01:00
# Set font size based on screen resolution
font_size = $( set_font_size)
2024-11-15 13:04:36 +01:00
cp -r i3blocks ~/.config/
cp -r i3 ~/.config/
2024-11-18 08:45:20 +01:00
sed -i " s/font pango:System San Francisco Display, FontAwesome [0-9]*/font pango:System San Francisco Display, FontAwesome $font_size / " ~/.config/i3/config
2024-11-15 14:31:15 +01:00
i3-msg reload