diff options
author | Robert Tari <robert@tari.in> | 2025-04-04 14:05:44 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2025-04-04 14:05:44 +0200 |
commit | 856bd771744e3a521965676fc020791b24d512fd (patch) | |
tree | 2fbd9469d9a9c32a0bc509930eced190b386f081 /src | |
parent | 7a83daaa89a8c590c8b06ee5cb9b9cb677b2a324 (diff) | |
download | arctica-greeter-856bd771744e3a521965676fc020791b24d512fd.tar.gz arctica-greeter-856bd771744e3a521965676fc020791b24d512fd.tar.bz2 arctica-greeter-856bd771744e3a521965676fc020791b24d512fd.zip |
src/main-window.vala: Toggle a11y states when accelerators are pressed
Diffstat (limited to 'src')
-rw-r--r-- | src/main-window.vala | 95 |
1 files changed, 94 insertions, 1 deletions
diff --git a/src/main-window.vala b/src/main-window.vala index cc72aef..fc8d95a 100644 --- a/src/main-window.vala +++ b/src/main-window.vala @@ -2,7 +2,7 @@ * * Copyright (C) 2011,2012 Canonical Ltd * Copyright (C) 2015-2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> - * Copyright (C) 2023 Robert Tari + * Copyright (C) 2023-2025 Robert Tari * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -553,6 +553,99 @@ public class MainWindow : Gtk.Window return true; } break; + + case Gdk.Key.k: + + if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) + { + bool bActive = AGSettings.get_boolean (AGSettings.KEY_ONSCREEN_KEYBOARD); + + try + { + DBusConnection pConnection = Bus.get_sync (BusType.SESSION); + Variant pActive = new Variant.boolean (!bActive); + Variant pTuple = new Variant("(sva{sv})", "onboard", pActive, null); + pConnection.call ("org.ayatana.indicator.a11y", "/org/ayatana/indicator/a11y", "org.gtk.Actions", "SetState", pTuple, null, DBusCallFlags.NONE, -1, null); + } + catch (Error pError) + { + warning ("%s", pError.message); + } + + return true; + } + + break; + + case Gdk.Key.h: + + if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) + { + AGSettings pSettings = new AGSettings (); + bool bActive = pSettings.high_contrast; + + try + { + DBusConnection pConnection = Bus.get_sync (BusType.SESSION); + Variant pActive = new Variant.boolean (!bActive); + Variant pTuple = new Variant("(sva{sv})", "contrast", pActive, null); + pConnection.call ("org.ayatana.indicator.a11y", "/org/ayatana/indicator/a11y", "org.gtk.Actions", "SetState", pTuple, null, DBusCallFlags.NONE, -1, null); + } + catch (Error pError) + { + warning ("%s", pError.message); + } + + return true; + } + + break; + + case Gdk.Key.s: + + if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) + { + bool bActive = AGSettings.get_boolean (AGSettings.KEY_SCREEN_READER); + + try + { + DBusConnection pConnection = Bus.get_sync (BusType.SESSION); + Variant pActive = new Variant.boolean (!bActive); + Variant pTuple = new Variant("(sva{sv})", "orca", pActive, null); + pConnection.call ("org.ayatana.indicator.a11y", "/org/ayatana/indicator/a11y", "org.gtk.Actions", "SetState", pTuple, null, DBusCallFlags.NONE, -1, null); + } + catch (Error pError) + { + warning ("%s", pError.message); + } + + return true; + } + + break; + + case Gdk.Key.m: + + if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) + { + bool bActive = AGSettings.get_boolean (AGSettings.KEY_MAGNIFIER); + + try + { + DBusConnection pConnection = Bus.get_sync (BusType.SESSION); + Variant pActive = new Variant.boolean (!bActive); + Variant pTuple = new Variant("(sva{sv})", "magnifier", pActive, null); + pConnection.call ("org.ayatana.indicator.a11y", "/org/ayatana/indicator/a11y", "org.gtk.Actions", "SetState", pTuple, null, DBusCallFlags.NONE, -1, null); + } + catch (Error pError) + { + warning ("%s", pError.message); + } + + return true; + } + + break; } return base.key_press_event (event); |