focus stack and next/prev toplevel keybinds
This commit is contained in:
+19
-12
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "absinthe-toplevel.h"
|
||||
#include "focus.h"
|
||||
|
||||
void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -19,6 +20,18 @@ void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
|
||||
|
||||
static bool keyboard_handle_keybind(struct absinthe_server *server, xkb_keysym_t keysym)
|
||||
{
|
||||
struct wlr_surface *surface;
|
||||
struct wlr_xdg_toplevel *xdg_toplevel;
|
||||
struct absinthe_toplevel *toplevel;
|
||||
|
||||
surface = server->seat->pointer_state.focused_surface;
|
||||
|
||||
if (surface)
|
||||
xdg_toplevel = wlr_xdg_toplevel_try_from_wlr_surface(surface);
|
||||
|
||||
if (xdg_toplevel)
|
||||
toplevel = xdg_toplevel->base->data;
|
||||
|
||||
switch (keysym) {
|
||||
case XKB_KEY_Escape:
|
||||
wl_display_terminate(server->display);
|
||||
@@ -28,21 +41,15 @@ static bool keyboard_handle_keybind(struct absinthe_server *server, xkb_keysym_t
|
||||
execl("/bin/sh", "sh", "-c", "alacritty", NULL);
|
||||
break;
|
||||
case XKB_KEY_f:
|
||||
struct wlr_surface *surface = server->seat->pointer_state.focused_surface;
|
||||
|
||||
if (!surface)
|
||||
break;
|
||||
|
||||
struct wlr_xdg_toplevel *xdg_toplevel = wlr_xdg_toplevel_try_from_wlr_surface(surface);
|
||||
|
||||
if (!xdg_toplevel)
|
||||
break;
|
||||
|
||||
struct absinthe_toplevel *toplevel = xdg_toplevel->base->data;
|
||||
|
||||
if (toplevel)
|
||||
absinthe_toplevel_set_fullscreen(toplevel, !toplevel->fullscreen);
|
||||
break;
|
||||
case XKB_KEY_j:
|
||||
focus_next(server);
|
||||
break;
|
||||
case XKB_KEY_k:
|
||||
focus_prev(server);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user