jay icon indicating copy to clipboard operation
jay copied to clipboard

advanced matching in ConnectorMatch and OutputMatch, similar to WindowMatch

Open kotarac opened this issue 1 year ago • 2 comments

WindowMatch type which was recently implemented for window management has advanced matching like .not .any and similar.

These would be useful on ConnectorMatch and OutputMatch to make configuration nicer.

Example use-case which I had to workaround like this:

[[outputs]]
name = "internal"
match.connector = "eDP-1"

[[outputs]]
name = "external"
match = [
  { connector = "DP-1" },
  { connector = "DP-2" },
  { connector = "DP-3" },
  { connector = "DP-4" },
  { connector = "DP-5" },
  { connector = "DP-6" },
  { connector = "HDMI-A-1" },
]

mod4-shift-j = [
  {
    type = "configure-connector",
    connector = {
      match.name = "eDP-1",
      enabled = true
    },
  },
  {
    type = "configure-connector",
    connector = {
      match = [
        { name = "DP-1" },
        { name = "DP-2" },
        { name = "DP-3" },
        { name = "DP-4" },
        { name = "DP-5" },
        { name = "DP-6" },
        { name = "HDMI-A-1" },
      ],
      enabled = false,
    },
  },
]
mod4-shift-k = [
  {
    type = "configure-connector",
    connector = {
      match.name = "eDP-1",
      enabled = false
    },
  },
  {
    type = "configure-connector",
    connector = {
      match = [
        { name = "DP-1" },
        { name = "DP-2" },
        { name = "DP-3" },
        { name = "DP-4" },
        { name = "DP-5" },
        { name = "DP-6" },
        { name = "HDMI-A-1" },
      ],
      enabled = true,
    },
  },
]
mod4-shift-l = [
  {
    type = "configure-connector",
    connector = {
      match.name = "eDP-1",
      enabled = true
    },
  },
  {
    type = "configure-connector",
    connector = {
      match = [
        { name = "DP-1" },
        { name = "DP-2" },
        { name = "DP-3" },
        { name = "DP-4" },
        { name = "DP-5" },
        { name = "DP-6" },
        { name = "HDMI-A-1" },
      ],
      enabled = true,
    },
  },
]

mod4-j = { type = "move-to-output", output.name = "internal" }
mod4-k = { type = "move-to-output", output.name = "external" }

Having match.not.connector = "eDP-1" would have made these a lot easier.

kotarac avatar Jul 27 '25 09:07 kotarac

I think what might help here is adding a tag field to the connectors array that can be referenced elsewhere.

mahkoh avatar Jul 27 '25 13:07 mahkoh

I think what might help here is adding a tag field to the connectors array that can be referenced elsewhere.

Absolutely. At 1st when I was setting this up, I actually tried setting up a "group" of connectors like there is for outputs (see name = "external" above) and then realized it doesn't work like that.

Both could work and both would have uses.

kotarac avatar Jul 27 '25 14:07 kotarac