From 2b3531fd37fd14d0ef9d0ecee03ad124092bdbc9 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Sat, 4 Nov 2023 14:26:52 +0100 Subject: src/info-notification.vala: Display percentage in the greeter when Orca is enabled --- src/info-notification.vala | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/info-notification.vala b/src/info-notification.vala index 4e246b2..5e67be1 100644 --- a/src/info-notification.vala +++ b/src/info-notification.vala @@ -23,7 +23,19 @@ using Notify; public class IndicatorSound.InfoNotification: Notification { - protected override Notify.Notification create_notification () { + private string sReaderSchema = "org.gnome.desktop.a11y.applications"; + private string sReaderKey = "screen-reader-enabled"; + + protected override Notify.Notification create_notification () + { + string sUser = GLib.Environment.get_user_name (); + + if (sUser == "lightdm") + { + this.sReaderSchema = "org.ArcticaProject.arctica-greeter"; + this.sReaderKey = "screen-reader"; + } + return new Notify.Notification (_("Volume"), "", "audio-volume-muted"); } @@ -40,15 +52,16 @@ public class IndicatorSound.InfoNotification: Notification /* Reset the notification */ var n = _notification; volume_label += "\n"; + int32 nValue = ((int32)((volume * 100.0) + 0.5)).clamp(0, 100); SettingsSchemaSource pSource = SettingsSchemaSource.get_default (); - SettingsSchema pSchema = pSource.lookup ("org.gnome.desktop.a11y.applications", false); + SettingsSchema pSchema = pSource.lookup (this.sReaderSchema, false); bool bOrcaActive = false; if (pSchema != null) { - Settings pSettings = new Settings ("org.gnome.desktop.a11y.applications"); - bOrcaActive = pSettings.get_boolean ("screen-reader-enabled"); + Settings pSettings = new Settings (this.sReaderSchema); + bOrcaActive = pSettings.get_boolean (this.sReaderKey); } if (bOrcaActive) -- cgit v1.2.3