hyprwm / hyprlock

Hyprland's GPU-accelerated screen locking utility
BSD 3-Clause "New" or "Revised" License
804 stars 59 forks source link

Possible to reload background image? #290

Open se7en-x230 opened 6 months ago

se7en-x230 commented 6 months ago

Image: is reloading but Background does not have this ability?

fjueic commented 6 months ago

@se7en-x230 i used image and got this result downside: no blur noise and other background only features the interval was set to 1 sec making it a bit laggy

1714749440.webm

mahaveergurjar commented 5 months ago

How to due this @fjueic

mahaveergurjar commented 5 months ago

I need this for my music hyprlock layout I add my background music album but the background to reload I need to unlock and lock then background reload

mahaveergurjar commented 5 months ago

240511_12h48m10s_screenshot 240511_12h48m27s_screenshot 240511_12h48m38s_screenshot

mahaveergurjar commented 5 months ago

In second picture you see the background not change ACC. to album background

fjueic commented 5 months ago

its in wiki here reload time and reload cmd

never tried it:- reload time 0 if you want to handle it yourself instead of reloading every certain time interval

pkill -USR1 hyprlock to reload

fjueic commented 5 months ago

as for changing background image i dont think you can

in my example

i used image and got this result

i did not used background i just used a image and make it cover entire screen but that way you will lose blur

mahaveergurjar commented 5 months ago

Okay but any way to reloading background because if image used for background then blur not achieve

mahaveergurjar commented 5 months ago

https://github.com/hyprwm/hyprlock/assets/57872034/98021ce5-d073-4bf8-916a-262adfd11c54

mahaveergurjar commented 5 months ago

how to set image ratio to set fit the image in 1920X1080 @fjueic

mahaveergurjar commented 5 months ago

I achieve blur but image ratio not acc. to 1920x1080

https://github.com/hyprwm/hyprlock/assets/57872034/a9ec8fdb-7e4e-41a8-8124-86b6f5ac82d3

fjueic commented 5 months ago

like this? Untitled-2024-02-03-2159

fjueic commented 5 months ago

how did you achieve blur?

mahaveergurjar commented 5 months ago

i make script for this

#!/bin/env bash

THUMB=/tmp/hyde-mpris
THUMB_BLURRED=/tmp/hyde-mpris-blurred

fetch_thumb() {
artUrl=$(playerctl -p spotify metadata --format '{{mpris:artUrl}}') 
[[ "${artUrl}" = "$(cat "${THUMB}.inf")" ]] && return 0

printf "%s\n" "$artUrl" > "${THUMB}.inf"

curl -so "${THUMB}.png" "$artUrl"
convert "${THUMB}.png" -quality 50 "${THUMB}.png" && "${THUMB}.png"
  # Create blurred version
  convert "${THUMB}.png" -blur 20x20 "${THUMB_BLURRED}.png"
  pkill -USR2 hyprlock
}

{ playerctl -p spotify metadata --format '{{title}}    {{artist}}'  && fetch_thumb ;} || { rm -f "${THUMB}*" && exit 1;}
mahaveergurjar commented 5 months ago

like this? Untitled-2024-02-03-2159

How to stretch the image to cover black area

fjueic commented 5 months ago

stretch? i don't like this idea most probably there is no way to do it using hyprlock you can do this via command line tool and and store output in /tmp convert input.png -resize 1920x1080\! output.png

i don't like the idea personally

image

fjueic commented 5 months ago

i make script for this

#!/bin/env bash

THUMB=/tmp/hyde-mpris
THUMB_BLURRED=/tmp/hyde-mpris-blurred

fetch_thumb() {
artUrl=$(playerctl -p spotify metadata --format '{{mpris:artUrl}}') 
[[ "${artUrl}" = "$(cat "${THUMB}.inf")" ]] && return 0

printf "%s\n" "$artUrl" > "${THUMB}.inf"

curl -so "${THUMB}.png" "$artUrl"
convert "${THUMB}.png" -quality 50 "${THUMB}.png" && "${THUMB}.png"
  # Create blurred version
  convert "${THUMB}.png" -blur 20x20 "${THUMB_BLURRED}.png"
  pkill -USR2 hyprlock
}

{ playerctl -p spotify metadata --format '{{title}}    {{artist}}'  && fetch_thumb ;} || { rm -f "${THUMB}*" && exit 1;}

ok pre-processing i thought you did it natively

if you have a script stretching should be just one line away

mahaveergurjar commented 5 months ago

I try this and working thanks image but not see good any idea to see only zoom the center part of image to fill the screen

fjueic commented 5 months ago

convert input.png -resize 1920x1080^ -gravity center -extent 1920x1080 output.png bruh say directly if there is more pre-processing you would like to do, don't keep adding

image

mahaveergurjar commented 5 months ago

ok thanks

sluedecke commented 1 month ago

I hope this one is not forgotten ... I would love to be able to have "dynamic" images on my lock screen.

So I kindly request to have

path = background

as an option if it is possible. TIA

EDIT: an it might be a good idea to mention the PNG only in the wiki as well - took me a while to figure that out

fjueic commented 1 month ago

@sluedecke what part are you unable to do?

If you read the above comments, everything can be done. Blur and format can be pre processed

sluedecke commented 1 month ago

If you read the above comments, everything can be done. Blur and format can be pre processed

You are right, I could script all of this. But why should I, if all this application logic is already implemented in hyprlock? From my perspective it seems to be more consistent if hyprlock supports other file types than PNG for image reloading and/or if it would support reloading for the background image. Everything else (blurring, positioning, ...) is already there.

fjueic commented 1 month ago

If you read the above comments, everything can be done. Blur and format can be pre processed

You are right, I could script all of this. But why should I, if all this application logic is already implemented in hyprlock? From my perspective it seems to be more consistent if hyprlock supports other file types than PNG for image reloading and/or if it would support reloading for the background image. Everything else (blurring, positioning, ...) is already there.

fair point but I don't think anyone wants to implement it rn

this is my flow, image gets converted to png whenever i change the wallpaper variable. Note that i have hardcoded the monitor resolution.

as for blur and changing in intervals, it should be easy. Ask me if you can stuck