Documentation for <wlr/types/wlr_switch.h>

Back to index

Table of contents

struct wlr_switch

struct wlr_switch {
	struct wlr_input_device base;
	
	const struct wlr_switch_impl *impl;
	
	struct {
		struct wl_signal toggle; // struct wlr_switch_toggle_event
	} events;
	
	void *data;
};

A switch input device. Typically a switch input device can indicate whether a laptop lid is opened or closed, or whether tablet mode is enabled.

See https://wayland.freedesktop.org/libinput/doc/latest/switches.html

wlr_switch_from_input_device()

struct wlr_switch *wlr_switch_from_input_device(​struct wlr_input_device *input_device);

Get a struct wlr_switch from a struct wlr_input_device.

Asserts that the input device is a switch.

enum wlr_switch_state

enum wlr_switch_state {
	WLR_SWITCH_STATE_OFF,
	WLR_SWITCH_STATE_ON,
};

struct wlr_switch_toggle_event

struct wlr_switch_toggle_event {
	uint32_t time_msec;
	enum wlr_switch_type switch_type;
	enum wlr_switch_state switch_state;
};

enum wlr_switch_type

enum wlr_switch_type {
	WLR_SWITCH_TYPE_LID,
	WLR_SWITCH_TYPE_TABLET_MODE,
};