about summary refs log tree commit diff
path: root/src/input.py
blob: 6798ad1f3e7b416ae6f8bc77a119cc647c7e1cc3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import gi
gi.require_version("Gtk", "3.0")

from gi.repository import Gtk
from gi.repository import GObject

class KeyBindings():
    stylesheet = b"""
        @binding-set saneterm-key-bindings {
            bind "<ctrl>u" { "kill-after-output" () };
        }

        * {
             -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)