Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pages/Hypr Ecosystem/hyprpaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ CURRENT_WALL=$(hyprctl hyprpaper listloaded)

# Get a random wallpaper that is not the current one
WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1)
MIME_TYPE=$(file --mime-type -b "$WALLPAPER")

# if the mimetype is not an image, it probably won't load :-)
if [[ !"$MIME_TYPE" =~ ^image/ ]]; then
notify-send "WARNING" "The selected file '$WALLPAPER' is not an image (MIME type: $MIME_TYPE). Bailing out."
exit 1;
fi

# Apply the selected wallpaper
hyprctl hyprpaper reload ,"$WALLPAPER"
Expand Down