Alexays / Waybar

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

[taskbar] Icons disappear after screen goes to sleep. #2905

Open dsancheznet opened 7 months ago

dsancheznet commented 7 months ago

Hello, whenever my system goes to sleep after the programmed interval ( 300 secs, accomplished with swayidle ), all icons desappear from the taskbar but the programs remain active on their respective workspaces. I'm calling swayidle from hyprland.conf at startup with: exec-once = swayidle -w timeout 300 '~/.config/waybar/scripts/monitor off' resume '~/.config/waybar/scripts/monitor on'

The script that handles the monitor is as follows:

#!/bin/env bash

# Usage: monitor [ toggle | on | off ]
#   toggle  : toggles the monitor state. If it's on, it turns it off;
#             if it's off, it turns it on.
#   on      : turns the monitor on, independently from its actual state.
#   off     : turns the monitor off, independently from its actual state.

#Set this to 1 if you are an a laptop
SAVE_BRIGHTNESS=0

save_brt_off() {
    if [[ $SAVE_BRIGHTNESS == 1 ]]; then
      BRIGHTNESS_VALUE=`brightnessctl get`
      echo "$BRIGHTNESS_VALUE" >> /tmp/SAVED_BRIGHTNESS
    fi
    hyprctl dispatch dpms off
}

get_brt_on() {
    if [[ $SAVE_BRIGHTNESS == 1 ]]; then
      BRIGHTNESS_VALUE=`cat /tmp/SAVED_BRIGHTNESS`
      brightnessctl set "$BRIGHTNESS_VALUE"
    fi
    hyprctl dispatch dpms on
}

case "$1" in
"toggle")
    DPMS_STATUS=`hyprctl monitors | grep "dpmsStatus" | cut -d":" -f2 | xargs`

    if [[ $DPMS_STATUS == "1" ]]; then
      save_brt_off
    else
      get_brt_on
    fi
  ;;
"on")
  get_brt_on
  ;;
"off")
  save_brt_off
  ;;
*)
  echo "Usage: monitor [ toggle | on | off ]"
  ;;
esac

I have the same configuration installed on my laptop and it doesn't happen there. It only happens on my desktop machine.

Logs when launching waybar manually with the debug/trace option:

[2024-02-09 18:14:22.811] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/config
[2024-02-09 18:14:22.811] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/config.jsonc
[2024-02-09 18:14:22.811] [debug] Try expanding: $HOME/.config/waybar/config
[2024-02-09 18:14:22.811] [debug] Found config file: $HOME/.config/waybar/config
[2024-02-09 18:14:22.811] [info] Using configuration file /home/dominik/.config/waybar/config
[2024-02-09 18:14:22.813] [info] Discovered appearance 'dark'
[2024-02-09 18:14:22.813] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-dark.css
[2024-02-09 18:14:22.813] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style.css
[2024-02-09 18:14:22.813] [debug] Try expanding: $HOME/.config/waybar/style-dark.css
[2024-02-09 18:14:22.813] [debug] Try expanding: $HOME/.config/waybar/style.css
[2024-02-09 18:14:22.814] [debug] Found config file: $HOME/.config/waybar/style.css
[2024-02-09 18:14:22.814] [info] Using CSS file /home/dominik/.config/waybar/style.css
[2024-02-09 18:14:22.817] [debug] Output detection done: HDMI-A-1 (LG Electronics LG ULTRAWIDE 0x00077A5F)
[2024-02-09 18:14:22.818] [debug] Use custom icon theme: Star
[2024-02-09 18:14:22.820] [warning] module backlight: Disabling module "backlight", No backlight found
[2024-02-09 18:14:22.859] [info] Found device Logitech G512 RGB MECHANICAL GAMING KEYBOARD at '/dev/input/event1'
[2024-02-09 18:14:23.517] [info] Hyprland IPC starting
[2024-02-09 18:14:23.542] [debug] hyprland language initLanguage found Spanish
[2024-02-09 18:14:23.591] [debug] network: new default route via 192.168.29.1 on if2 metric 100
[2024-02-09 18:14:23.591] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:14:23.591] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: 
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: /home/dominik/.local/share/flatpak/exports/share/
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: /var/lib/flatpak/exports/share/
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: /usr/local/share//
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: /usr/share//
[2024-02-09 18:14:23.632] [debug] Using 'desktop' search path prefix: /home/dominik/.local/share/
[2024-02-09 18:14:23.640] [debug] Task (0) waybar -l trace  [kitty] <amif> entered output 0x5588c2bde710
[2024-02-09 18:14:23.640] [debug] Task (0) waybar -l trace  [kitty] <amif> now visible on HDMI-A-1
[2024-02-09 18:14:23.640] [debug] Task (0) waybar -l trace  [kitty] <Amif> changed
[2024-02-09 18:14:23.641] [debug] GTK widget tree:
window#waybar.background.top.HDMI-A-1..mode-default:dir(ltr)
  decoration:dir(ltr)
  box.horizontal:dir(ltr)
    box.horizontal.modules-left:dir(ltr)
      widget:dir(ltr)
        label#custom-launcher:dir(ltr)
      widget:dir(ltr)
        box#taskbar.horizontal:dir(ltr)
          button.flat.active:dir(ltr)
            box.horizontal:dir(ltr)
              [label:dir(ltr)]
              image:dir(ltr)
              [label:dir(ltr)]
    box.horizontal.modules-center:dir(ltr)
      widget:dir(ltr)
        box#tray.horizontal:dir(ltr)
      widget:dir(ltr)
        label#custom-updater:dir(ltr)
    box.horizontal.modules-right:dir(ltr)
      widget:dir(ltr)
        label#idle_inhibitor:dir(ltr)
      widget:dir(ltr)
        label#custom-snip:dir(ltr)
      widget:dir(ltr)
        label#cpu:dir(ltr)
      widget:dir(ltr)
        label#memory:dir(ltr)
      widget:dir(ltr)
        label#temperature:dir(ltr)
      widget:dir(ltr)
        box#keyboard-state.horizontal:dir(ltr)
          label.capslock:dir(ltr)
      widget:dir(ltr)
        label#language:dir(ltr)
      widget:dir(ltr)
        label#disk:dir(ltr)
      widget:dir(ltr)
        label#network:dir(ltr)
      widget:dir(ltr)
        label#pulseaudio:dir(ltr)
      widget:dir(ltr)
        label#clock:dir(ltr)
      widget:dir(ltr)
        label#custom-power:dir(ltr)
[2024-02-09 18:14:23.800] [info] Bar configured (width: 3840, height: 35) for output: HDMI-A-1
[2024-02-09 18:14:23.806] [debug] hyprland IPC received openlayer>>waybar
[2024-02-09 18:14:24.901] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:14:24.901] [debug] Cmd exited with code 1
[2024-02-09 18:15:26.974] [debug] Cmd exited with code 1
[2024-02-09 18:15:26.974] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:16:28.694] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:16:28.694] [debug] Cmd exited with code 1
[2024-02-09 18:17:30.452] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:17:30.452] [debug] Cmd exited with code 1
[2024-02-09 18:18:32.232] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:18:32.232] [debug] Cmd exited with code 1
[2024-02-09 18:19:34.008] [debug] Cmd exited with code 1
[2024-02-09 18:19:34.008] [debug] Received SIGCHLD in signalThread
[2024-02-09 18:20:03.323] [debug] hyprland IPC received closelayer>>wallpaper
[2024-02-09 18:20:03.325] [debug] hyprland IPC received closelayer>>waybar
[2024-02-09 18:20:03.326] [debug] hyprland IPC received monitorremoved>>HDMI-A-1
[2024-02-09 18:20:03.327] [debug] hyprland IPC received monitoradded>>HEADLESS-1
[2024-02-09 18:20:03.328] [debug] hyprland IPC received createworkspace>>2
[2024-02-09 18:20:03.400] [debug] Task (0) waybar -l trace  [kitty] <Amif> left output 0x5588c2bde710
[2024-02-09 18:20:03.401] [debug] Task (0) waybar -l trace  [kitty] <Amif> now invisible on HDMI-A-1
[2024-02-09 18:20:03.401] [debug] Output removed: LG Electronics LG ULTRAWIDE
[2024-02-09 18:20:03.401] [debug] Task (0) waybar -l trace  [kitty] <Amif> changed
basic_string::_M_create
[2024-02-09 18:20:03.402] [debug] Output detection done: HEADLESS-1 ()
[2024-02-09 18:20:03.403] [debug] Use custom icon theme: Star
[2024-02-09 18:20:03.408] [warning] module backlight: Disabling module "backlight", No backlight found
[2024-02-09 18:20:03.425] [info] Found device Logitech G512 RGB MECHANICAL GAMING KEYBOARD at '/dev/input/event1'
[2024-02-09 18:20:03.483] [debug] hyprland IPC received openlayer>>wallpaper
[2024-02-09 18:20:03.693] [debug] hyprland IPC received createworkspace>>3
[2024-02-09 18:20:03.695] [debug] hyprland IPC received monitoradded>>HDMI-A-1
[2024-02-09 18:20:03.696] [debug] hyprland IPC received focusedmon>>HDMI-A-1,3
[2024-02-09 18:20:03.697] [debug] hyprland IPC received closelayer>>wallpaper
[2024-02-09 18:20:03.725] [debug] hyprland IPC received monitorremoved>>HEADLESS-1
[2024-02-09 18:20:03.726] [debug] hyprland IPC received workspace>>4
[2024-02-09 18:20:03.727] [debug] hyprland IPC received createworkspace>>4
[2024-02-09 18:20:03.728] [debug] hyprland IPC received moveworkspace>>2,HDMI-A-1
[2024-02-09 18:20:03.729] [debug] hyprland IPC received destroyworkspace>>2
[2024-02-09 18:20:03.730] [debug] hyprland IPC received destroyworkspace>>4
[2024-02-09 18:20:03.806] [debug] hyprland IPC received openlayer>>wallpaper
[2024-02-09 18:20:04.205] [debug] hyprland language initLanguage found Spanish
[2024-02-09 18:20:04.206] [debug] network: new default route via 192.168.29.1 on if2 metric 100
[2024-02-09 18:20:04.206] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:20:04.206] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:20:04.208] [debug] Output removed: Unknown Unknown
[2024-02-09 18:20:04.210] [debug] Task (1) waybar -l trace  [kitty] <Amif> changed
[2024-02-09 18:20:04.210] [debug] GTK widget tree:
window#waybar.background.top..mode-default.HEADLESS-1:dir(ltr)
  decoration:dir(ltr)
  box.horizontal:dir(ltr)
    box.horizontal.modules-left:dir(ltr)
      widget:dir(ltr)
        label#custom-launcher:dir(ltr)
      widget:dir(ltr)
        box#taskbar.horizontal.empty:dir(ltr)
    box.horizontal.modules-center:dir(ltr)
      widget:dir(ltr)
        box#tray.horizontal:dir(ltr)
      widget:dir(ltr)
        label#custom-updater:dir(ltr)
    box.horizontal.modules-right:dir(ltr)
      widget:dir(ltr)
        label#idle_inhibitor:dir(ltr)
      widget:dir(ltr)
        label#custom-snip:dir(ltr)
      widget:dir(ltr)
        label#cpu:dir(ltr)
      widget:dir(ltr)
        label#memory:dir(ltr)
      widget:dir(ltr)
        label#temperature:dir(ltr)
      widget:dir(ltr)
        box#keyboard-state.horizontal:dir(ltr)
          label.capslock:dir(ltr)
      widget:dir(ltr)
        label#language:dir(ltr)
      widget:dir(ltr)
        label#disk:dir(ltr)
      widget:dir(ltr)
        label#network:dir(ltr)
      widget:dir(ltr)
        label#pulseaudio:dir(ltr)
      widget:dir(ltr)
        label#clock:dir(ltr)
      widget:dir(ltr)
        label#custom-power:dir(ltr)

[2024-02-09 18:20:04.211] [debug] Output detection done: HDMI-A-1 (LG Electronics LG ULTRAWIDE 0x00077A5F)
[2024-02-09 18:20:04.211] [debug] Use custom icon theme: Star
[2024-02-09 18:20:04.212] [warning] module backlight: Disabling module "backlight", No backlight found
[2024-02-09 18:20:04.252] [info] Found device Logitech G512 RGB MECHANICAL GAMING KEYBOARD at '/dev/input/event1'
[2024-02-09 18:20:04.911] [debug] hyprland language initLanguage found Spanish
[2024-02-09 18:20:04.912] [debug] network: new default route via 192.168.29.1 on if2 metric 100
[2024-02-09 18:20:04.912] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:20:04.912] [debug] network: enp3s0, new addr 192.168.29.150/24
[2024-02-09 18:20:04.941] [debug] Task (2) waybar -l trace  [kitty] <Amif> changed

Any clues where the error could be?

Best regards D.Sánchez

RobertMueller2 commented 1 month ago

There was in issue when using waybar on hyprland where taskbar icons didn't survive a screen change. I'm speculating now, but perhaps something similar is happening when the output is disabled.

In that case (I was no longer able to replicate the issue with a recent git commit of hyprland), it might be an idea to try again with newer versions of both waybar and hyprland. Compare #2993

dsancheznet commented 1 month ago

Will check it out, thx