You are not logged in.

#1 2026-01-09 18:47:48

Aruelyxia
Member
From: Nowhere
Registered: 2026-01-07
Posts: 9

[SOLVED] hyprlock and rofi not pulling through wallpaper images

Hi all,

Thanks in advance for taking a look at my query.

I am trying to rice Arch with a hyprland eco-system, using hyprlock, and a custom-made rofi -drun theme. The issue I'm having is that both hyprlock and rofi are failing to pull images from the path I'm setting in the config/rasi files for each respective app.

In hyprlock's case, when I run the program, the machine locks but fails to pull an image, and I get the following:

[ERR] Image /home/aruelyxia/.config/hypr/current_wallpaper could not be loaded: invalid file
[ERR] renderImage: No cairo surface!

Now the folder in question only has one wallpaper file, satellites.png - however when I set the path in the hyprlock.conf file as follows:

background {
    monitor = eDP-1
    # NOTE: use only 1 path
	#path = screenshot   # screenshot of your desktop
	#path = $HOME/.config/hypr/wallpaper_effects/.wallpaper_modified # by wallpaper effects
    path = ~/.config/hypr/current_wallpaper/satellites.png # CURRENT WALLPAPER

Hyprlock pulls through the image successfully.

What I'm looking for hyprlock to do, is to pull the most recent image from the current_wallpaper folder, rather than having to go in and specify a specific name of a file. Can anyone shed any light on how this can be done? I'm still fairly new to Arch Linux (4 days in), and I have to say a lot of the slop-tube bitching I see about how the operating system is difficult is kinda wild - I like things breaking, I like fixing things, so this has been an absolute joy, but I'm pretty stumped at this point.

With regards to rofi, I want rofi to do the same thing.

Here is a screenshot of a custom rofi menu I found from Binnewbs on github:

kozcYWOu_t.png

Again, this was done by specifying the specific wallpaper in the current_wallpaper folder in the .rasi file:

imagebox {
    padding:                     20px;
    background-color:            transparent;
    background-image:            url("~/.config/hypr/current_wallpaper/anime_skull.png", height);
    orientation:                 vertical;
    children:                    [ "inputbar", "dummy", "mode-switcher" ];
}

However if I don't do this, and just set the path to end at current_wallpaper - it doesn't find a file.

Anyone that can shed any light on this issue would be most appreciated, this has been a fantastic resource to use!

It is probably just a really silly thing I'm missing out most likely.

Aruelyxia

Last edited by Aruelyxia (2026-01-09 20:03:54)

Offline

#2 2026-01-09 19:01:54

Aruelyxia
Member
From: Nowhere
Registered: 2026-01-07
Posts: 9

Re: [SOLVED] hyprlock and rofi not pulling through wallpaper images

I've seen online using the following as a potential fix:

command_name "$(ls -t ~/.config/hypr/current_wallpaper/* | head -n 1)"

However I don't really know how to implement this properly within these config files, or if this would even work within these files.

Offline

#3 2026-01-09 19:38:46

Aruelyxia
Member
From: Nowhere
Registered: 2026-01-07
Posts: 9

Re: [SOLVED] hyprlock and rofi not pulling through wallpaper images

Another potential fix I can for see is taking the script I use for picking a wallpaper, which sends the wallpaper selected to the current_wallpaper folder, and adding something that changes the name of the symlink file created to current_wallpaper.

The code I have for this script is as follows:

#!/bin/bash

# === CONFIG ===
WALLPAPER_DIR="$HOME/Pictures/wallpapers"
SYMLINK_PATH="$HOME/.config/hypr/current_wallpaper"

cd "$WALLPAPER_DIR" || exit 1

# === handle spaces name
IFS=$'\n'

# === ICON-PREVIEW SELECTION WITH ROFI, SORTED BY NEWEST ===
SELECTED_WALL=$(for a in $(ls -t *.jpg *.png *.gif *.jpeg 2>/dev/null); do echo -en "$a\0icon\x1f$a\n"; done | rofi -dmenu -p "")
[ -z "$SELECTED_WALL" ] && exit 1
SELECTED_PATH="$WALLPAPER_DIR/$SELECTED_WALL"

# === SET WALLPAPER ===
matugen image "$SELECTED_PATH"

# === CREATE SYMLINK ===
mkdir -p "$(dirname "$SYMLINK_PATH")"
ln -sf "$SELECTED_PATH" "$SYMLINK_PATH"

Is there any code that I can add to this that would rename the symlink to current_wallpaper? Or would this complicate things as the .jpg, .jpeg, .png, .gif, and other file formats and so on would break upon renaming?

Offline

#4 2026-01-09 20:03:20

Aruelyxia
Member
From: Nowhere
Registered: 2026-01-07
Posts: 9

Re: [SOLVED] hyprlock and rofi not pulling through wallpaper images

Resolved!

I'm such a dumbass.

I didn't realise that the above code in the previous post:

# === CREATE SYMLINK ===
mkdir -p "$(dirname "$SYMLINK_PATH")"
ln -sf "$SELECTED_PATH" "$SYMLINK_PATH"

Does exactly what I was asking it to do, I had set up a current_wallpaper folder named - and instead of writing the symlink as current wallpaper, it placed it in the folder with the original file name from the Pictures/wallpapers folder.

So the fix was as simple as this:

# === CONFIG ===
WALLPAPER_DIR="$HOME/Pictures/wallpapers"
SYMLINK_PATH="$HOME/.config/hypr/current_wallpaper/current_wallpaper"

Now when running the script, it places the symlink in the current_wallpaper folder, and names it current_wallpaper.

And when changing to a new wallpaper, overwrites the symlink.

Plugging these links back into hyprlock and rofi as originally placed, they now work flawlessly.

I knew it was a silly mistake!

Thanks for anyone who was looking into this before I managed to realise what the error was. Hope people got a good chuckle at how daft this was.

Offline

Board footer

Powered by FluxBB