mirror of
https://github.com/swaywm/sway.git
synced 2026-04-24 06:46:22 -04:00
Compile without tray support
Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
This commit is contained in:
parent
89b97c5346
commit
3d158264e2
13 changed files with 35 additions and 25 deletions
|
|
@ -45,6 +45,9 @@ struct swaybar {
|
||||||
struct wl_list unused_outputs; // swaybar_output::link
|
struct wl_list unused_outputs; // swaybar_output::link
|
||||||
struct wl_list seats; // swaybar_seat::link
|
struct wl_list seats; // swaybar_seat::link
|
||||||
|
|
||||||
|
list_t *basedirs; // char *
|
||||||
|
list_t *themes; // struct swaybar_theme *
|
||||||
|
|
||||||
struct swaybar_window *focused_window;
|
struct swaybar_window *focused_window;
|
||||||
|
|
||||||
// TOOD: Better name
|
// TOOD: Better name
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,8 @@ struct swaybar_config {
|
||||||
struct box_colors binding_mode;
|
struct box_colors binding_mode;
|
||||||
} colors;
|
} colors;
|
||||||
|
|
||||||
#if HAVE_TRAY
|
|
||||||
char *icon_theme;
|
char *icon_theme;
|
||||||
|
#if HAVE_TRAY
|
||||||
struct wl_list tray_bindings; // struct tray_binding::link
|
struct wl_list tray_bindings; // struct tray_binding::link
|
||||||
bool tray_hidden;
|
bool tray_hidden;
|
||||||
list_t *tray_outputs; // char *
|
list_t *tray_outputs; // char *
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ struct swaybar_tray {
|
||||||
list_t *items; // struct swaybar_sni *
|
list_t *items; // struct swaybar_sni *
|
||||||
struct swaybar_watcher *watcher_xdg;
|
struct swaybar_watcher *watcher_xdg;
|
||||||
struct swaybar_watcher *watcher_kde;
|
struct swaybar_watcher *watcher_kde;
|
||||||
|
|
||||||
list_t *basedirs; // char *
|
|
||||||
list_t *themes; // struct swaybar_theme *
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct swaybar_tray *create_tray(struct swaybar *bar);
|
struct swaybar_tray *create_tray(struct swaybar *bar);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "swaybar/ipc.h"
|
#include "swaybar/ipc.h"
|
||||||
#include "swaybar/status_line.h"
|
#include "swaybar/status_line.h"
|
||||||
#include "swaybar/render.h"
|
#include "swaybar/render.h"
|
||||||
|
#include "swaybar/icon.h"
|
||||||
#if HAVE_TRAY
|
#if HAVE_TRAY
|
||||||
#include "swaybar/tray/tray.h"
|
#include "swaybar/tray/tray.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -462,6 +463,7 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
|
||||||
bar->tray = create_tray(bar);
|
bar->tray = create_tray(bar);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
init_themes(&bar->themes, &bar->basedirs);
|
||||||
|
|
||||||
if (bar->config->workspace_buttons) {
|
if (bar->config->workspace_buttons) {
|
||||||
ipc_get_workspaces(bar);
|
ipc_get_workspaces(bar);
|
||||||
|
|
@ -536,6 +538,7 @@ void bar_teardown(struct swaybar *bar) {
|
||||||
#if HAVE_TRAY
|
#if HAVE_TRAY
|
||||||
destroy_tray(bar->tray);
|
destroy_tray(bar->tray);
|
||||||
#endif
|
#endif
|
||||||
|
finish_themes(bar->themes, bar->basedirs);
|
||||||
free_outputs(&bar->outputs);
|
free_outputs(&bar->outputs);
|
||||||
free_outputs(&bar->unused_outputs);
|
free_outputs(&bar->unused_outputs);
|
||||||
free_seats(&bar->seats);
|
free_seats(&bar->seats);
|
||||||
|
|
|
||||||
|
|
@ -129,8 +129,7 @@ void free_config(struct swaybar_config *config) {
|
||||||
wl_list_remove(&tray_bind->link);
|
wl_list_remove(&tray_bind->link);
|
||||||
free_tray_binding(tray_bind);
|
free_tray_binding(tray_bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(config->icon_theme);
|
|
||||||
#endif
|
#endif
|
||||||
|
free(config->icon_theme);
|
||||||
free(config);
|
free(config);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "desktop.h"
|
#include "desktop.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "desktop.h"
|
#include "desktop.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "ipc-client.h"
|
#include "ipc-client.h"
|
||||||
#include "background-image.h"
|
#include "background-image.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
tray_files = have_tray ? [
|
tray_files = have_tray ? [
|
||||||
'tray/host.c',
|
'tray/host.c',
|
||||||
'tray/icon.c',
|
|
||||||
'tray/item.c',
|
'tray/item.c',
|
||||||
'tray/tray.c',
|
'tray/tray.c',
|
||||||
'tray/watcher.c'
|
'tray/watcher.c'
|
||||||
|
|
@ -29,6 +28,7 @@ executable(
|
||||||
'i3bar.c',
|
'i3bar.c',
|
||||||
'input.c',
|
'input.c',
|
||||||
'ipc.c',
|
'ipc.c',
|
||||||
|
'icon.c',
|
||||||
'main.c',
|
'main.c',
|
||||||
'render.c',
|
'render.c',
|
||||||
'status_line.c',
|
'status_line.c',
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include "swaybar/ipc.h"
|
#include "swaybar/ipc.h"
|
||||||
#include "swaybar/render.h"
|
#include "swaybar/render.h"
|
||||||
#include "swaybar/status_line.h"
|
#include "swaybar/status_line.h"
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "background-image.h"
|
#include "background-image.h"
|
||||||
#if HAVE_TRAY
|
#if HAVE_TRAY
|
||||||
|
|
@ -759,9 +759,9 @@ uint32_t render_focused_window_icon(cairo_t *cairo,
|
||||||
// TODO: Load correct theme
|
// TODO: Load correct theme
|
||||||
list_add(themes, "Adwaita");
|
list_add(themes, "Adwaita");
|
||||||
|
|
||||||
assert(output->bar->tray);
|
assert(output->bar);
|
||||||
assert(output->bar->tray->themes);
|
assert(output->bar->themes);
|
||||||
char *icon_path = find_icon(output->bar->tray->themes,
|
char *icon_path = find_icon(output->bar->themes,
|
||||||
basedirs,
|
basedirs,
|
||||||
icon_name,
|
icon_name,
|
||||||
target_size,
|
target_size,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#include "swaybar/config.h"
|
#include "swaybar/config.h"
|
||||||
#include "swaybar/input.h"
|
#include "swaybar/input.h"
|
||||||
#include "swaybar/tray/host.h"
|
#include "swaybar/tray/host.h"
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "swaybar/tray/item.h"
|
#include "swaybar/tray/item.h"
|
||||||
#include "swaybar/tray/tray.h"
|
#include "swaybar/tray/tray.h"
|
||||||
#include "background-image.h"
|
#include "background-image.h"
|
||||||
|
|
@ -410,19 +410,26 @@ static enum hotspot_event_handling icon_hotspot_callback(
|
||||||
return HOTSPOT_PROCESS;
|
return HOTSPOT_PROCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reload_sni(struct swaybar_sni *sni, char *icon_theme,
|
static void reload_sni(struct swaybar_sni *sni,
|
||||||
|
char *icon_theme,
|
||||||
|
list_t *basedirs, // char *
|
||||||
|
list_t *themes, // struct swaybar_theme *
|
||||||
int target_size) {
|
int target_size) {
|
||||||
char *icon_name = sni->status[0] == 'N' ?
|
char *icon_name = sni->status[0] == 'N' ?
|
||||||
sni->attention_icon_name : sni->icon_name;
|
sni->attention_icon_name : sni->icon_name;
|
||||||
if (icon_name) {
|
if (icon_name) {
|
||||||
list_t *icon_search_paths = create_list();
|
list_t *icon_search_paths = create_list();
|
||||||
list_cat(icon_search_paths, sni->tray->basedirs);
|
list_cat(icon_search_paths, basedirs);
|
||||||
if (sni->icon_theme_path) {
|
if (sni->icon_theme_path) {
|
||||||
list_add(icon_search_paths, sni->icon_theme_path);
|
list_add(icon_search_paths, sni->icon_theme_path);
|
||||||
}
|
}
|
||||||
char *icon_path = find_icon(sni->tray->themes, icon_search_paths,
|
char *icon_path = find_icon(themes,
|
||||||
icon_name, target_size, icon_theme,
|
icon_search_paths,
|
||||||
&sni->min_size, &sni->max_size);
|
icon_name,
|
||||||
|
target_size,
|
||||||
|
icon_theme,
|
||||||
|
&sni->min_size,
|
||||||
|
&sni->max_size);
|
||||||
list_free(icon_search_paths);
|
list_free(icon_search_paths);
|
||||||
if (icon_path) {
|
if (icon_path) {
|
||||||
cairo_surface_destroy(sni->icon);
|
cairo_surface_destroy(sni->icon);
|
||||||
|
|
@ -460,7 +467,11 @@ uint32_t render_sni(cairo_t *cairo, struct swaybar_output *output, double *x,
|
||||||
if (target_size != sni->target_size && sni_ready(sni)) {
|
if (target_size != sni->target_size && sni_ready(sni)) {
|
||||||
// check if another icon should be loaded
|
// check if another icon should be loaded
|
||||||
if (target_size < sni->min_size || target_size > sni->max_size) {
|
if (target_size < sni->min_size || target_size > sni->max_size) {
|
||||||
reload_sni(sni, output->bar->config->icon_theme, target_size);
|
reload_sni(sni,
|
||||||
|
output->bar->config->icon_theme,
|
||||||
|
output->bar->basedirs,
|
||||||
|
output->bar->themes,
|
||||||
|
target_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
sni->target_size = target_size;
|
sni->target_size = target_size;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "swaybar/config.h"
|
#include "swaybar/config.h"
|
||||||
#include "swaybar/bar.h"
|
#include "swaybar/bar.h"
|
||||||
#include "swaybar/tray/icon.h"
|
#include "swaybar/icon.h"
|
||||||
#include "swaybar/tray/host.h"
|
#include "swaybar/tray/host.h"
|
||||||
#include "swaybar/tray/item.h"
|
#include "swaybar/tray/item.h"
|
||||||
#include "swaybar/tray/tray.h"
|
#include "swaybar/tray/tray.h"
|
||||||
|
|
@ -67,8 +67,6 @@ struct swaybar_tray *create_tray(struct swaybar *bar) {
|
||||||
init_host(&tray->host_xdg, "freedesktop", tray);
|
init_host(&tray->host_xdg, "freedesktop", tray);
|
||||||
init_host(&tray->host_kde, "kde", tray);
|
init_host(&tray->host_kde, "kde", tray);
|
||||||
|
|
||||||
init_themes(&tray->themes, &tray->basedirs);
|
|
||||||
|
|
||||||
return tray;
|
return tray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +83,6 @@ void destroy_tray(struct swaybar_tray *tray) {
|
||||||
destroy_watcher(tray->watcher_xdg);
|
destroy_watcher(tray->watcher_xdg);
|
||||||
destroy_watcher(tray->watcher_kde);
|
destroy_watcher(tray->watcher_kde);
|
||||||
sd_bus_flush_close_unref(tray->bus);
|
sd_bus_flush_close_unref(tray->bus);
|
||||||
finish_themes(tray->themes, tray->basedirs);
|
|
||||||
free(tray);
|
free(tray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue