Skip to content

Instantly share code, notes, and snippets.

@kRHYME7
Last active February 10, 2025 18:58
Show Gist options
  • Save kRHYME7/cc93c0ab1e9d3ab80a40f57a6dd8b15c to your computer and use it in GitHub Desktop.
Save kRHYME7/cc93c0ab1e9d3ab80a40f57a6dd8b15c to your computer and use it in GitHub Desktop.

Configuration Tree


. πŸ“‚ xdg_config/waybar
β”œβ”€β”€ πŸ“„ config.jsonc
β”œβ”€β”€ πŸ“„ includes.json
└── πŸ“‚ layouts/
β”‚  β”œβ”€β”€ πŸ“„ layout-1.jsonc
β”‚  β”œβ”€β”€ πŸ“„ khing.jsonc
β”‚  β”œβ”€β”€ πŸ“„ macos.jsonc
└── πŸ“‚ menus/
β”‚  β”œβ”€β”€ πŸ“„ clipboard.xml
β”‚  β”œβ”€β”€ πŸ“„ dunst-notification.xml
β”‚  β”œβ”€β”€ πŸ“„ gpuinfo.xml
β”‚  β”œβ”€β”€ πŸ“„ power.xml
β”‚  β”œβ”€β”€ πŸ“„ pulseaudio.xml
β”‚  β”œβ”€β”€ πŸ“„ spotify.xml
└── πŸ“‚ modules/
β”‚  β”œβ”€β”€ πŸ“„ backlight.jsonc
β”‚  β”œβ”€β”€ πŸ“„ clock.jsonc
β”‚  β”œβ”€β”€ πŸ“„ cpu.jsonc
β”‚  β”œβ”€β”€ πŸ“„ custom-cpuinfo.jsonc
β”‚  β”œβ”€β”€ πŸ“„ hyprland-language.jsonc
β”‚  β”œβ”€β”€ πŸ“„ idle_inhibitor.jsonc
β”‚  β”œβ”€β”€ πŸ“„ pulseaudio#microphone.jsonc
β”‚  β”œβ”€β”€ πŸ“„ pulseaudio.jsonc
β”‚  β”œβ”€β”€ πŸ“„ tray.json
β”‚  β”œβ”€β”€ πŸ“„ wlr-taskbar#windows.json
β”‚  β”œβ”€β”€ πŸ“„ wlr-taskbar.json
β”œβ”€β”€ πŸ“„ style.css
└── πŸ“‚ styles/
β”‚  └── πŸ“‚ dynamic/
β”‚    β”œβ”€β”€ πŸ“„ border-radius.css
β”‚    β”œβ”€β”€ πŸ“„ global.css
β”‚  └── πŸ“‚ groups/
β”‚    β”œβ”€β”€ πŸ“„ leaf-inverse.css
β”‚    β”œβ”€β”€ πŸ“„ leaf.css
β”‚    β”œβ”€β”€ πŸ“„ pill-down.css
β”‚    β”œβ”€β”€ πŸ“„ pill-in.css
β”‚    β”œβ”€β”€ πŸ“„ pill-left.css
β”‚    β”œβ”€β”€ πŸ“„ pill-out.css
β”‚    β”œβ”€β”€ πŸ“„ pill-right.css
β”‚    β”œβ”€β”€ πŸ“„ pill-up.css
β”‚    β”œβ”€β”€ πŸ“„ pill.css
β”‚  β”œβ”€β”€ πŸ“„ layout-1.css
β”‚  β”œβ”€β”€ πŸ“„ khing.css
β”‚  β”œβ”€β”€ πŸ“„ macos.css
β”œβ”€β”€ πŸ“„ theme.css
└── πŸ“„ user-style.css

waybar

. πŸ“‚ xdg_config_home/waybar
└── πŸ“‚ layouts/
└── πŸ“‚ menus/
└── πŸ“‚ modules/
└── πŸ“‚ styles/
β”œβ”€β”€ πŸ“„ theme.css
β”œβ”€β”€ πŸ“„ config.jsonc
β”œβ”€β”€ πŸ“„ includes.json
└── πŸ“„ user-style.css
  • config.json

    • this is a copy of a layout configuration. See layouts.
    • a transient file therefore edits must be saved at xdg_config_home/waybar/layouts
  • stye.json

    • auto-generated file.
    • style.css imports 3 files:
      • current style/*.css that matches the layout.json. See styles
      • theme.css generated by themes and this can override the selected style.
      • user-style.css is an optional file where you can add you own overrides. You can also test your CSS in here.
  • includes.json

    • auto generated list of modules from xdg_config_home/waybar/modules
    • to avoid redundant configurations file we will just store the modules and include it in the config
    • DEPRECATION: This approach will soon be deprecated as upstream waybar supports regex.
  • theme.css

    • theme generated file.

modules

└── πŸ“‚ modules/
β”‚  β”œβ”€β”€ πŸ“„ backlight.jsonc
β”‚  β”œβ”€β”€ πŸ“„ clock.jsonc
β”‚  β”œβ”€β”€ πŸ“„ cpu.jsonc
β”‚  β”œβ”€β”€ πŸ“„ custom-cpuinfo.jsonc
β”‚  β”œβ”€β”€ πŸ“„ hyprland-language.jsonc
β”‚  β”œβ”€β”€ πŸ“„ idle_inhibitor.jsonc
β”‚  β”œβ”€β”€ πŸ“„ pulseaudio#microphone.jsonc
β”‚  β”œβ”€β”€ πŸ“„ pulseaudio.jsonc
β”‚  β”œβ”€β”€ πŸ“„ tray.json
β”‚  β”œβ”€β”€ πŸ“„ wlr-taskbar#windows.json
β”‚  β”œβ”€β”€ πŸ“„ wlr-taskbar.json
  • Store all modules in xdg_config_home/waybar/modules.
  • Files in here are recursively added as entry in includes.json
  • all modules under a specific tree will have the parent/child convention. Where custom/cpuinfo will be converted into custom-cpuinfo. This is used to easily determine the class name in CSS without confusion. example: custom-cpuinfo { padding: 1em; }

layouts

Directory: ./layouts

...
└── πŸ“‚ layouts/
β”‚  β”œβ”€β”€ πŸ“„ layout-1.jsonc
β”‚  β”œβ”€β”€ πŸ“„ layout-2.jsonc
β”‚  β”œβ”€β”€ πŸ“„ khing.jsonc
β”‚  β”œβ”€β”€ πŸ“„ macos.jsonc
β”‚  β”œβ”€β”€ πŸ“„ ....jsonc 
...

HyDE stores all the ready to use configuration to layouts directory. For css styling of the layouts see styles

styles

Directory: ./styles

└── πŸ“‚ styles/
β”‚  β”œβ”€β”€ πŸ“„ layout-1.css
β”‚  β”œβ”€β”€ πŸ“„ layout-2.css
β”‚  β”œβ”€β”€ πŸ“„ khing.css
β”‚  β”œβ”€β”€ πŸ“„ macos.css
β”‚  β”œβ”€β”€ πŸ“„ ...*.css 
β”‚  └── πŸ“‚ dynamic/
β”‚    β”œβ”€β”€ πŸ“„ border-radius.css
β”‚    β”œβ”€β”€ πŸ“„ global.css

The styles are the counterpart of layouts. When choosing a layout, HyDE will try to use the equivalent CSS style by matching the base names e.g. khing.jsonc will use khing.css.

Explicit --config <file> and --style <file> is also supported.

dynamic

dynamic as the name implies, are dynamically modified/generated css files.

  • border-radius.css
    - dynamic border radius for the groups.
dynamic border-radius

Circle 100 rounding in hyprland

image

Squircle 0 rounding in hyprland

image

Something between 5 rounding in hyprland

image

Get the Idea?

  • global.css - includes the dynamic font-size, and font-family. - This is dynamic so that themes can override these values via the hypr.theme >> $WAYBAR_FONT

menus

Stores all the GTK Object XML files. To correctly manage the files we added the GObject XML files in xdg_confg_home/wayabr/menus

Group class for styling

Contents of ../waybar/styles/groups/ are use for styling the border-radius of the given group. Groups are the combination of modules some call it islands.

In HyDE, to be able to make use of the groups, we can declare modules in a group first:

Example in ~/.config/waybar/layouts/my_config.jsonc

...
{
  "group/pill": {
    "orientation": "inherit",
    "modules": [
    "custom/gpuinfo", 
    "clock"
     ]
  }
}
...

Now we can add the group in the waybar modules:

"modules-center" : [
"group/pill",
"group/pill#tag1"
"group/pill-in",
....
]
}

Styling this is easy as we already group the modules. In this way we can use the group name as the class name

#pill, 
#pill-in,


Note: pill and pill#tag* have a class name of pill. This is waybar convention to enable users add a similar module.

@dieBakterie
Copy link

@dieBakterie Updated, let me know what should we add. The manpages for waybar were very good for reference.We should add the linsk as reference. I don't want to repeat what is already in there manpages.

This is really good, now i know exactly how it will work, need to see it in action/some references since it ain't easy to grasp this big project, with all those generated configs...

@kRHYME7
Copy link
Author

kRHYME7 commented Feb 10, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment