From def5bc5d96fa8543d06812fd5b17315b05dd01ae Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 1 Dec 2020 09:43:36 +0100 Subject: [PATCH] Change volume scale color when over-amplified --- clapper_src/controls.js | 14 +++++++++++++- css/styles.css | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clapper_src/controls.js b/clapper_src/controls.js index 6ebcbb16..20261f48 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -436,8 +436,20 @@ class ClapperControls extends Gtk.Box player.set_volume(linearVolume); - /* FIXME: Should be placed in 'volume-changed' + /* FIXME: All of below should be placed in 'volume-changed' * event once we move to message bus API */ + let cssClass = 'overamp'; + let hasOveramp = (scale.has_css_class(cssClass)); + + if(volume > 1) { + if(!hasOveramp) + scale.add_css_class(cssClass); + } + else { + if(hasOveramp) + scale.remove_css_class(cssClass); + } + this._updateVolumeButtonIcon(volume); } diff --git a/css/styles.css b/css/styles.css index 86d66bdd..6c6992d7 100644 --- a/css/styles.css +++ b/css/styles.css @@ -96,6 +96,9 @@ scale marks { .osd .volumescale trough highlight { min-width: 6px; } +.overamp trough highlight { + background: @error_color; +} /* Floating Mode */ .floatingwindow {