From 3f2a6f7b6ceae93ba2e00f270a3a5599766cb0de Mon Sep 17 00:00:00 2001 From: adlo Date: Sat, 24 Dec 2022 07:20:32 +0000 Subject: [PATCH] Add keyboard shortcuts for switching VT --- waybox/seat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/waybox/seat.c b/waybox/seat.c index 2490995..74a94d3 100644 --- a/waybox/seat.c +++ b/waybox/seat.c @@ -58,6 +58,18 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32 * Returns true if the keybinding is handled, false to send it to the * client. */ + + struct wlr_session *session = wlr_backend_get_session (server->backend); + + if (modifiers & (WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT) && + sym >= XKB_KEY_XF86Switch_VT_1 && + sym <= XKB_KEY_XF86Switch_VT_12) { + unsigned int vt = sym - XKB_KEY_XF86Switch_VT_1 + 1; + wlr_session_change_vt (session, vt); + + return true; + } + if (!server->config) { /* Some default key bindings, when the rc.xml file can't be * parsed. */