diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-22 03:05:11 +0200 |
---|---|---|
committer | Sören Tempel <soeren+git@soeren-tempel.net> | 2021-05-22 03:05:11 +0200 |
commit | 36ea4b0b19370182110cf3f76aab99e428ddb46d (patch) | |
tree | 4dd37da106528b71c3fc11a20fed11cc4f6cde99 | |
parent | c76e79fc48903b51421a7b52e356218a87a72f4c (diff) |
Rename input.py to keys.py
Also move default control character mappings to this module.
-rw-r--r-- | saneterm/keys.py (renamed from saneterm/input.py) | 11 | ||||
-rw-r--r-- | saneterm/terminal.py | 13 |
2 files changed, 13 insertions, 11 deletions
diff --git a/saneterm/input.py b/saneterm/keys.py index 29658c3..7cb88d7 100644 --- a/saneterm/input.py +++ b/saneterm/keys.py @@ -1,10 +1,19 @@ +import termios + import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk from gi.repository import GObject -class KeyBindings(): +# Control keys are intercept directly (see DESIGN.md) +CTRL = { + "<ctrl>c": termios.VINTR, + "<ctrl>z": termios.VSUSP, + "<ctrl>d": termios.VEOF, +} + +class Bindings(): stylesheet = b""" @binding-set saneterm-key-bindings { bind "<ctrl>u" { "kill-after-output" () }; diff --git a/saneterm/terminal.py b/saneterm/terminal.py index 075eddd..60d1b24 100644 --- a/saneterm/terminal.py +++ b/saneterm/terminal.py @@ -4,7 +4,7 @@ import os import codecs import termios -import input +import keys from termview import * import gi @@ -17,13 +17,6 @@ from gi.repository import GLib NAME = "saneterm" TERM = "dumb" -# Control keys are intercept directly (see DESIGN.md) -control_keys = { - "<ctrl>c": termios.VINTR, - "<ctrl>z": termios.VSUSP, - "<ctrl>d": termios.VEOF, -} - class PtySource(GLib.Source): master = -1 @@ -75,8 +68,8 @@ class Terminal(Gtk.Window): self.termview.connect("new-user-input", self.user_input) self.termview.connect("termios-ctrlkey", self.termios_ctrl) - bindings = input.KeyBindings(self.termview) - for key, idx in control_keys.items(): + bindings = keys.Bindings(self.termview) + for key, idx in keys.CTRL.items(): bindings.add_bind(key, "termios-ctrlkey", idx) scroll = Gtk.ScrolledWindow().new(None, None) |