diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2025-04-08 09:22:23 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2025-04-08 09:22:23 +0200 |
commit | 908972c6280ee193cd62b4973c51bb3ec3f4987f (patch) | |
tree | 54c7f2cf7889ad6f019c98a2b0d7cc7aa2078289 | |
parent | dcc9194b603006e1463261d0be2dacf0f49d4808 (diff) | |
parent | 044f8b614ce90116c1d1570ab4ab9497eb2a7786 (diff) | |
download | arctica-greeter-908972c6280ee193cd62b4973c51bb3ec3f4987f.tar.gz arctica-greeter-908972c6280ee193cd62b4973c51bb3ec3f4987f.tar.bz2 arctica-greeter-908972c6280ee193cd62b4973c51bb3ec3f4987f.zip |
Merge branch 'tari01-pr/greeter-accelerators'
Attributes GH PR #114: https://github.com/ArcticaProject/arctica-greeter/pull/114
-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); |