rootston: add toggle_outputs command

This commit is contained in:
emersion 2018-01-07 00:37:36 +01:00
parent 77fc0505e6
commit e56b82e896
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <stdbool.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/types/wlr_input_device.h> #include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer.h>
@ -85,6 +86,8 @@ static void pressed_keysyms_update(xkb_keysym_t *pressed_keysyms,
static const char *exec_prefix = "exec "; static const char *exec_prefix = "exec ";
static bool outputs_enabled = true;
static void keyboard_binding_execute(struct roots_keyboard *keyboard, static void keyboard_binding_execute(struct roots_keyboard *keyboard,
const char *command) { const char *command) {
struct roots_seat *seat = keyboard->seat; struct roots_seat *seat = keyboard->seat;
@ -119,6 +122,12 @@ static void keyboard_binding_execute(struct roots_keyboard *keyboard,
} }
} else if (strcmp(command, "nop") == 0) { } else if (strcmp(command, "nop") == 0) {
wlr_log(L_DEBUG, "nop command"); wlr_log(L_DEBUG, "nop command");
} else if (strcmp(command, "toggle_outputs") == 0) {
outputs_enabled = !outputs_enabled;
struct roots_output *output;
wl_list_for_each(output, &keyboard->input->server->desktop->outputs, link) {
wlr_output_enable(output->wlr_output, outputs_enabled);
}
} else { } else {
wlr_log(L_ERROR, "unknown binding command: %s", command); wlr_log(L_ERROR, "unknown binding command: %s", command);
} }