about summary refs log tree commit diff
path: root/src/input.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.py')
-rw-r--r--src/input.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/input.py b/src/input.py
new file mode 100644
index 0000000..c6822bd
--- /dev/null
+++ b/src/input.py
@@ -0,0 +1,24 @@
+import gi
+gi.require_version("Gtk", "3.0")
+
+from gi.repository import Gtk
+
+class KeyBindings():
+    stylesheet = b"""
+        @binding-set saneterm-key-bindings {
+            bind "<ctrl>h" { "delete-from-cursor" (chars, -1) };
+        }
+
+        * {
+             -gtk-key-bindings: saneterm-key-bindings;
+        }
+    """
+
+    def __init__(self):
+        self.provider = Gtk.CssProvider()
+        self.provider.load_from_data(self.stylesheet)
+
+    def apply(self, widget):
+        style_ctx = widget.get_style_context()
+        style_ctx.add_provider(self.provider,
+                Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)