Skip to content

[Bug]: exec-if not clearing in new update if condition is not met #2674

@viceebun

Description

@viceebun

Checklist

  • I have read the appropriate section in the contributing guidelines
  • I believe this issue is a problem with polybar itself and not a misconfiguration on my part
  • I have searched for other open and closed issues that may have already reported this problem
  • I have checked the known issues page for this problem.
  • I have followed the debugging guide to narrow down the problem to a minimal config.

Steps to reproduce

Use an exec-if function in your config and stop meeting the requirement.

Minimal config

[module/mpv]
type = custom/script
exec = playerctl --player=mpv metadata | awk '/title/{print}' | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' | awk '{sub(".mp3","")}1'
exec-if = playerctl --player=mpv status | grep Playing
interval = 0.5
format-underline = #8800FF

click-left = playerctl --player=mpv play-pause
click-middle = killall mpv
click-right = i3-msg "[class="music"] scratchpad show move position 1280 21"
label-active-font = 2

[module/mpv_paused]
type = custom/script
exec = playerctl --player=mpv metadata | awk '/title/{print}' | awk '{for (i=3; i<NF; i++) printf $i " "; print $NF}' | awk '{sub(".mp3","")}1'
exec-if = playerctl --player=mpv status | grep Paused
interval = 0.5
format-foreground = #666
format-underline = #8800FF

click-left = playerctl --player=mpv play-pause
click-middle = killall mpv
click-right = i3-msg "[class="music"] scratchpad show move position 1280 21"
label-active-font = 2

Polybar log

notice: Parsing config file: /home/jimbo/.config/polybar/config.ini
notice: Listening for IPC messages (PID: 586996)
notice: Loading module 'i3' of type 'internal/i3'
notice: Loading module 'xwindow' of type 'internal/xwindow'
notice: Loading module 'mpv' of type 'custom/script'
notice: Loading module 'mpv_paused' of type 'custom/script'
notice: Loading module 'pulseaudio' of type 'internal/pulseaudio'
notice: pulseaudio: using default sink alsa_output.pci-0000_00_1b.0.analog-stereo
notice: Loading module 'updates' of type 'custom/script'
notice: Loading module 'backlight' of type 'custom/script'
notice: Loading module 'weather' of type 'custom/script'
notice: Loading module 'cpu' of type 'internal/cpu'
notice: Loading module 'memory' of type 'internal/memory'
notice: Loading module 'battery' of type 'internal/battery'
notice: Loading module 'date' of type 'internal/date'
notice: Loaded 12 modules
notice: Loaded font "Ubuntu:fontformat=truetype:size=12:antialias=true" (name=Ubuntu, offset=3, file=/usr/share/fonts/ubuntu/Ubuntu-R.ttf)
notice: Loaded font "UbuntuMono Nerd Font:fontformat=truetype:size=12:antialias=true" (name=UbuntuMono Nerd Font, offset=3, file=/usr/share/fonts/TTF/Ubuntu Mono Nerd Font Complete.ttf)
notice: Loaded font "Source Han Sans JP:size=11" (name=Source Han Sans JP, offset=2, file=/usr/share/fonts/adobe-source-han-sans/SourceHanSansJP-Regular.otf)
notice: Loaded font "Source Han Sans KR:size=11" (name=Source Han Sans KR, offset=2, file=/usr/share/fonts/adobe-source-han-sans/SourceHanSansKR-Regular.otf)
notice: Loaded font "pango:Ubuntu 10" (name=Noto Sans, offset=0, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
warn: Ignoring restack of i3 window (not needed when `override-redirect = false`)
error: tray: Failed to put tray above 0x3a00002 in the stack (XCB_MATCH (8))
notice: Received signal(2): Interrupt
notice: Termination signal received, shutting down...
warn: module/i3: Attempting to reconnect socket (reason: Unexpected EOF while reading header)

Expected behavior

When the exec-if function does not meet the expected result, nothing will be displayed and the module will hide itself.

Actual behavior

Module does not hide itself, and is instead left taking up room on the bar (duplicated in the context of my config).

Window Manager and Version

i3-gaps 4.20.1

Linux Distribution

Arch Linux

Polybar version

polybar 3.6.2

Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard

X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor

Build type: Release

Compiler: /sbin/c++

Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wsuggest-override

Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wall -Wextra -Wpedantic -Wsuggest-override -Wall -Wextra -Wpedantic -Wsuggest-override

Additional Context / Screenshots

I have this set up as a script to hook into and show me the current song playing using playerctl. When playing, the first module is executed and called. When paused, it hides the first and shows me the second module. When neither condition is met, they both hide. This behavior works in 3.6.1
image

In 3.6.2, both are able to execute but neither hide when the condition ceases to be met, leaving both modules on screen, even when playerctl gives a blank result to both modules.
2022-04-04_01-27

Tested now on two devices.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions