mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 08:21:28 +00:00
843ad38b3c
This commit implements the StatusNotifierItem protocol, and enables swaybar to show tray icons. It also uses `xembedsniproxy` in order to communicate with xembed applications. The tray is completely optional, and can be disabled on compile time with the `enable-tray` option. Or on runtime with the bar config option `tray_output none`. Overview of changes: In swaybar very little is changed outside the tray subfolder except that all events are now polled in `event_loop.c`, this creates no functional difference. Six bar configuration options were added, these are detailed in sway-bar(5) The tray subfolder is where all protocol implementation takes place and is organised as follows: tray/sni_watcher.c: This file contains the StatusNotifierWatcher. It keeps track of items and hosts and reports when they come or go. tray/tray.c This file contains the StatusNotifierHost. It keeps track of sway's version of the items and represents the tray itself. tray/sni.c This file contains the StatusNotifierItem struct and all communication with individual items. tray/icon.c This file implements the icon theme protocol. It allows for finding icons by name, rather than by pixmap. tray/dbus.c This file allows for asynchronous DBus communication. See #986 #343
87 lines
1.4 KiB
C
87 lines
1.4 KiB
C
#ifndef _SWAYBAR_CONFIG_H
|
|
#define _SWAYBAR_CONFIG_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "list.h"
|
|
#include "util.h"
|
|
|
|
/**
|
|
* Colors for a box with background, border and text colors.
|
|
*/
|
|
struct box_colors {
|
|
uint32_t border;
|
|
uint32_t background;
|
|
uint32_t text;
|
|
};
|
|
|
|
/**
|
|
* Swaybar config.
|
|
*/
|
|
struct config {
|
|
char *status_command;
|
|
bool pango_markup;
|
|
uint32_t position;
|
|
char *font;
|
|
char *sep_symbol;
|
|
char *mode;
|
|
bool strip_workspace_numbers;
|
|
bool binding_mode_indicator;
|
|
bool wrap_scroll;
|
|
bool workspace_buttons;
|
|
bool all_outputs;
|
|
list_t *outputs;
|
|
|
|
#ifdef ENABLE_TRAY
|
|
// Tray
|
|
char *tray_output;
|
|
char *icon_theme;
|
|
|
|
uint32_t tray_padding;
|
|
uint32_t activate_button;
|
|
uint32_t context_button;
|
|
uint32_t secondary_button;
|
|
#endif
|
|
|
|
int height;
|
|
|
|
struct {
|
|
uint32_t background;
|
|
uint32_t statusline;
|
|
uint32_t separator;
|
|
|
|
uint32_t focused_background;
|
|
uint32_t focused_statusline;
|
|
uint32_t focused_separator;
|
|
|
|
struct box_colors focused_workspace;
|
|
struct box_colors active_workspace;
|
|
struct box_colors inactive_workspace;
|
|
struct box_colors urgent_workspace;
|
|
struct box_colors binding_mode;
|
|
} colors;
|
|
};
|
|
|
|
/**
|
|
* Parse position top|bottom|left|right.
|
|
*/
|
|
uint32_t parse_position(const char *position);
|
|
|
|
/**
|
|
* Parse font.
|
|
*/
|
|
char *parse_font(const char *font);
|
|
|
|
/**
|
|
* Initialize default sway config.
|
|
*/
|
|
struct config *init_config();
|
|
|
|
/**
|
|
* Free config struct.
|
|
*/
|
|
void free_config(struct config *config);
|
|
|
|
#endif /* _SWAYBAR_CONFIG_H */
|