hyproled icon indicating copy to clipboard operation
hyproled copied to clipboard

Feature: Monitor selection by description

Open tacsist opened this issue 1 year ago • 5 comments

Hi, thanks for your work.

My suggestion is to add the ability to target monitors not only by index, but also by description/name akin to the hyprland's own monitor implementation:

...then the description value up to, but not including the portname (eDP-1) can be used to specify the monitor:

>> monitor = desc:Chimei Innolux Corporation 0x150C, preferred, auto, 1.5 

This is useful in cases where hyproled is run on a laptop and for one out of many reasons the internal display is not used at all times. And some more other reasons probably.

tacsist avatar Jan 10 '25 22:01 tacsist

Hey thanks for your input. I want to keep the options as simple as possible and follow unix principles to keep it lean. It is intended to wrap this tool in a bash script in order to enhance functionality where possible. Would it be feasible to call hyprctl in order to query the correct id and then pass it to hyproled?

mklan avatar Jan 13 '25 11:01 mklan

@mklan I think yes, it is possible to do so. The only problem I see is that the script is very likely to be used only for hyproled, so IMO it would be nice to see it packaged with hyproled either as an example (like the FS script) or be a part of the arguments/program itself.

tacsist avatar Jan 16 '25 14:01 tacsist

I see how setting the monitor to use by description would be heavy code wise because as far as I understood the code, you barely interact with hypr and instead getting the monitors from wayland. Maybe then it would be more reasonable to set it by connector name (eDP-1, DP-2) instead?

tacsist avatar Jan 25 '25 17:01 tacsist

hey @tacsist. You are correct. The shaders are accepting the monitor id, that's why I just exposed this parameter. I really want to keep this as lean as possibe. I view hyproled more like a method or api. It should not care where the information of the monitor id is coming from. Updating the examples is a good idea tho. If you want you can also contirbute a PR with an example.


# get id by model
id=$(hyprctl monitors -j | jq -r 'first(.[] | select(.model == "0x4193")).id')
# get id by name
id=$(hyprctl monitors -j | jq -r 'first(.[] | select(.name == "eDP-1")).id')
# get id by description
id=$(hyprctl monitors -j | jq -r 'first(.[] | select(.description == "Samsung Display Corp. 0x4193")).id')

mklan avatar Jan 27 '25 08:01 mklan

I think that is acceptable as a solution, I will try it out. Need to test if it is possible to be used from within hypr config, seeing that it calls hyprctl, so config exec will not be able to run on boot (?) Thank you for your help!

tacsist avatar Feb 18 '25 21:02 tacsist