Add click events to i3bar

If the statusline generator (i.e. i3status) specifies click_events:true
in the protocol header, i3bar will write a JSON array on it's stdin
notifying it if the user clicks on a block.

The exact protocol is documented in docs/i3bar-protocol.
This commit is contained in:
enkore
2013-03-21 11:48:27 +01:00
committed by Michael Stapelberg
parent 5adb09c5fc
commit 58e68940f6
6 changed files with 208 additions and 25 deletions

View File

@ -33,6 +33,12 @@ typedef struct {
* The signal requested by the client to inform it of theun hidden state of i3bar
*/
int cont_signal;
/**
* Enable click events
*/
bool click_events;
bool click_events_init;
} i3bar_child;
/*
@ -68,4 +74,10 @@ void stop_child(void);
*/
void cont_child(void);
/*
* Generates a click event, if enabled.
*
*/
void send_block_clicked(int button, const char *name, const char *instance, int x, int y);
#endif

View File

@ -54,6 +54,10 @@ struct status_block {
uint32_t x_offset;
uint32_t x_append;
/* Optional */
char *name;
char *instance;
TAILQ_ENTRY(status_block) blocks;
};