hyprlock icon indicating copy to clipboard operation
hyprlock copied to clipboard

Add the ability to set the image size as a percentage

Open kamack38 opened this issue 1 year ago • 11 comments

Description

Currently, only shape size can be set by a percentage and image sizes can't.

kamack38 avatar Nov 12 '24 14:11 kamack38

Yup already planned :)

PaideiaDilemma avatar Nov 12 '24 17:11 PaideiaDilemma

Have you thought about allowing percentage floats? I've been playing with the new units and I found myself missing the ability to use e.g. 43.21%.

kamack38 avatar Nov 12 '24 17:11 kamack38

what option are you talking about?

PaideiaDilemma avatar Nov 13 '24 07:11 PaideiaDilemma

Currently, I can only set the position using integer percentages e.g. 1%, 5%, 8% and not floating point percentages e.g. 1.2% 0.3% 20.22%.

kamack38 avatar Nov 13 '24 21:11 kamack38

You are right. Maybe we want to change the current implementation to just take floats instead of just integers.

PaideiaDilemma avatar Nov 14 '24 17:11 PaideiaDilemma

Currently, I can only set the position using integer percentages e.g. 1%, 5%, 8% and not floating point percentages e.g. 1.2% 0.3% 20.22%.

@kamack38 Actually that already works :)

PaideiaDilemma avatar Dec 19 '24 09:12 PaideiaDilemma

@kamack38 I ditched the idea with pt and instead added a sizex option. Can you maybe checkout the PR I linked?

PaideiaDilemma avatar Dec 20 '24 07:12 PaideiaDilemma

@PaideiaDilemma Has this been solved or are you still waiting for some input in the linked PR?

kamack38 avatar Jun 11 '25 19:06 kamack38

I have been thinking about how to do this quite a bit and I would like to implement it a bit differently. I didn't really like the sizex thing. Now I am thinking of smth like this:

label { # or image
  ...
  resize {
    xy = 10%, 10%
    relative_to_monitor=false
    lock_aspect_ratio=0
  }
}

This makes it a bit more clear that we are resizing an asset. It allows the asset to be scaled based on the original asset size or relative to the monitor size the widget is on (via relative_to_monitor). It also allows to specify the size in absolute pixels. lock_aspect_ratio would allow to set either x or y to be the axes based on which the other one is inferred by.

https://github.com/PaideiaDilemma/hyprlock/commit/6da43c0c08da3b502be6de53fd6a99d121e2af4d

PaideiaDilemma avatar Jun 13 '25 15:06 PaideiaDilemma

This looks great! I would only change the xy to something like size or split it to heigth and width.

kamack38 avatar Jun 13 '25 16:06 kamack38

So turns out nesting categories in widgets currently doesn't work properly. See https://github.com/hyprwm/hyprlang/pull/82

PaideiaDilemma avatar Sep 17 '25 07:09 PaideiaDilemma