2016-01-24 02:34:20 +01:00
|
|
|
#ifndef _SWAYBAR_BAR_H
|
|
|
|
#define _SWAYBAR_BAR_H
|
2016-01-23 20:55:01 +01:00
|
|
|
|
|
|
|
#include "client/registry.h"
|
|
|
|
#include "client/window.h"
|
2016-01-24 01:03:08 +01:00
|
|
|
#include "list.h"
|
2016-01-23 20:55:01 +01:00
|
|
|
|
2016-01-24 02:34:20 +01:00
|
|
|
struct bar {
|
|
|
|
struct config *config;
|
2016-01-23 20:55:01 +01:00
|
|
|
struct status_line *status;
|
2016-02-22 17:27:17 +01:00
|
|
|
list_t *outputs;
|
2016-11-02 18:48:43 +01:00
|
|
|
struct output *focused_output;
|
2016-01-23 20:55:01 +01:00
|
|
|
|
|
|
|
int ipc_event_socketfd;
|
|
|
|
int ipc_socketfd;
|
|
|
|
int status_read_fd;
|
2017-08-29 11:19:43 +02:00
|
|
|
int status_write_fd;
|
2016-01-23 20:55:01 +01:00
|
|
|
pid_t status_command_pid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct output {
|
|
|
|
struct window *window;
|
|
|
|
struct registry *registry;
|
|
|
|
list_t *workspaces;
|
2017-06-08 01:45:28 +02:00
|
|
|
#ifdef ENABLE_TRAY
|
|
|
|
list_t *items;
|
|
|
|
#endif
|
2016-01-24 00:23:09 +01:00
|
|
|
char *name;
|
2016-02-22 17:27:17 +01:00
|
|
|
int idx;
|
2016-11-02 18:48:43 +01:00
|
|
|
bool focused;
|
2016-01-23 20:55:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct workspace {
|
|
|
|
int num;
|
|
|
|
char *name;
|
|
|
|
bool focused;
|
|
|
|
bool visible;
|
|
|
|
bool urgent;
|
|
|
|
};
|
|
|
|
|
2016-07-11 05:47:10 +02:00
|
|
|
/** Global bar state */
|
|
|
|
extern struct bar swaybar;
|
|
|
|
|
2017-06-08 01:45:28 +02:00
|
|
|
/** True if sway needs to render */
|
|
|
|
extern bool dirty;
|
|
|
|
|
2016-01-23 20:55:01 +01:00
|
|
|
/**
|
2016-01-24 02:34:20 +01:00
|
|
|
* Setup bar.
|
2016-01-23 20:55:01 +01:00
|
|
|
*/
|
2016-02-22 17:27:17 +01:00
|
|
|
void bar_setup(struct bar *bar, const char *socket_path, const char *bar_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create new output struct from name.
|
|
|
|
*/
|
|
|
|
struct output *new_output(const char *name);
|
2016-01-24 02:19:08 +01:00
|
|
|
|
|
|
|
/**
|
2016-01-24 02:34:20 +01:00
|
|
|
* Bar mainloop.
|
2016-01-24 02:19:08 +01:00
|
|
|
*/
|
2016-01-24 02:34:20 +01:00
|
|
|
void bar_run(struct bar *bar);
|
2016-01-23 20:55:01 +01:00
|
|
|
|
|
|
|
/**
|
2016-01-24 01:03:08 +01:00
|
|
|
* free workspace list.
|
2016-01-23 20:55:01 +01:00
|
|
|
*/
|
2016-01-24 01:03:08 +01:00
|
|
|
void free_workspaces(list_t *workspaces);
|
|
|
|
|
|
|
|
/**
|
2016-01-24 02:34:20 +01:00
|
|
|
* Teardown bar.
|
2016-01-24 01:03:08 +01:00
|
|
|
*/
|
2016-01-24 02:34:20 +01:00
|
|
|
void bar_teardown(struct bar *bar);
|
2016-01-23 20:55:01 +01:00
|
|
|
|
2016-01-24 02:34:20 +01:00
|
|
|
#endif /* _SWAYBAR_BAR_H */
|