hyprland-community / pyprland

Scratchpads & many goodies for Hyprland [maintainer=@fdev31]
MIT License
390 stars 17 forks source link

[FEAT] Plugin: monitor - Support better matching for description field #65

Closed dantefromhell closed 7 months ago

dantefromhell commented 8 months ago

Is your feature request related to a problem? Please describe.

Configuration of the monitor plugin is not very precise how descriptions are matched. I am using 2 monitors of the same brand hence I tried matching against the serial number that is contained in the description field. This didn't work, after reading the code (https://github.com/hyprland-community/pyprland/blob/main/pyprland/plugins/monitors.py#L168C32-L168C42) I realized it is implemented via startswith string matching.

Describe the solution you'd like

Matching the description field could be more flexible, e.g. matching with substring or even regex.

E.g. substring would improve configuration readability from

[monitors.placement]
"Samsung Electric Company LU28R55 HNMNB00590".top_Center_Of = "(eDP-1)"

to

[monitors.placement]
"HNMNB00590".top_Center_Of = "(eDP-1)"

Describe alternatives you've considered

n/a

Additional context

I personally prefer regex matching, they are the most flexible ones.

dantefromhell commented 8 months ago

Not sure if this is related, but through some testing I came to the conclusion that the following config does not work

[monitors.placement]
"Samsung Electric Company LU28R55 HNMNB00590".top_Center_Of = "(eDP-1)"

It does not match the monitor connected to eDP-1.

While the following config works

[monitors.placement]
"Samsung Electric Company LU28R55 HNMNB00590".top_Center_Of = "BOE 0x095F"

I'm wondering if this related to hyprland not showing the port name in the description field of hyprctl monitors ?

My current output is

❯ hyprctl version
Hyprland, built from branch  at commit 1c460e98f870676b15871fe4e5bfeb1a32a3d6d8  ().
Date: 2024-02-28
Tag:

flags: (if any)

❯ hyprctl monitors
Monitor eDP-1 (ID 0):
    2256x1504@59.99900 at 2560x0
    description: BOE 0x095F
    make: BOE
    model: 0x095F
    serial:
    active workspace: 2 (2)
    special workspace: 0 ()
    reserved: 0 30 0 0
    scale: 1.00
    transform: 0
    focused: no
    dpmsStatus: 1
    vrr: 0
    activelyTearing: false

Monitor DP-4 (ID 1):
    3840x2160@60.00000 at 0x0
    description: Samsung Electric Company LU28R55 HNMNB00590
    make: Samsung Electric Company
    model: LU28R55
    serial: HNMNB00590
    active workspace: 4 (4)
    special workspace: 0 ()
    reserved: 0 30 0 0
    scale: 1.50
    transform: 0
    focused: yes
    dpmsStatus: 1
    vrr: 0
    activelyTearing: false
fdev31 commented 8 months ago

This is already implemented, maybe you are using "old" behavior by forcing full_relayout=false ?

if not, then it is implemented as you suggest ("contains", not "regex", I want to keep it simple for the users...)

On the other hand, I'm wondering why you don't have the port name in the description... indeed this prevents from using the "port" syntax... I'll try to figure a workaround for that issue.

dantefromhell commented 8 months ago

This is already implemented, maybe you are using "old" behavior by forcing full_relayout=false ?

I'm using commit a85401c and full_relayout is set to default value.

fdev31 commented 7 months ago

ok then you can ignore your remark about the "startswith".

Is "Samsung".topOf = "BOE" working ? Can you provide the logs ?

fdev31 commented 7 months ago

Closing since this requests an existing feature, assuming this is duplicate of #64

dantefromhell commented 7 months ago

Closing since this requests an existing feature, assuming this is duplicate of https://github.com/hyprland-community/pyprland/issues/64

Agreed.