Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package mako for openSUSE:Factory checked in at 2022-07-07 12:57:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/mako (Old) and /work/SRC/openSUSE:Factory/.mako.new.1523 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mako" Thu Jul 7 12:57:30 2022 rev:7 rq:987311 version:1.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/mako/mako.changes 2021-07-12 21:40:49.715828912 +0200 +++ /work/SRC/openSUSE:Factory/.mako.new.1523/mako.changes 2022-07-07 12:57:49.803364878 +0200 @@ -1,0 +2,15 @@ +Thu Jul 7 05:16:33 UTC 2022 - Michael Vetter <mvet...@suse.com> + +- Update to 1.7.1: + * Fix inverted has_mode condition + +------------------------------------------------------------------- +Wed Jul 6 17:15:19 UTC 2022 - llyyr <gopalprasa...@gmail.com> + +- Update to 1.7 + * Support for multiple modes active at the same time. + * A new command to list currently active modes. + * Improved HiDPI support. + * A new outer-margin option. + +------------------------------------------------------------------- Old: ---- v1.6.tar.gz New: ---- v1.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ mako.spec ++++++ --- /var/tmp/diff_new_pack.kSJinN/_old 2022-07-07 12:57:50.203365474 +0200 +++ /var/tmp/diff_new_pack.kSJinN/_new 2022-07-07 12:57:50.203365474 +0200 @@ -1,7 +1,7 @@ # # spec file for package mako # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: mako -Version: 1.6 +Version: 1.7.1 Release: 0 Summary: A Wayland notification daemon License: MIT Group: System/GUI/Other URL: https://mako-project.org/ Source: https://github.com/emersion/mako/archive/v%{version}.tar.gz -BuildRequires: meson >= 0.43.0 +BuildRequires: meson >= 0.60.0 BuildRequires: pkgconfig BuildRequires: scdoc BuildRequires: pkgconfig(cairo) @@ -32,7 +32,8 @@ BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(pango) BuildRequires: pkgconfig(wayland-client) -BuildRequires: pkgconfig(wayland-protocols) >= 1.14 +BuildRequires: pkgconfig(wayland-cursor) +BuildRequires: pkgconfig(wayland-protocols) >= 1.21 %description A notification daemon for Wayland. Intended to be used with sway. ++++++ v1.6.tar.gz -> v1.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/.builds/alpine.yml new/mako-1.7.1/.builds/alpine.yml --- old/mako-1.6/.builds/alpine.yml 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/.builds/alpine.yml 2022-07-06 20:50:13.000000000 +0200 @@ -13,7 +13,7 @@ tasks: - setup: | cd mako - meson build/ -Dauto_features=enabled -Dsd-bus-provider=libelogind -Dsystemd=disabled + meson build/ -Dauto_features=enabled -Dsd-bus-provider=libelogind - build: | cd mako ninja -C build/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/.builds/freebsd.yml new/mako-1.7.1/.builds/freebsd.yml --- old/mako-1.6/.builds/freebsd.yml 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/.builds/freebsd.yml 2022-07-06 20:50:13.000000000 +0200 @@ -15,7 +15,7 @@ tasks: - setup: | cd mako - meson build/ -Dauto_features=enabled -Dsd-bus-provider=basu -Dsystemd=disabled + meson build/ -Dauto_features=enabled -Dsd-bus-provider=basu - build: | cd mako ninja -C build/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/config.c new/mako-1.7.1/config.c --- old/mako-1.6/config.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/config.c 2022-07-06 20:50:13.000000000 +0200 @@ -73,6 +73,11 @@ style->width = 300; style->height = 100; + style->outer_margin.top = 0; + style->outer_margin.right = 0; + style->outer_margin.bottom = 0; + style->outer_margin.left = 0; + style->margin.top = 10; style->margin.right = 10; style->margin.bottom = 10; @@ -220,6 +225,11 @@ target->spec.height = true; } + if (style->spec.outer_margin) { + target->outer_margin = style->outer_margin; + target->spec.outer_margin = true; + } + if (style->spec.margin) { target->margin = style->margin; target->spec.margin = true; @@ -390,6 +400,7 @@ // Specify eveything that we'll be combining. target->spec.width = true; target->spec.height = true; + target->spec.outer_margin = true; target->spec.margin = true; target->spec.padding = true; target->spec.border_size = true; @@ -418,6 +429,11 @@ // initialized to zero. target->width = max(style->width, target->width); target->height = max(style->height, target->height); + target->outer_margin.top = max(style->outer_margin.top, target->outer_margin.top); + target->outer_margin.right = max(style->outer_margin.right, target->outer_margin.right); + target->outer_margin.bottom = + max(style->outer_margin.bottom, target->outer_margin.bottom); + target->outer_margin.left = max(style->outer_margin.left, target->outer_margin.left); target->margin.top = max(style->margin.top, target->margin.top); target->margin.right = max(style->margin.right, target->margin.right); target->margin.bottom = @@ -513,6 +529,8 @@ return spec->width = parse_int_ge(value, &style->width, 1); } else if (strcmp(name, "height") == 0) { return spec->height = parse_int_ge(value, &style->height, 1); + } else if (strcmp(name, "outer-margin") == 0) { + return spec->outer_margin = parse_directional(value, &style->outer_margin); } else if (strcmp(name, "margin") == 0) { return spec->margin = parse_directional(value, &style->margin); } else if (strcmp(name, "padding") == 0) { @@ -815,6 +833,7 @@ {"text-color", required_argument, 0, 0}, {"width", required_argument, 0, 0}, {"height", required_argument, 0, 0}, + {"outer-margin", required_argument, 0, 0}, {"margin", required_argument, 0, 0}, {"padding", required_argument, 0, 0}, {"border-size", required_argument, 0, 0}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/contrib/apparmor/fr.emersion.Mako new/mako-1.7.1/contrib/apparmor/fr.emersion.Mako --- old/mako-1.6/contrib/apparmor/fr.emersion.Mako 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/contrib/apparmor/fr.emersion.Mako 1970-01-01 01:00:00.000000000 +0100 @@ -1,23 +0,0 @@ -#include <tunables/global> - -profile fr.emersion.Mako /usr/bin/mako { - #include <abstractions/base> - #include <abstractions/fonts> - #include <abstractions/freedesktop.org> - #include <abstractions/wayland> - - #include <abstractions/dbus-session-strict> - dbus bind - bus=session - name=org.freedesktop.Notifications, - dbus receive - bus=session - path=/fr/emersion/Mako - interface=fr.emersion.Mako, - - /{run,dev}/shm/mako-* rw, - owner @{HOME}/.config/mako/config r, - - # Site-specific additions and overrides. See local/README for details. - #include if exists <local/fr.emersion.Mako> -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/contrib/completions/bash/mako new/mako-1.7.1/contrib/completions/bash/mako --- old/mako-1.6/contrib/completions/bash/mako 1970-01-01 01:00:00.000000000 +0100 +++ new/mako-1.7.1/contrib/completions/bash/mako 2022-07-06 20:50:13.000000000 +0200 @@ -0,0 +1,85 @@ +# mako(1) completion + +_mako() +{ + local cur prev opts + _get_comp_words_by_ref cur prev + + opts=( + '--help' + '-h' + '--config' + '-c' + '--background-color' + '--text-color' + '--width' + '--height' + '--margin' + '--padding' + '--border-size' + '--border-color' + '--border-radius' + '--progress-color' + '--icons' + '--icon-path' + '--max-icon-size' + '--markup' + '--actions' + '--format' + '--hidden-format' + '--max-visible' + '--max-history' + '--history' + '--sort' + '--default-timeout' + '--ignore-timeout' + '--output' + '--layer' + '--anchor' + ) + + case $prev in + -c|--config) + COMPREPLY=($(compgen -f -- "$cur")) + return + ;; + --icons|--markup|--actions|--history|--ignore-timeout) + COMPREPLY=($(compgen -W "0 1" -- "$cur")) + return + ;; + --output) + local outputs + outputs="$(swaymsg -t get_outputs 2>/dev/null | \ + jq -r '.[] | select(.active) | "\(.name)\t\(.make) \(.model)"' 2>/dev/null)" + COMPREPLY=($(compgen -W "$outputs" -- "$cur")) + return + ;; + --layer) + COMPREPLY=($(compgen -W "background bottom top overlay" -- "$cur")) + return + ;; + --anchor) + local pos + pos=( + 'top-right' + 'top-center' + 'top-left' + 'bottom-right' + 'bottom-center' + 'bottom-left' + 'center-right' + 'center-left' + 'center' + ) + COMPREPLY=($(compgen -W "${pos[*]}" -- "$cur")) + return + ;; + esac + + if [[ "$prev" != -* ]]; then + COMPREPLY=($(compgen -W "${opts[*]}" -- "$cur")) + return + fi + +} && +complete -F _mako mako diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/contrib/completions/bash/makoctl new/mako-1.7.1/contrib/completions/bash/makoctl --- old/mako-1.6/contrib/completions/bash/makoctl 1970-01-01 01:00:00.000000000 +0100 +++ new/mako-1.7.1/contrib/completions/bash/makoctl 2022-07-06 20:50:13.000000000 +0200 @@ -0,0 +1,47 @@ +# makoctl(1) completion + +_makoctl() +{ + local cur prev cmds + _get_comp_words_by_ref cur prev + + cmds=( + 'dismiss' + 'restore' + 'invoke' + 'menu' + 'list' + 'reload' + 'set-mode' + 'help' + '-h' + '--help' + ) + + if [[ "$COMP_CWORD" == "1" ]]; then + COMPREPLY=($(compgen -W "${cmds[*]}" -- "$cur")) + return + fi + + case $prev in + dismiss) + COMPREPLY=($(compgen -W "-a --all -g --group -n" -- "$cur")) + return + ;; + invoke) + COMPREPLY=($(compgen -W "-n" -- "$cur")) + return + ;; + menu) + COMPREPLY=($(compgen -c -W "-n" -- "$cur")) + return + ;; + esac + + if [[ "${COMP_WORDS[COMP_CWORD-3]}" == "menu" ]]; then + COMPREPLY=($(compgen -c -- "$cur")) + return + fi + +} && +complete -F _makoctl makoctl diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/contrib/completions/meson.build new/mako-1.7.1/contrib/completions/meson.build --- old/mako-1.6/contrib/completions/meson.build 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/contrib/completions/meson.build 2022-07-06 20:50:13.000000000 +0200 @@ -4,7 +4,7 @@ 'zsh/_makoctl', 'zsh/_mako', ), - install_dir: datadir + '/zsh/site-functions', + install_dir: get_option('datadir') / 'zsh/site-functions', install_mode: 'rw-r--r--', ) endif @@ -13,10 +13,24 @@ fish_files = files('fish/mako.fish', 'fish/makoctl.fish') fish_comp = dependency('fish', required: false) if fish_comp.found() - fish_install_dir = fish_comp.get_pkgconfig_variable('completionsdir') + fish_install_dir = fish_comp.get_variable('completionsdir') else - fish_install_dir = datadir + '/fish/vendor_completions.d' + fish_install_dir = get_option('datadir') / 'fish/vendor_completions.d' endif install_data(fish_files, install_dir: fish_install_dir) endif + +if get_option('bash-completions') + bash_files = files('bash/mako', 'bash/makoctl') + bash_comp = dependency('bash-completion', required: false) + if bash_comp.found() + bash_install_dir = bash_comp.get_variable( + pkgconfig: 'completionsdir', + pkgconfig_define: ['datadir', get_option('datadir')] + ) + else + bash_install_dir = get_option('datadir') / 'bash-completion/completions' + endif + install_data(bash_files, install_dir: bash_install_dir) +endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/contrib/systemd/mako.service new/mako-1.7.1/contrib/systemd/mako.service --- old/mako-1.6/contrib/systemd/mako.service 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/contrib/systemd/mako.service 2022-07-06 20:50:13.000000000 +0200 @@ -3,12 +3,11 @@ Documentation=man:mako(1) PartOf=graphical-session.target After=graphical-session.target -# ConditionEnvironment requires systemd v247 to work correctly -ConditionEnvironment=WAYLAND_DISPLAY [Service] Type=dbus BusName=org.freedesktop.Notifications +ExecCondition=/bin/sh -c '[ -n "$WAYLAND_DISPLAY" ]' ExecStart=/usr/bin/mako ExecReload=/usr/bin/makoctl reload diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/criteria.c new/mako-1.7.1/criteria.c --- old/mako-1.6/criteria.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/criteria.c 2022-07-06 20:50:13.000000000 +0200 @@ -11,6 +11,7 @@ #include "mako.h" #include "config.h" #include "criteria.h" +#include "mode.h" #include "notification.h" #include "surface.h" #include "wayland.h" @@ -152,7 +153,7 @@ return false; } - if (spec.mode && strcmp(criteria->mode, notif->state->current_mode) != 0) { + if (spec.mode && !has_mode(notif->state, criteria->mode)) { return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/dbus/mako.c new/mako-1.7.1/dbus/mako.c --- old/mako-1.6/dbus/mako.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/dbus/mako.c 2022-07-06 20:50:13.000000000 +0200 @@ -9,6 +9,7 @@ #include "surface.h" #include "dbus.h" #include "mako.h" +#include "mode.h" #include "notification.h" #include "wayland.h" @@ -312,8 +313,7 @@ return ret; } - free(state->current_mode); - state->current_mode = strdup(mode); + set_modes(state, &mode, 1); reapply_config(state); @@ -336,6 +336,83 @@ return sd_bus_reply_method_return(msg, ""); } +static int handle_list_modes(sd_bus_message *msg, void *data, + sd_bus_error *ret_error) { + struct mako_state *state = data; + + sd_bus_message *reply = NULL; + int ret = sd_bus_message_new_method_return(msg, &reply); + if (ret < 0) { + return ret; + } + + ret = sd_bus_message_open_container(reply, 'a', "s"); + if (ret < 0) { + return ret; + } + + const char **mode_ptr; + wl_array_for_each(mode_ptr, &state->current_modes) { + ret = sd_bus_message_append_basic(reply, 's', *mode_ptr); + if (ret < 0) { + return ret; + } + } + + ret = sd_bus_message_close_container(reply); + if (ret < 0) { + return ret; + } + + ret = sd_bus_send(NULL, reply, NULL); + if (ret < 0) { + return ret; + } + + sd_bus_message_unref(reply); + return 0; +} + +static int handle_set_modes(sd_bus_message *msg, void *data, + sd_bus_error *ret_error) { + struct mako_state *state = data; + + int ret = sd_bus_message_enter_container(msg, 'a', "s"); + if (ret < 0) { + return ret; + } + + struct wl_array modes_arr; + wl_array_init(&modes_arr); + while (true) { + const char *mode; + ret = sd_bus_message_read(msg, "s", &mode); + if (ret < 0) { + return ret; + } else if (ret == 0) { + break; + } + + const char **dst = wl_array_add(&modes_arr, sizeof(char *)); + *dst = mode; + } + + ret = sd_bus_message_exit_container(msg); + if (ret < 0) { + return ret; + } + + const char **modes = modes_arr.data; + size_t modes_len = modes_arr.size / sizeof(char *); + set_modes(state, modes, modes_len); + + wl_array_release(&modes_arr); + + reapply_config(state); + + return sd_bus_reply_method_return(msg, ""); +} + static const sd_bus_vtable service_vtable[] = { SD_BUS_VTABLE_START(0), SD_BUS_METHOD("DismissAllNotifications", "", "", handle_dismiss_all_notifications, SD_BUS_VTABLE_UNPRIVILEGED), @@ -347,6 +424,8 @@ SD_BUS_METHOD("ListNotifications", "", "aa{sv}", handle_list_notifications, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("Reload", "", "", handle_reload, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("SetMode", "s", "", handle_set_mode, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("ListModes", "", "as", handle_list_modes, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("SetModes", "as", "", handle_set_modes, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_VTABLE_END }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/include/config.h new/mako-1.7.1/include/config.h --- old/mako-1.6/include/config.h 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/include/config.h 2022-07-06 20:50:13.000000000 +0200 @@ -37,7 +37,7 @@ // fields in the mako_style structure should have a counterpart here. Inline // structs are also mirrored. struct mako_style_spec { - bool width, height, margin, padding, border_size, border_radius, font, + bool width, height, outer_margin, margin, padding, border_size, border_radius, font, markup, format, text_alignment, actions, default_timeout, ignore_timeout, icons, max_icon_size, icon_path, group_criteria_spec, invisible, history, icon_location, max_visible, layer, output, anchor; @@ -56,6 +56,7 @@ int32_t width; int32_t height; + struct mako_directional outer_margin; struct mako_directional margin; struct mako_directional padding; int32_t border_size; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/include/dbus.h new/mako-1.7.1/include/dbus.h --- old/mako-1.6/include/dbus.h 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/include/dbus.h 2022-07-06 20:50:13.000000000 +0200 @@ -2,11 +2,11 @@ #define MAKO_DBUS_H #include <stdbool.h> -#ifdef HAVE_LIBSYSTEMD +#if defined(HAVE_LIBSYSTEMD) #include <systemd/sd-bus.h> -#elif HAVE_LIBELOGIND +#elif defined(HAVE_LIBELOGIND) #include <elogind/sd-bus.h> -#elif HAVE_BASU +#elif defined(HAVE_BASU) #include <basu/sd-bus.h> #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/include/event-loop.h new/mako-1.7.1/include/event-loop.h --- old/mako-1.6/include/event-loop.h 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/include/event-loop.h 2022-07-06 20:50:13.000000000 +0200 @@ -5,11 +5,11 @@ #include <stdbool.h> #include <time.h> #include <wayland-client.h> -#ifdef HAVE_LIBSYSTEMD +#if defined(HAVE_LIBSYSTEMD) #include <systemd/sd-bus.h> -#elif HAVE_LIBELOGIND +#elif defined(HAVE_LIBELOGIND) #include <elogind/sd-bus.h> -#elif HAVE_BASU +#elif defined(HAVE_BASU) #include <basu/sd-bus.h> #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/include/mako.h new/mako-1.7.1/include/mako.h --- old/mako-1.6/include/mako.h 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/include/mako.h 2022-07-06 20:50:13.000000000 +0200 @@ -4,11 +4,11 @@ #include <stdbool.h> #include <wayland-client.h> #include <wayland-cursor.h> -#ifdef HAVE_LIBSYSTEMD +#if defined(HAVE_LIBSYSTEMD) #include <systemd/sd-bus.h> -#elif HAVE_LIBELOGIND +#elif defined(HAVE_LIBELOGIND) #include <elogind/sd-bus.h> -#elif HAVE_BASU +#elif defined(HAVE_BASU) #include <basu/sd-bus.h> #endif @@ -60,16 +60,21 @@ struct xdg_activation_v1 *xdg_activation; struct wl_list outputs; // mako_output::link struct wl_list seats; // mako_seat::link - struct wl_cursor_theme *cursor_theme; - const struct wl_cursor_image *cursor_image; - struct wl_surface *cursor_surface; + + struct { + uint32_t size; + uint32_t scale; + struct wl_cursor_theme *theme; + const struct wl_cursor_image *image; + struct wl_surface *surface; + } cursor; struct wl_list surfaces; // mako_surface::link uint32_t last_id; struct wl_list notifications; // mako_notification::link struct wl_list history; // mako_notification::link - char *current_mode; + struct wl_array current_modes; // char * int argc; char **argv; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/include/mode.h new/mako-1.7.1/include/mode.h --- old/mako-1.6/include/mode.h 1970-01-01 01:00:00.000000000 +0100 +++ new/mako-1.7.1/include/mode.h 2022-07-06 20:50:13.000000000 +0200 @@ -0,0 +1,11 @@ +#ifndef MODE_H +#define MODE_H + +#include <stdbool.h> + +struct mako_state; + +bool has_mode(struct mako_state *state, const char *mode); +void set_modes(struct mako_state *state, const char **modes, size_t modes_len); + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/main.c new/mako-1.7.1/main.c --- old/mako-1.6/main.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/main.c 2022-07-06 20:50:13.000000000 +0200 @@ -7,6 +7,7 @@ #include "config.h" #include "dbus.h" #include "mako.h" +#include "mode.h" #include "notification.h" #include "render.h" #include "surface.h" @@ -22,6 +23,9 @@ " --text-color <color> Text color.\n" " --width <px> Notification width.\n" " --height <px> Max notification height.\n" + " --outer-margin <px>[,<px>...] Outer margin values, comma separated.\n" + " Up to four values, with the same\n" + " meaning as in CSS.\n" " --margin <px>[,<px>...] Margin values, comma separated.\n" " Up to four values, with the same\n" " meaning as in CSS.\n" @@ -69,12 +73,18 @@ } wl_list_init(&state->notifications); wl_list_init(&state->history); - state->current_mode = strdup("default"); + wl_array_init(&state->current_modes); + const char *mode = "default"; + set_modes(state, &mode, 1); return true; } static void finish(struct mako_state *state) { - free(state->current_mode); + char **mode_ptr; + wl_array_for_each(mode_ptr, &state->current_modes) { + free(*mode_ptr); + } + wl_array_release(&state->current_modes); struct mako_notification *notif, *tmp; wl_list_for_each_safe(notif, tmp, &state->notifications, link) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/mako.5.scd new/mako-1.7.1/mako.5.scd --- old/mako-1.6/mako.5.scd 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/mako.5.scd 2022-07-06 20:50:13.000000000 +0200 @@ -31,7 +31,7 @@ # BINDING OPTIONS -Bindings allow to perform an action when an event is triggered. Supported +Bindings allow one to perform an action when an event is triggered. Supported values are _none_, _dismiss_, _dismiss-all_, _dismiss-group_, _invoke-default-action_ and _exec <command>_. @@ -92,9 +92,19 @@ Default: 100 +*outer-margin*=_directional_ + Set outer-margin of each edge to the size specified by _directional_. See + *DIRECTIONAL VALUES* for more information. + This margin applies to the outside of the whole notification list. + + Default: 0 + *margin*=_directional_ Set margin of each edge to the size specified by _directional_. See *DIRECTIONAL VALUES* for more information. + This margin applies to each individual notification. + Note that it applies in addition to outer-margin, meaning first and last + notifications will use the sum of both margins. Default: 10 @@ -309,7 +319,7 @@ anchor style option for possible values. There are only two passes performed on each notification, so the second-pass -critera are not allowed to reposition the notification. +criteria are not allowed to reposition the notification. If a field's value contains special characters, they may be escaped with a backslash, or quoted: @@ -373,7 +383,7 @@ - A single value will apply to all four edges. - Two values will set vertical and horizontal edges separately. - Three will set top, horizontal, and bottom edges separately. -- Four will give each edge a separate value. +- Four will set top, right, bottom, and left edges separately. When specifying multiple values, they should be comma-separated. For example, this would set the top margin to 10, left and right to 20, and bottom to five: @@ -403,6 +413,8 @@ *%g* Number of notifications in the current group +*%i* Notification id + ## For the hidden notifications placeholder *%h* Number of hidden notifications @@ -415,7 +427,8 @@ section with a _mode_ criteria will only be applied if the current mode matches. **makoctl**(1) can be used to change the current mode. -The default mode is named "default". +The initial list of modes contains a single mode called "default". This is +deprecated, in a future version the initial list of modes will be empty. For example, to hide all notifications if the mode "do-not-disturb" is enabled: @@ -425,8 +438,8 @@ invisible=1 ``` -_makoctl set-mode do-not-disturb_ will hide all notifications, -_makoctl set-mode default_ will show them again. +_makoctl mode -a do-not-disturb_ will hide all notifications, +_makoctl mode -r do-not-disturb_ will show them again. # AUTHORS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/makoctl new/mako-1.7.1/makoctl --- old/mako-1.6/makoctl 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/makoctl 2022-07-06 20:50:13.000000000 +0200 @@ -21,7 +21,9 @@ echo " notification if none is given" echo " list List notifications" echo " reload Reload the configuration file" - echo " set-mode <name> Switch the current mode" + echo " mode List modes" + echo " mode [-a mode]... [-r mode]... Add/remove modes" + echo " mode -s mode... Set modes" echo " help Show this help" } @@ -39,9 +41,16 @@ fr.emersion.Mako -- "$@" } +require_jq() { + if ! type jq >/dev/null 2>&1; then + echo >&2 "$0: jq is required to use this command" + exit 1 + fi +} + if [ $# -eq 0 ]; then - usage - exit 1 + usage + exit 1 fi case "$1" in @@ -98,10 +107,7 @@ ;; "menu") shift 1 - if ! type jq >/dev/null 2>&1; then - echo >&2 "$0: jq is required to use 'menu'" - exit 1 - fi + require_jq if [ $# -gt 1 ] && [ "$1" = "-n" ]; then id="$2" actions="$(call ListNotifications | jq --arg id "$id" -re '.data[0][] | select(.id.data==($id | tonumber)) | .actions.data')" @@ -130,9 +136,50 @@ "reload") call Reload ;; -"set-mode") +"set-mode") # deprecated call SetMode "s" "$2" ;; +"mode") + shift 1 + require_jq + modes="$(call ListModes | jq '.data[0]')" + add_remove_flag=0 + set_flag=0 + while getopts a:r:s name; do + case "$name" in + a) + add_remove_flag=1 + modes="$(echo "$modes" | jq --arg mode "$OPTARG" '. += [$mode]')" + ;; + r) + add_remove_flag=1 + modes="$(echo "$modes" | jq --arg mode "$OPTARG" 'del(.[] | select(. == $mode))')" + ;; + s) + set_flag=1 + ;; + ?) + exit 1 + esac + done + if [ "$add_remove_flag" = 1 ] && [ "$set_flag" = 1 ]; then + echo >&2 "makoctl: -a/-r and -s cannot be used together" + exit 1 + fi + if [ "$set_flag" = 1 ]; then + shift $(($OPTIND - 1)) + modes="$(jq -n '$ARGS.positional' --args "$@")" + fi + if [ "$add_remove_flag" = 1 ] || [ "$set_flag" = 1 ]; then + modes="$(echo "$modes" | jq '. | unique')" + modes_len="$(echo "$modes" | jq '. | length')" + modes_args=$(echo "$modes" | jq -r '@sh') + # Required to behave properly when mode names contain spaces + eval set -- $modes_args + call SetModes "as" "$modes_len" "$@" + fi + echo "$modes" | jq -r '.[]' + ;; "help"|"--help"|"-h") usage ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/makoctl.1.scd new/mako-1.7.1/makoctl.1.scd --- old/mako-1.6/makoctl.1.scd 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/makoctl.1.scd 2022-07-06 20:50:13.000000000 +0200 @@ -70,8 +70,16 @@ *reload* Reloads the configuration file. -*set-mode* <name> - Switches the current mode to _name_. This replaces the previous mode. +*mode* +*mode* -s <mode>... +*mode* [-a mode]... [-r mode]... + When run without any option, retrieves a list of current modes. + + When run with the _-s_ option, replaces the current modes with the provided + list. + + When run with the _-a_ or _-r_ options, adds or removes the provided mode + from the current modes. See the _MODES_ section in **mako**(5) for more information about modes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/meson.build new/mako-1.7.1/meson.build --- old/mako-1.6/meson.build 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/meson.build 2022-07-06 20:50:13.000000000 +0200 @@ -1,9 +1,9 @@ project( 'mako', 'c', - version: '1.6', + version: '1.7.1', license: 'MIT', - meson_version: '>=0.50.0', + meson_version: '>=0.60.0', default_options: [ 'c_std=c11', 'warning_level=2', @@ -12,12 +12,12 @@ ) add_project_arguments([ + '-Wundef', + '-Wno-unused-parameter', '-Wno-missing-braces', ], language: 'c') -datadir = get_option('datadir') - mako_inc = include_directories('include') cc = meson.get_compiler('c') @@ -34,30 +34,13 @@ epoll = dependency('', required: false) if (not cc.has_function('timerfd_create', prefix: '#include <sys/timerfd.h>') or - not cc.has_function('signalfd', prefix: '#include <sys/signalfd.h>')) + not cc.has_function('signalfd', prefix: '#include <sys/signalfd.h>')) epoll = dependency('epoll-shim') endif if get_option('sd-bus-provider') == 'auto' assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto') - sdbus = dependency('libsystemd', - required: false, - not_found_message: 'libsystemd not found, trying libelogind', - ) - if not sdbus.found() - sdbus = dependency('libelogind', - required: false, - not_found_message: 'libelogind not found, trying basu', - ) - endif - if not sdbus.found() - sdbus = dependency('basu', - required: false, - ) - endif - if not sdbus.found() - error('Neither libsystemd, nor libelogind, nor basu was found') - endif + sdbus = dependency('libsystemd', 'libelogind', 'basu') else sdbus = dependency(get_option('sd-bus-provider')) endif @@ -78,6 +61,7 @@ 'dbus/mako.c', 'dbus/xdg.c', 'main.c', + 'mode.c', 'notification.c', 'pool-buffer.c', 'render.c', @@ -121,22 +105,18 @@ ) conf_data = configuration_data() -conf_data.set('bindir', join_paths(get_option('prefix'), get_option('bindir'))) +conf_data.set('bindir', get_option('prefix') / get_option('bindir')) configure_file( configuration: conf_data, input: 'fr.emersion.mako.service.in', output: '@BASENAME@', - install_dir: datadir + '/dbus-1/services', + install_dir: get_option('datadir') + '/dbus-1/services', ) -scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7') - +scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7', native: true) if scdoc.found() - sh = find_program('sh') - man_pages = ['mako.1.scd', 'mako.5.scd', 'makoctl.1.scd'] - mandir = get_option('mandir') foreach src : man_pages @@ -148,11 +128,17 @@ output, input: src, output: output, - command: [ - sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.get_pkgconfig_variable('scdoc'), output) - ], + command: scdoc.get_variable('scdoc'), + feed: true, + capture: true, install: true, install_dir: '@0@/man@1@'.format(mandir, section) ) endforeach endif + +summary({ + 'sd-bus provider': sdbus.name(), + 'Icons': gdk_pixbuf.found(), + 'Man pages': scdoc.found(), +}, bool_yn: true) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/meson_options.txt new/mako-1.7.1/meson_options.txt --- old/mako-1.6/meson_options.txt 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/meson_options.txt 2022-07-06 20:50:13.000000000 +0200 @@ -3,3 +3,4 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages') option('fish-completions', type: 'boolean', value: false, description: 'Install fish completions') option('zsh-completions', type: 'boolean', value: false, description: 'Install zsh completions') +option('bash-completions', type: 'boolean', value: false, description: 'Install bash completions') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/mode.c new/mako-1.7.1/mode.c --- old/mako-1.6/mode.c 1970-01-01 01:00:00.000000000 +0100 +++ new/mako-1.7.1/mode.c 2022-07-06 20:50:13.000000000 +0200 @@ -0,0 +1,42 @@ +#define _POSIX_C_SOURCE 200809L +#include <stdlib.h> +#include <string.h> +#include <wayland-util.h> + +#include "mako.h" +#include "mode.h" + +bool has_mode(struct mako_state *state, const char *mode) { + const char **mode_ptr; + wl_array_for_each(mode_ptr, &state->current_modes) { + if (strcmp(*mode_ptr, mode) == 0) { + return true; + } + } + return false; +} + +void set_modes(struct mako_state *state, const char **modes, size_t modes_len) { + char **mode_ptr; + wl_array_for_each(mode_ptr, &state->current_modes) { + free(*mode_ptr); + } + state->current_modes.size = 0; + + for (size_t i = 0; i < modes_len; i++) { + // Drop duplicate entries + bool dup = false; + for (size_t j = 0; j < i; j++) { + if (strcmp(modes[i], modes[j]) == 0) { + dup = true; + break; + } + } + if (dup) { + continue; + } + + char **dst = wl_array_add(&state->current_modes, sizeof(char *)); + *dst = strdup(modes[i]); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/notification.c new/mako-1.7.1/notification.c --- old/mako-1.6/notification.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/notification.c 2022-07-06 20:50:13.000000000 +0200 @@ -94,6 +94,15 @@ wl_list_remove(¬if->link); reset_notification(notif); + + free(notif->app_name); + free(notif->app_icon); + free(notif->summary); + free(notif->body); + free(notif->category); + free(notif->desktop_entry); + free(notif->tag); + finish_style(¬if->style); free(notif); } @@ -256,6 +265,8 @@ switch (variable) { case 'a': return strdup(notif->app_name); + case 'i': + return mako_asprintf("%d", notif->id); case 's': return strdup(notif->summary); case 'b': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/protocol/meson.build new/mako-1.7.1/protocol/meson.build --- old/mako-1.6/protocol/meson.build 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/protocol/meson.build 2022-07-06 20:50:13.000000000 +0200 @@ -1,6 +1,6 @@ -wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir') +wl_protocol_dir = wayland_protos.get_variable(pkgconfig: 'pkgdatadir') -wayland_scanner = find_program('wayland-scanner') +wayland_scanner = find_program('wayland-scanner', native: true) # should check wayland_scanner's version, but it is hard to get if wayland_client.version().version_compare('>=1.14.91') @@ -22,19 +22,18 @@ ) client_protocols = [ - [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], - [wl_protocol_dir, 'staging/xdg-activation/xdg-activation-v1.xml'], - [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], - ['wlr-layer-shell-unstable-v1.xml'], + wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml', + wl_protocol_dir / 'staging/xdg-activation/xdg-activation-v1.xml', + wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml', + 'wlr-layer-shell-unstable-v1.xml', ] client_protos_src = [] client_protos_headers = [] foreach p : client_protocols - xml = join_paths(p) - client_protos_src += wayland_scanner_code.process(xml) - client_protos_headers += wayland_scanner_client.process(xml) + client_protos_src += wayland_scanner_code.process(p) + client_protos_headers += wayland_scanner_client.process(p) endforeach lib_client_protos = static_library( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/types.c new/mako-1.7.1/types.c --- old/mako-1.6/types.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/types.c 2022-07-06 20:50:13.000000000 +0200 @@ -14,7 +14,7 @@ #include "types.h" -const char VALID_FORMAT_SPECIFIERS[] = "%asbhtg"; +const char VALID_FORMAT_SPECIFIERS[] = "%asbhtgi"; bool parse_boolean(const char *string, bool *out) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mako-1.6/wayland.c new/mako-1.7.1/wayland.c --- old/mako-1.6/wayland.c 2021-07-11 10:52:44.000000000 +0200 +++ new/mako-1.7.1/wayland.c 2022-07-06 20:50:13.000000000 +0200 @@ -1,5 +1,6 @@ #define _POSIX_C_SOURCE 200809L #include <assert.h> +#include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -63,9 +64,13 @@ .scale = output_handle_scale, }; +static void send_frame(struct mako_surface *surface); + static void create_output(struct mako_state *state, struct wl_output *wl_output, uint32_t global_name) { struct mako_output *output = calloc(1, sizeof(struct mako_output)); + struct mako_surface *surface; + bool recreate_surface = false; if (output == NULL) { fprintf(stderr, "allocation failed\n"); return; @@ -74,11 +79,20 @@ output->global_name = global_name; output->wl_output = wl_output; output->scale = 1; + + recreate_surface = wl_list_empty(&state->outputs); + wl_list_insert(&state->outputs, &output->link); wl_output_set_user_data(wl_output, output); wl_output_add_listener(wl_output, &output_listener, output); get_xdg_output(output); + if (recreate_surface) { + // We had no outputs, force our surfaces to redraw + wl_list_for_each(surface, &output->state->surfaces, link) { + set_dirty(surface); + } + } } static void destroy_output(struct mako_output *output) { @@ -162,6 +176,45 @@ seat->touch.pts[id].surface = NULL; } +static void load_cursor(struct mako_state *state, uint32_t scale) { + const char *cursor_name = "left_ptr"; + + //don't reload the cursor if what we have already can be used + if (state->cursor.theme != NULL && state->cursor.scale == scale) { + return; + } + + if (state->cursor.theme != NULL) { + wl_cursor_theme_destroy(state->cursor.theme); + } + + if (state->cursor.surface == NULL) { + state->cursor.surface = wl_compositor_create_surface(state->compositor); + } + + const char *xcursor_theme = getenv("XCURSOR_THEME"); + state->cursor.theme = wl_cursor_theme_load(xcursor_theme, state->cursor.size * scale, state->shm); + if (state->cursor.theme == NULL) { + fprintf(stderr, "couldn't find a cursor theme\n"); + return; + } + struct wl_cursor *cursor = wl_cursor_theme_get_cursor(state->cursor.theme, cursor_name); + if (cursor == NULL) { + fprintf(stderr, "couldn't find cursor icon \"%s\"\n", cursor_name); + wl_cursor_theme_destroy(state->cursor.theme); + // Set to NULL so it doesn't get free'd again + state->cursor.theme = NULL; + return; + } + + state->cursor.scale = scale; + state->cursor.image = cursor->images[0]; + struct wl_buffer *cursor_buffer = wl_cursor_image_get_buffer(cursor->images[0]); + wl_surface_attach(state->cursor.surface, cursor_buffer, 0, 0); + wl_surface_set_buffer_scale(state->cursor.surface, scale); + wl_surface_commit(state->cursor.surface); +} + static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *wl_surface, wl_fixed_t surface_x, wl_fixed_t surface_y) { @@ -172,10 +225,22 @@ seat->pointer.y = wl_fixed_to_int(surface_y); seat->pointer.surface = get_surface(state, wl_surface); + int scale = 1; + + struct mako_surface *surface; + wl_list_for_each(surface, &state->surfaces, link) { + if (surface->surface_output->scale > scale) { + scale = surface->surface_output->scale; + } + } + // Change the mouse cursor to "left_ptr" - if (state->cursor_theme != NULL) { - wl_pointer_set_cursor(wl_pointer, serial, state->cursor_surface, - state->cursor_image->hotspot_x, state->cursor_image->hotspot_y); + load_cursor(state, scale); + + if (state->cursor.theme != NULL) { + wl_pointer_set_cursor(wl_pointer, serial, state->cursor.surface, + state->cursor.image->hotspot_x / state->cursor.scale, + state->cursor.image->hotspot_y / state->cursor.scale); } } @@ -305,18 +370,25 @@ static void schedule_frame_and_commit(struct mako_surface *state); -static void send_frame(struct mako_surface *surface); static void layer_surface_handle_configure(void *data, struct zwlr_layer_surface_v1 *surface, uint32_t serial, uint32_t width, uint32_t height) { struct mako_surface *msurface = data; + zwlr_layer_surface_v1_ack_configure(surface, serial); + + if (msurface->configured && + msurface->width == (int32_t) width && + msurface->height == (int32_t) height) { + wl_surface_commit(msurface->surface); + return; + } + msurface->configured = true; msurface->width = width; msurface->height = height; - zwlr_layer_surface_v1_ack_configure(surface, serial); send_frame(msurface); } @@ -465,24 +537,8 @@ fprintf(stderr, "Error: XCURSOR_SIZE is invalid\n"); } } - state->cursor_theme = wl_cursor_theme_load(NULL, cursor_size, state->shm); - if (state->cursor_theme == NULL) { - fprintf(stderr, "couldn't find a cursor theme\n"); - return true; - } - struct wl_cursor *cursor = wl_cursor_theme_get_cursor(state->cursor_theme, "left_ptr"); - if (cursor == NULL) { - fprintf(stderr, "couldn't find cursor icon \"left_ptr\"\n"); - wl_cursor_theme_destroy(state->cursor_theme); - // Set to NULL so it doesn't get free'd again - state->cursor_theme = NULL; - return true; - } - state->cursor_image = cursor->images[0]; - struct wl_buffer *cursor_buffer = wl_cursor_image_get_buffer(cursor->images[0]); - state->cursor_surface = wl_compositor_create_surface(state->compositor); - wl_surface_attach(state->cursor_surface, cursor_buffer, 0, 0); - wl_surface_commit(state->cursor_surface); + + state->cursor.size = cursor_size; return true; } @@ -510,9 +566,9 @@ zxdg_output_manager_v1_destroy(state->xdg_output_manager); } - if (state->cursor_theme != NULL) { - wl_cursor_theme_destroy(state->cursor_theme); - wl_surface_destroy(state->cursor_surface); + if (state->cursor.theme != NULL) { + wl_cursor_theme_destroy(state->cursor.theme); + wl_surface_destroy(state->cursor.surface); } zwlr_layer_shell_v1_destroy(state->layer_shell); @@ -560,6 +616,11 @@ static void send_frame(struct mako_surface *surface) { struct mako_state *state = surface->state; + if (wl_list_empty(&state->outputs)) { + surface->dirty = false; + return; + } + int scale = 1; if (surface->surface_output != NULL) { scale = surface->surface_output->scale; @@ -642,6 +703,9 @@ height); zwlr_layer_surface_v1_set_anchor(surface->layer_surface, surface->anchor); + zwlr_layer_surface_v1_set_margin(surface->layer_surface, + style->outer_margin.top, style->outer_margin.right, + style->outer_margin.bottom, style->outer_margin.left); wl_surface_commit(surface->surface); // Now we're going to bail without drawing anything. This gives the