diff options
author | Robert Tari <robert@tari.in> | 2023-09-09 08:06:55 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2023-09-09 08:06:55 +0200 |
commit | 8dbb8ab50726131dd97ee87438559da6c46f3fab (patch) | |
tree | 12319d53b69cef6381a5f90a1f32470e7606bdd0 /src/info-notification.vala | |
parent | 5fc752f15c2b0b506d13577cfcae858a28c34f03 (diff) | |
download | ayatana-indicator-sound-8dbb8ab50726131dd97ee87438559da6c46f3fab.tar.gz ayatana-indicator-sound-8dbb8ab50726131dd97ee87438559da6c46f3fab.tar.bz2 ayatana-indicator-sound-8dbb8ab50726131dd97ee87438559da6c46f3fab.zip |
src/info-notification.vala: Drop hint check and create a level indicator
fixes https://github.com/AyatanaIndicators/ayatana-indicator-sound/issues/91
Diffstat (limited to 'src/info-notification.vala')
-rw-r--r-- | src/info-notification.vala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/info-notification.vala b/src/info-notification.vala index bd43a91..1405dfe 100644 --- a/src/info-notification.vala +++ b/src/info-notification.vala @@ -1,6 +1,6 @@ /* * Copyright 2015 Canonical Ltd. - * Copyright 2021 Robert Tari + * Copyright 2021-2023 Robert Tari * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,17 +30,24 @@ public class IndicatorSound.InfoNotification: Notification public void show (VolumeControl.ActiveOutput active_output, double volume, bool is_high_volume) { - if (!notify_server_supports ("x-lomiri-private-synchronous")) - return; /* Determine Label */ - unowned string volume_label = get_notification_label (active_output); + string volume_label = get_notification_label (active_output); /* Choose an icon */ unowned string icon = get_volume_notification_icon (active_output, volume, is_high_volume); /* Reset the notification */ var n = _notification; + + uint nChars = ((int32)((volume * 20) + 0.5)).clamp(0, 20); + volume_label += "\n"; + + for (uint nChar = 0; nChar < nChars; nChar++) + { + volume_label += "◼"; + } + n.update (_("Volume"), volume_label, icon); n.clear_hints(); n.set_hint ("x-lomiri-non-shaped-icon", "true"); |