From be2fa743eb494108a03c59553a43cda211cc5ed3 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 27 May 2019 00:05:21 +0200 Subject: [PATCH] refactor(custon): hide on empty text --- resources/custom_modules/mediaplayer.py | 2 +- src/modules/custom.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/custom_modules/mediaplayer.py b/resources/custom_modules/mediaplayer.py index f6171b13..d9caacd7 100755 --- a/resources/custom_modules/mediaplayer.py +++ b/resources/custom_modules/mediaplayer.py @@ -39,7 +39,7 @@ def on_metadata(player, metadata, manager): track_info = '{artist} - {title}'.format(artist=player.get_artist(), title=player.get_title()) - if player.props.status != 'Playing': + if player.props.status != 'Playing' and track_info: track_info = ' ' + track_info write_output(track_info, player) diff --git a/src/modules/custom.cpp b/src/modules/custom.cpp index a2294e5e..f134f980 100644 --- a/src/modules/custom.cpp +++ b/src/modules/custom.cpp @@ -123,8 +123,11 @@ auto waybar::modules::Custom::update() -> void { for (auto const& c : class_) { label_.get_style_context()->add_class(c); } - - event_box_.show(); + if (text_.empty()) { + event_box_.hide(); + } else { + event_box_.show(); + } } }