6 Commits
Author SHA1 Message Date
Vince 241d3be041 Merge pull request #251 from Alexander-Hou/fix-imagemagick-v6-compat
fix: use convert as fallback for imagemagick v6
2026-08-12 09:41:05 +08:00
Cling 964b323d7c fix: use convert as fallback for imagemagick v6 2026-02-22 05:31:28 +08:00
vinceliuice 80dd04ddf3 Fixed #249 2025-09-06 13:23:39 +08:00
vinceliuice 8f30385f55 Update README.md 2025-08-28 19:52:00 +08:00
vinceliuice 6f235a8bc5 Update install.sh 2025-08-17 12:20:45 +08:00
vinceliuice 03d8c9cf0d Fixed #247 2025-08-13 16:01:31 +08:00
2 changed files with 29 additions and 8 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ After that, you can configure the theme as shown below. In this example it is in
- Finally, run `grub-mkconfig -o /boot/grub/grub.cfg` to update your grub config - Finally, run `grub-mkconfig -o /boot/grub/grub.cfg` to update your grub config
### Setting a custom background: ### Setting a custom background:
- Make sure you have `imagemagick` installed, or at least something that provides `convert` - Make sure you have `imagemagick` installed, or at least something that provides `convert` or `magick`
- Find the resolution of your display, and make sure your background matches the resolution - Find the resolution of your display, and make sure your background matches the resolution
- 1920x1080 >> 1080p - 1920x1080 >> 1080p
- 2560x1080 >> ultrawide - 2560x1080 >> ultrawide
+26 -5
View File
@@ -1,5 +1,12 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# Define which command to use for ImageMagick
if command -v magick &> /dev/null; then
_MAGICK="magick"
else
_MAGICK="convert"
fi
# Exit Immediately if a command fails # Exit Immediately if a command fails
set -o errexit set -o errexit
@@ -116,14 +123,18 @@ generate() {
# Determine which configuration file and assets to use # Determine which configuration file and assets to use
if [[ -n "$custom_resolution" ]]; then if [[ -n "$custom_resolution" ]]; then
if has_command apt || has_command pacman || has_command eopkg; then
install_depends imagemagick
else
install_depends ImageMagick install_depends ImageMagick
fi
asset_type=$(get_asset_type "$custom_resolution") asset_type=$(get_asset_type "$custom_resolution")
cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${asset_type}.txt" "${THEME_DIR}/${theme}/theme.txt" cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${asset_type}.txt" "${THEME_DIR}/${theme}/theme.txt"
# Replace resolution in theme.txt # Replace resolution in theme.txt
sed -i "s/[0-9]\+x[0-9]\+/${custom_resolution}/" "${THEME_DIR}/${theme}/theme.txt" sed -i "s/[0-9]\+x[0-9]\+/${custom_resolution}/" "${THEME_DIR}/${theme}/theme.txt"
# Use appropriate background as base and resize it # Use appropriate background as base and resize it
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${asset_type}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg" cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${asset_type}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
magick "${THEME_DIR}/${theme}/background.jpg" -resize ${custom_resolution}^ -gravity center -extent ${custom_resolution} "${THEME_DIR}/${theme}/background.jpg" "${_MAGICK}" "${THEME_DIR}/${theme}/background.jpg" -resize ${custom_resolution}^ -gravity center -extent ${custom_resolution} "${THEME_DIR}/${theme}/background.jpg"
else else
cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${screen}.txt" "${THEME_DIR}/${theme}/theme.txt" cp -a --no-preserve=ownership "${REO_DIR}/config/theme-${screen}.txt" "${THEME_DIR}/${theme}/theme.txt"
cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${screen}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg" cp -a --no-preserve=ownership "${REO_DIR}/backgrounds/${screen}/background-${theme}.jpg" "${THEME_DIR}/${theme}/background.jpg"
@@ -131,10 +142,14 @@ generate() {
# Use custom background.jpg as grub background image # Use custom background.jpg as grub background image
if [[ -f "${REO_DIR}/background.jpg" ]]; then if [[ -f "${REO_DIR}/background.jpg" ]]; then
if has_command apt || has_command pacman || has_command eopkg; then
install_depends imagemagick
else
install_depends ImageMagick install_depends ImageMagick
fi
prompt -w "\n Using custom background.jpg as grub background image..." prompt -w "\n Using custom background.jpg as grub background image..."
cp -a --no-preserve=ownership "${REO_DIR}/background.jpg" "${THEME_DIR}/${theme}/background.jpg" cp -a --no-preserve=ownership "${REO_DIR}/background.jpg" "${THEME_DIR}/${theme}/background.jpg"
magick -auto-orient "${THEME_DIR}/${theme}/background.jpg" "${THEME_DIR}/${theme}/background.jpg" "${_MAGICK}" "${THEME_DIR}/${theme}/background.jpg" -auto-orient "${THEME_DIR}/${theme}/background.jpg"
fi fi
# Determine which assets to use based on custom resolution or screen # Determine which assets to use based on custom resolution or screen
@@ -436,15 +451,21 @@ updating_grub() {
function install_program () { function install_program () {
if has_command zypper; then if has_command zypper; then
zypper in "$@" zypper in -y "$@"
elif has_command swupd; then
swupd bundle-add "$@"
elif has_command apt-get; then elif has_command apt-get; then
apt-get install "$@" apt-get install "$@"
elif has_command dnf; then elif has_command dnf; then
dnf install -y "$@" dnf install -y "$@"
elif has_command yum; then elif has_command yum; then
yum install "$@" yum install -y "$@"
elif has_command pacman; then elif has_command pacman; then
pacman -S --noconfirm "$@" pacman -Syyu --noconfirm --needed "$@"
elif has_command xbps-install; then
xbps-install -Sy "$@"
elif has_command eopkg; then
eopkg -y install "$@"
fi fi
} }