Alexays / Waybar

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

Waybar doesn't start and can't quit it, need to force kill #2598

Closed khaneliman closed 1 year ago

khaneliman commented 1 year ago

Related PR from bisect: https://github.com/Alexays/Waybar/pull/2586 Specifically 89e85db7902dbb7cc18c241e458155866b99ce2c introduces the borked waybar.

Can no longer run waybar on master. Doing a git bisect shows that this commit breaks waybar for me. If I delete that commit my waybar launches and operates, as normal.

Setup: Using NixOS with the nixpkgs-wayland overlay to build latest from master. Tested locally and bisected using the in repo flake devenv with nix-build.

Waybar config ```json [ { "clock": { "format": "{:%a %d; %b \n %I:%M %p }", "format-alt": "{:%Y-%m-%d}", "tooltip-format": "{:%Y %B}\n{calendar}" }, "cpu": { "format": " {usage}%", "tooltip": true }, "custom/ellipses": { "format": "", "tooltip": false }, "custom/github": { "exec": "/nix/store/nk47p35jgp8nzzvnkr95fhxggyqfbzix-githubHelper/bin/githubHelper", "format": " {}", "interval": 60, "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/zh6xr4lf2kxvk6hhmb88k690kj6gc65i-xdg-utils-unstable-2022-11-06/bin/xdg-open https://github.com/notifications", "return-type": "json" }, "custom/lock": { "format": "󰍁", "on-click": "/nix/store/br5wisa3r6kk8187w7gv597q681wg12k-swaylock-effects-1.6.11/bin/swaylock", "tooltip": false }, "custom/media": { "escape": true, "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null", "format": "{icon} {}", "format-icons": { "default": "🎜", "spotify": "" }, "max-length": 40, "return-type": "json" }, "custom/notification": { "escape": true, "exec": "/nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -swb", "exec-if": "which /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client", "format": "{icon} {}", "format-icons": { "dnd-inhibited-none": "", "dnd-inhibited-notification": "", "dnd-none": "", "dnd-notification": "", "inhibited-none": "", "inhibited-notification": "", "none": "", "notification": "" }, "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -t -sw", "on-click-right": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -d -sw", "return-type": "json", "tooltip": true }, "custom/power": { "format": "", "on-click": "shutdown now", "tooltip": false }, "custom/quit": { "format": "󰗼", "on-click": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch exit", "tooltip": false }, "custom/reboot": { "format": "󰜉", "on-click": "reboot", "tooltip": false }, "custom/separator-left": { "format": "", "tooltip": false }, "custom/separator-right": { "format": "", "tooltip": false }, "custom/weather": { "exec": "/nix/store/gsn3gvc9q6jiqdzfbnhvyzg79pj3vgkj-wttrbar-0.4.0/bin/wttrbar -l $(/nix/store/3lwrcxnxvfskh7m98fq0n5kqj2001ci7-jq-1.7-bin/bin/jq -r '.weathergov | (.location)' ~/weather_config.json) --fahrenheit --main-indicator temp_F", "format": "{}", "interval": 3600, "return-type": "json", "tooltip": true }, "custom/wlogout": { "format": "", "interval": "once", "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/j5b3gc7y7j5szq2smvvhc9axq5xdbkl8-wlogout-1.1.1/bin/wlogout -c 5 -r 5 -p layer-shell", "tooltip": false }, "disk": { "format": " {percentage_used}%" }, "group/audio": { "drawer": { "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "pulseaudio", "pulseaudio/slider" ], "orientation": "horizontal" }, "group/notifications": { "modules": [ "idle_inhibitor", "custom/notification", "custom/github", "group/audio" ], "orientation": "horizontal" }, "group/power": { "drawer": { "children-class": "not-power", "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "custom/wlogout", "custom/quit", "custom/lock", "custom/reboot" ], "orientation": "horizontal" }, "group/stats": { "modules": [ "network", "cpu", "memory", "disk", "temperature" ], "orientation": "horizontal" }, "group/stats-drawer": { "drawer": { "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "custom/separator-right", "network", "cpu", "memory", "disk", "temperature" ], "orientation": "horizontal" }, "group/tray": { "modules": [ "tray" ], "orientation": "horizontal" }, "group/tray-drawer": { "drawer": { "transition-duration": 500, "transition-left-to-right": true }, "modules": [ "custom/separator-right", "tray" ], "orientation": "horizontal" }, "hyprland/submap": { "format": "✌️ {}", "max-length": 8, "tooltip": false }, "hyprland/window": { "format": "{}", "separate-outputs": true }, "hyprland/workspaces": { "active-only": "false", "all-outputs": false, "format": "{icon} {windows}", "format-icons": { "1": "󰎤", "10": "󰽽", "2": "󰎧", "3": "󰎪", "4": "󰎭", "5": "󰎱", "6": "󰎳", "7": "󰎶", "8": "󰎹", "9": "󰎼", "default": "", "empty": "󱓼", "urgent": "󱨇" }, "on-scroll-down": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch workspace e-1", "on-scroll-up": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch workspace e+1", "persistent-workspaces": { "*": [ 2, 3, 4, 5, 6, 7, 8 ], "DP-3": [ 1 ] }, "window-rewrite": { "class<.pitivi-wrapped>": "󱄢", "class<1Password>": "󰢁", "class": "󰈎", "class": "󰊤", "class": "", "class": "", "class": "󰒱", "class": "󰨞", "class": "󰙯", "class": "", "class title<.*github.*>": "", "class title<.*twitch|youtube|plex|tntdrama|bally sports.*>": "", "class": "", "class": "󱂷", "class": "󰄄", "class": "", "class": "", "class": "", "class": "󰢹", "class": "󰕼", "code-url-handler": "󰨞" }, "window-rewrite-default": "" }, "idle_inhibitor": { "format": "{icon} ", "format-icons": { "activated": "", "deactivated": "" } }, "keyboard-state": { "capslock": true, "format": "{icon} {name}", "format-icons": { "locked": "", "unlocked": "" }, "numlock": true }, "layer": "top", "margin-left": 20, "margin-right": 20, "margin-top": 10, "memory": { "format": "󰍛 {}%" }, "modules-center": [], "modules-left": [ "group/power", "hyprland/workspaces", "custom/separator-left", "hyprland/window" ], "modules-right": [ "group/tray", "custom/separator-right", "group/stats", "custom/separator-right", "group/notifications", "hyprland/submap", "custom/weather", "clock" ], "mpd": { "consume-icons": { "on": " " }, "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", "format-disconnected": "Disconnected ", "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", "interval": 2, "random-icons": { "off": " ", "on": " " }, "repeat-icons": { "on": " " }, "single-icons": { "on": "1 " }, "state-icons": { "paused": "", "playing": "" }, "tooltip-format": "MPD (connected)", "tooltip-format-disconnected": "MPD (disconnected)", "unknown-tag": "N/A" }, "mpris": { "format": "{player_icon} {status_icon} {dynamic}", "format-paused": "{player_icon} {status_icon} {dynamic}", "max-length": 45, "player-icons": { "chromium": "", "default": "", "firefox": "", "mopidy": "", "mpv": "", "spotify": "" }, "status-icons": { "paused": "", "playing": "", "stopped": "" } }, "network": { "format-alt": "{ifname}: {ipaddr}/{cidr}", "format-disconnected": " Disconnected", "format-ethernet": "󰈀 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", "format-linked": "󰈁 {ifname} (No IP)", "format-wifi": " 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", "interval": 1, "tooltip-format": " {ifname} via {gwaddr}" }, "output": "DP-1", "position": "top", "pulseaudio": { "format": "{volume}% {icon}", "format-bluetooth": "{volume}% {icon}", "format-icons": { "car": "", "default": [ "", "" ], "hands-free": "", "headphone": "", "headset": "", "phone": "", "portable": "" }, "format-muted": "", "ignored-sinks": [ "Easy Effects Sink" ], "on-click": "pavucontrol", "scroll-step": 1 }, "pulseaudio/slider": { "max": 100, "min": 0, "orientation": "horizontal" }, "temperature": { "critical-threshold": 80, "format": "{icon} {temperatureC}°C", "format-critical": "{temperatureC}°C {icon}", "format-icons": [ "", "", "" ], "hwmon-path-abs": "/sys/devices/pci0000:00/0000:00:18.3/hwmon", "input-filename": "temp3_input", "interval": "5" }, "tray": { "spacing": 10 }, "user": { "format": "{user}", "height": 30, "icon": true, "interval": 60, "width": 30 }, "wireplumber": { "format": "{volume}% {icon}", "format-icons": [ "", "", "" ], "format-muted": "", "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/51bhgdxzip0lzqvn41walqlncixc25nc-helvum-0.5.1/bin/helvum" } }, { "clock": { "format": "{:%a %d; %b \n %I:%M %p }", "format-alt": "{:%Y-%m-%d}", "tooltip-format": "{:%Y %B}\n{calendar}" }, "cpu": { "format": " {usage}%", "tooltip": true }, "custom/ellipses": { "format": "", "tooltip": false }, "custom/github": { "exec": "/nix/store/nk47p35jgp8nzzvnkr95fhxggyqfbzix-githubHelper/bin/githubHelper", "format": " {}", "interval": 60, "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/zh6xr4lf2kxvk6hhmb88k690kj6gc65i-xdg-utils-unstable-2022-11-06/bin/xdg-open https://github.com/notifications", "return-type": "json" }, "custom/lock": { "format": "󰍁", "on-click": "/nix/store/br5wisa3r6kk8187w7gv597q681wg12k-swaylock-effects-1.6.11/bin/swaylock", "tooltip": false }, "custom/media": { "escape": true, "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null", "format": "{icon} {}", "format-icons": { "default": "🎜", "spotify": "" }, "max-length": 40, "return-type": "json" }, "custom/notification": { "escape": true, "exec": "/nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -swb", "exec-if": "which /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client", "format": "{icon} {}", "format-icons": { "dnd-inhibited-none": "", "dnd-inhibited-notification": "", "dnd-none": "", "dnd-notification": "", "inhibited-none": "", "inhibited-notification": "", "none": "", "notification": "" }, "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -t -sw", "on-click-right": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/2fixjd1ay7b19x4f8g5qbyhqk2lmr04k-SwayNotificationCenter-0.9.0/bin/swaync-client -d -sw", "return-type": "json", "tooltip": true }, "custom/power": { "format": "", "on-click": "shutdown now", "tooltip": false }, "custom/quit": { "format": "󰗼", "on-click": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch exit", "tooltip": false }, "custom/reboot": { "format": "󰜉", "on-click": "reboot", "tooltip": false }, "custom/separator-left": { "format": "", "tooltip": false }, "custom/separator-right": { "format": "", "tooltip": false }, "custom/weather": { "exec": "/nix/store/gsn3gvc9q6jiqdzfbnhvyzg79pj3vgkj-wttrbar-0.4.0/bin/wttrbar -l $(/nix/store/3lwrcxnxvfskh7m98fq0n5kqj2001ci7-jq-1.7-bin/bin/jq -r '.weathergov | (.location)' ~/weather_config.json) --fahrenheit --main-indicator temp_F", "format": "{}", "interval": 3600, "return-type": "json", "tooltip": true }, "custom/wlogout": { "format": "", "interval": "once", "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/j5b3gc7y7j5szq2smvvhc9axq5xdbkl8-wlogout-1.1.1/bin/wlogout -c 5 -r 5 -p layer-shell", "tooltip": false }, "disk": { "format": " {percentage_used}%" }, "group/audio": { "drawer": { "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "pulseaudio", "pulseaudio/slider" ], "orientation": "horizontal" }, "group/notifications": { "modules": [ "idle_inhibitor", "custom/notification", "custom/github", "group/audio" ], "orientation": "horizontal" }, "group/power": { "drawer": { "children-class": "not-power", "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "custom/wlogout", "custom/quit", "custom/lock", "custom/reboot" ], "orientation": "horizontal" }, "group/stats": { "modules": [ "network", "cpu", "memory", "disk", "temperature" ], "orientation": "horizontal" }, "group/stats-drawer": { "drawer": { "transition-duration": 500, "transition-left-to-right": false }, "modules": [ "custom/separator-right", "network", "cpu", "memory", "disk", "temperature" ], "orientation": "horizontal" }, "group/tray": { "modules": [ "tray" ], "orientation": "horizontal" }, "group/tray-drawer": { "drawer": { "transition-duration": 500, "transition-left-to-right": true }, "modules": [ "custom/separator-right", "tray" ], "orientation": "horizontal" }, "hyprland/submap": { "format": "✌️ {}", "max-length": 8, "tooltip": false }, "hyprland/window": { "format": "{}", "separate-outputs": true }, "hyprland/workspaces": { "active-only": "false", "all-outputs": false, "format": "{icon} {windows}", "format-icons": { "1": "󰎤", "10": "󰽽", "2": "󰎧", "3": "󰎪", "4": "󰎭", "5": "󰎱", "6": "󰎳", "7": "󰎶", "8": "󰎹", "9": "󰎼", "default": "", "empty": "󱓼", "urgent": "󱨇" }, "on-scroll-down": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch workspace e-1", "on-scroll-up": "/nix/store/lpjycdm6nz09cqxdqgq3ib926x8vi5ba-hyprland-0.31.0+date=2023-10-21_d0367d8/bin/hyprctl dispatch workspace e+1", "persistent-workspaces": { "*": [ 2, 3, 4, 5, 6, 7, 8 ], "DP-3": [ 1 ] }, "window-rewrite": { "class<.pitivi-wrapped>": "󱄢", "class<1Password>": "󰢁", "class": "󰈎", "class": "󰊤", "class": "", "class": "", "class": "󰒱", "class": "󰨞", "class": "󰙯", "class": "", "class title<.*github.*>": "", "class title<.*twitch|youtube|plex|tntdrama|bally sports.*>": "", "class": "", "class": "󱂷", "class": "󰄄", "class": "", "class": "", "class": "", "class": "󰢹", "class": "󰕼", "code-url-handler": "󰨞" }, "window-rewrite-default": "" }, "idle_inhibitor": { "format": "{icon} ", "format-icons": { "activated": "", "deactivated": "" } }, "keyboard-state": { "capslock": true, "format": "{icon} {name}", "format-icons": { "locked": "", "unlocked": "" }, "numlock": true }, "layer": "top", "margin-left": 20, "margin-right": 20, "margin-top": 10, "memory": { "format": "󰍛 {}%" }, "modules-center": [], "modules-left": [ "group/power", "hyprland/workspaces", "custom/separator-left", "hyprland/window" ], "modules-right": [ "group/tray-drawer", "group/stats-drawer", "group/notifications", "hyprland/submap", "custom/weather", "clock" ], "mpd": { "consume-icons": { "on": " " }, "format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ", "format-disconnected": "Disconnected ", "format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ", "interval": 2, "random-icons": { "off": " ", "on": " " }, "repeat-icons": { "on": " " }, "single-icons": { "on": "1 " }, "state-icons": { "paused": "", "playing": "" }, "tooltip-format": "MPD (connected)", "tooltip-format-disconnected": "MPD (disconnected)", "unknown-tag": "N/A" }, "mpris": { "format": "{player_icon} {status_icon} {dynamic}", "format-paused": "{player_icon} {status_icon} {dynamic}", "max-length": 45, "player-icons": { "chromium": "", "default": "", "firefox": "", "mopidy": "", "mpv": "", "spotify": "" }, "status-icons": { "paused": "", "playing": "", "stopped": "" } }, "network": { "format-alt": "{ifname}: {ipaddr}/{cidr}", "format-disconnected": " Disconnected", "format-ethernet": "󰈀 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", "format-linked": "󰈁 {ifname} (No IP)", "format-wifi": " 󰜮 {bandwidthDownBytes} 󰜷 {bandwidthUpBytes}", "interval": 1, "tooltip-format": " {ifname} via {gwaddr}" }, "output": "DP-3", "position": "top", "pulseaudio": { "format": "{volume}% {icon}", "format-bluetooth": "{volume}% {icon}", "format-icons": { "car": "", "default": [ "", "" ], "hands-free": "", "headphone": "", "headset": "", "phone": "", "portable": "" }, "format-muted": "", "ignored-sinks": [ "Easy Effects Sink" ], "on-click": "pavucontrol", "scroll-step": 1 }, "pulseaudio/slider": { "max": 100, "min": 0, "orientation": "horizontal" }, "temperature": { "critical-threshold": 80, "format": "{icon} {temperatureC}°C", "format-critical": "{temperatureC}°C {icon}", "format-icons": [ "", "", "" ], "hwmon-path-abs": "/sys/devices/pci0000:00/0000:00:18.3/hwmon", "input-filename": "temp3_input", "interval": "5" }, "tray": { "spacing": 10 }, "user": { "format": "{user}", "height": 30, "icon": true, "interval": 60, "width": 30 }, "wireplumber": { "format": "{volume}% {icon}", "format-icons": [ "", "", "" ], "format-muted": "", "on-click": "/nix/store/y9gr7abwxvzcpg5g73vhnx1fpssr5frr-coreutils-9.3/bin/sleep 0.1 && /nix/store/51bhgdxzip0lzqvn41walqlncixc25nc-helvum-0.5.1/bin/helvum" } } ] ```

@taminob any thoughts on why this would break waybar for me? If I simply revert that commit, it works fine.

taminob commented 1 year ago

Thanks for bisecting already, luckily the commit isn't too complex. :)

I have no immediate idea, but my first guess would be that there might be an overflow because a too small type is used somewhere. I can look at the issue later today.

Alexays commented 1 year ago

Reverted the PR until we fix the issue :)

taminob commented 1 year ago

Found the issue, was a little bit tricky because the cause wasn't in the user code but in the standard library.

std::condition_variable::wait_for() seems to have the requirement that the given duration plus the current time are not allowed to cause an overflow (see https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for).

I will open a PR later this evening.

Minimal config to reproduce the config:

{
  "modules-center": [
    "tray",
    "custom/wlogout"
  ],
  "custom/wlogout": {
    "format": "",
    "interval": "once",
    "on-click": "true",
    "tooltip": false
  }
}

For whatever reason, the code hangs in an infinite-loop in dp.emit() of Tray::onAdd() - still no idea why. :)