Add last_focused timestamp to containers

A new field `struct timespec last_focused` is added to the
`sway_container_state` struct holding a UNIX timestamp telling when this
container last gained focus.  This timestamp is added to the IPC `get_tree`
JSON output.

The rationale is that it allows users writing their own container manipulation
scripts (e.g., window switchers) to sort containers by last-recently-used
order.
This commit is contained in:
Tassilo Horn 2021-01-06 22:24:03 +01:00
parent 40bdd0eecf
commit c92ecaea6f
3 changed files with 14 additions and 0 deletions

View file

@ -52,6 +52,7 @@ struct sway_container_state {
struct sway_container *focused_inactive_child;
bool focused;
struct timespec last_focused;
enum sway_container_border border;
int border_thickness;