swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.36k stars 1.09k forks source link

device identifier globbing/wildcards #6829

Open tomjtoth opened 2 years ago

tomjtoth commented 2 years ago

Would it be possible to assign the same config to multiple devices, without assigning to all with the single asterisk?
The below extract of my config file:

input 1:1:AT_Translated_Set_2_keyboard {
    xkb_layout hu
    xkb_numlock enabled
}

# 15-ab125no has some tweaks in it's built-in keyboard to function properly 
input 1:2:AT_Raw_Set_2_keyboard {
    xkb_layout hu
    xkb_numlock enabled
}

Could be replaced by:

input 1:{1,2}:AT_{Translated,Raw}_Set_2_keyboard {
    xkb_layout hu
    xkb_numlock enabled
}
plitter commented 1 year ago

I'm not sure this should be implemented as this. If regex isn't supported already, I would just allow a list ala input X, Y {...}

There is a question of how this should be interpreted, f.ex. as bash does it

$ echo {1..2}..{1..2}
1..1 1..2 2..1 2..2

Or what I'm assuming you want it to be

1..1 2..2

But then they (because I'm not sure how to implement it myself) would have to deal with how we should do with duplicates. If the list has 2 things input devices twice it might need to be deduplicated if someone has added the same twice.