Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module group feature #1305

Merged
merged 1 commit into from
Nov 29, 2021
Merged

Add module group feature #1305

merged 1 commit into from
Nov 29, 2021

Conversation

njoyard
Copy link
Contributor

@njoyard njoyard commented Nov 1, 2021

This PR adds a module group feature. A module group contains multiple modules and renders them orthogonal to the bar direction (ie stacked vertically for a horizontal bar and vice versa).

My use case for it is that I want a vertical bar but I want some modules to share the same row on the bar. This may sound like a waste of screen space but I'm using waybar as an overlay that is most often hidden, and show on demand. A screenshot of my setup follows, volume/brightness bars are implemented each with two modules (one for the icon, one for the bar) placed in a group. Progress bars use CSS linear gradients as their background.

image

The way a group is configured is as follows:

{
  "modules_left": [
    "module_a",
    "group/mygroup",
    "module_b"
  ],

  "group/mygroup": {
    "modules": [
      "module_c",
      "module_d"
    ]
  }
}

I chose to list modules in a "modules" key to leave space for future additional options for groups (eg. alignment and so on - which would probably be useful for right/bottom-positioned bars). The implementation does not prevent nested groups, but that's currently not very useful as a group direction is orthogonal to the bar, not to its parent.

Please note that I have no significant experience with c++ whatsoever, so my code may leave a lot to be desired. I've been using it as a daily driver for quite some time though so I'm hoping any remaining issues are mostly architecture/style/good practices related.

Let me know what you think.

@Alexays
Copy link
Owner

Alexays commented Nov 23, 2021

Nice addition!
Can you document this in man? :)

@njoyard
Copy link
Contributor Author

njoyard commented Nov 25, 2021

Added some documentation in the main manpage, and rebased on master.

@Alexays Alexays merged commit b6e24bd into Alexays:master Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants