commit: ffa14f80c9dd651c1c41bc3f62d6db4452455d7f
parent 7959b868f474a7b1a3238ad6a8b24ba6c23bb5b0
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sun, 3 Jan 2021 07:32:27 +0100
Add VT switching
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/inaban.1 b/inaban.1
@@ -21,6 +21,8 @@ Executes the terminal (defaults to svte).
Moves the window under the cursor around. (ignores focus)
.It Mod+Button2
Resizes the window under the cursor. (ignores focus)
+.It VT1 ... VT12
+Switches to other Virtual Terminals, VT1...12 usually being Ctrl-Alt-F1..F12 in XKB keymaps.
.El
.Sh ENVIRONMENT
.Bl -tag -width Ds
diff --git a/inaban.c b/inaban.c
@@ -60,6 +60,15 @@ keyboard_handle_key(struct wl_listener *listener, void *data)
keycode,
keysym);
+ if(keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12)
+ {
+ struct wlr_session *session = wlr_backend_get_session(server->backend);
+ if (session) {
+ unsigned vt = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
+ wlr_session_change_vt(session, vt);
+ }
+ }
+
for(size_t i = 0; i < LENGTH(shortcuts); i++)
if((keysym == shortcuts[i].keysym) && (modifiers == shortcuts[i].mod) && shortcuts[i].func)
{