Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.81k stars 656 forks source link

modules/river/tags: use toggle-tags to determine focused/occupied/urgent status #3382

Open arthomnix opened 4 days ago

arthomnix commented 4 days ago

Currently, the river/tags module uses the index of each button to determine the tag to use when determining focused/occupied/urgent status, rather than using the set-tags or toggle-tags value in the config. In my config, I have tags counting down from 30 for certain applications (the characters after 9 in tag-labels are Nerd Fonts icons for Firefox, Discord, KeePass and Thunderbird respectively):

    "river/tags": {
        "num-tags": 13,
        "tag-labels": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "󰈹", "", "", ""],
        "set-tags": [
            1,
            2,
            4,
            8,
            16,
            32,
            64,
            128,
            256,
            1073741824,
            536870912,
            268435456,
            134217728
        ],
        "toggle-tags": [
            1,
            2,
            4,
            8,
            16,
            32,
            64,
            128,
            256,
            1073741824,
            536870912,
            268435456,
            134217728
        ]
    },

The current implementation means that tag 10 (512) is used for the Firefox button when determining focused/occupied/urgent status, even though the set-tags and toggle-tags values are both 30 (1073741824). In other words, the button appears occupied when tag 10 is activated, even though the button actually controls tag 30.

This PR changes this behaviour to use the toggle-tags value, falling back to the previous behaviour if toggle-tags is not specified. toggle-tags is used instead of set-tags to support "sticky tag" configurations (as in the wiki example).