mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
swaybar: separate adjacent borders
This commit decouples the surface height from the usable height, making it possible to draw a separator between the workspace/mode and window borders on top (for bottom bars) or bottom (for top bars). The workspace and mode borders also get separated. This behavior is consistent with i3bar.
This commit is contained in:
parent
7e7994dbb2
commit
381c01a622
5 changed files with 85 additions and 67 deletions
|
|
@ -116,7 +116,8 @@ static int cmp_output(const void *item, const void *cmp_to) {
|
|||
return strcmp(item, output->name);
|
||||
}
|
||||
|
||||
uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x) {
|
||||
uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output,
|
||||
double *x, uint32_t height) {
|
||||
struct swaybar_config *config = output->bar->config;
|
||||
if (config->tray_outputs) {
|
||||
if (list_seq_find(config->tray_outputs, cmp_output, output) == -1) {
|
||||
|
|
@ -124,14 +125,14 @@ uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x) {
|
|||
}
|
||||
} // else display on all
|
||||
|
||||
if ((int)(output->height * output->scale) <= 2 * config->tray_padding) {
|
||||
if ((int)(height * output->scale) <= 2 * config->tray_padding) {
|
||||
return (2 * config->tray_padding + 1) / output->scale;
|
||||
}
|
||||
|
||||
uint32_t max_height = 0;
|
||||
struct swaybar_tray *tray = output->bar->tray;
|
||||
for (int i = 0; i < tray->items->length; ++i) {
|
||||
uint32_t h = render_sni(cairo, output, x, tray->items->items[i]);
|
||||
uint32_t h = render_sni(cairo, output, x, height, tray->items->items[i]);
|
||||
if (h > max_height) {
|
||||
max_height = h;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue