Description
Hello. I have the following setup with 2 overlay waybar bars:
// -*- mode: jsonc -*-
[{
"name": "minimal_bar",
"include": "~/.config/waybar/modules.jsonc",
"layer": "top",
"mode": "top",
"exclusive": false,
"passthrough": false,
"height": 30,
"width": 10, // Force minimum width
"spacing": 2, // Gaps between modules
"reload_style_on_change": true,
"modules-center": [
"clock",
"custom/notifications",
"battery"
]
}, {
"name": "full_bar",
"include": "~/.config/waybar/modules.jsonc",
"layer": "top",
"mode": "top",
"exclusive": false,
"passthrough": false,
"height": 30, // Waybar height (to be removed for auto height)
"width": 750, // Waybar width
"spacing": 2, // Gaps between modules
"reload_style_on_change": true,
"start_hidden": true,
"modules-left": [
"hyprland/workspaces"
],
"modules-center": [
"clock",
"custom/notifications",
"battery"
],
"modules-right": [
"tray",
"pulseaudio#microphone",
"pulseaudio",
"backlight",
"power-profiles-daemon",
"custom/power"
]
}]
The full bar starts hidden and it is displayed when clicking on the clock in minimal bar or via a keyboard binding by executing killall -SIGUSR1 waybar
.
While this works, I would prefer to not have to click on clock for this action and have the full bar displayed when I enter with the mouse in the minimal bar area, and have the full bar hidden when I exit the full bar area.
From what I see these events are already handled at https://github.com/Alexays/Waybar/blob/master/src/AModule.cpp#L125 in order to change the cursor type, so adding custom actions shouldn't be too hard, maybe with a config in the bar like:
{
"name": <bar_name>,
.......
"on-mouse-enter": <custom_action>,
"on-mouse-exit": <custom_action>
}
Does this sound good? I'd be willing to implement this myself if it is fine.