emersion / mako Goto Github PK
View Code? Open in Web Editor NEWA lightweight Wayland notification daemon
Home Page: https://wayland.emersion.fr/mako
License: MIT License
A lightweight Wayland notification daemon
Home Page: https://wayland.emersion.fr/mako
License: MIT License
#43.
If the body of a notification contains something that pango considers to be invalid markup, the markup within the user-specified format will be ignored as well (see screenshot for an example). This is because we're parsing the entire formatted notification at once. This is required to have relative markup work correctly, but it could be made more robust. Here's what I propose:
pango_parse_markup
, without saving the result.escape_markup
function before formatting.This will allow the user's format to continue working (e.g. to display the summary in bold) even when the body is unparseable. It's arguable that this isn't a mako bug, but the result of clients sending notifications that don't follow the spec. However, I've now seen this from two separate programs (including Slack), so it's probably worth putting a bandaid on.
An example of the <
character causing parsing to fail.
cannot parse pango markup: Error on line 2 char 7: '<' is not a valid name
Do we want to use dmenu for this?
Will need xdg-output v2 for that.
To reproduce, notify-send something
and then immediately ^C
mako.
Jun 14 21:50:26 sayaka kernel: mako[19007]: segfault at 8 ip 00007f92b4543947 sp 00007ffe0c8c1b28 error 6 in libwayland-client.so.0.3.0[7f92b453a000+d000]
Jun 14 21:50:26 sayaka systemd[1]: Started Process Core Dump (PID 19035/UID 0).
Jun 14 21:50:26 sayaka systemd-coredump[19038]: Process 19007 (mako) of user 1000 dumped core.
Stack trace of thread 19007:
#0 0x00007f92b4543947 wl_list_remove (libwayland-client.so.0)
#1 0x000055a891f5cde1 n/a (mako)
#2 0x000055a891f5dec5 n/a (mako)
#3 0x000055a891f5b816 n/a (mako)
#4 0x00007f92b41a106b __libc_start_main (libc.so.6)
#5 0x000055a891f5b8aa n/a (mako)
It should behave like --help
, which incidentally tells you that -h
is supposed to work like --help
.
Leftovers from #43.
I started using mako, but I got a problem on startup somehow. I installed it as a systemd user unit, which looks like this:
$ cat /etc/systemd/user/mako.service
[Unit]
Description=mako
Documentation=man:mako(1)
Documentation=https://www.mako-project.org/
PartOf=graphical-session.target
[Service]
Type=dbus
BusName=org.freedesktop.Notifications
ExecStart=/usr/bin/mako
ExecReload=/usr/bin/makoctl reload
[Install]
WantedBy=default.target
When I start it manually it works fine but when it gets started automatically, it fails with:
-- Reboot --
Aug 22 09:33:38 pc mako[1577]: failed to create display
Aug 22 09:33:38 pc systemd[1569]: Starting mako...
Aug 22 09:33:38 pc systemd[1569]: Started mako.
Aug 22 09:33:38 pc systemd[1569]: mako.service: Main process exited, code=exited, status=1/FAILURE
Aug 22 09:33:38 pc systemd[1569]: mako.service: Failed with result 'exit-code'.
I suppose it gets started too early but how do I correct this? Any Idea?
Otherwise: thanks for a nice dropin replacement for dunst .. great work!
Probably better on timed-out messages over clicked ones
Only the notification summary is displayed right now.
It would be nice to have the ability to center notifications on the screen (horizontally, don't know if anyone would want to center them vertically) without manually calculating margins.
If you create a new layer surface each time with wl_output set to NULL, then whenever the notifications come in they'll show up on the last active output.
Hi,
Do you know if it's possible to add animation to notification ( like an animation from right to left, when notification show up. And/Or blur background ) ?
Sorry for my english, it's not my native language...
#43.
In other words, bottom-left
and bottom-right
results in the notifications being glued to the top of the swaybar, regardless of the bottom margin. This isn't the case for the top. Happens in the current version, but not in 1.1. Probably #74?
Maybe implement some sort of filtering system, e..g to be able to style differently notifications coming from a specific app?
Depends on #7, I don't want to add CLI flags for this.
Would be a very welcome addition!
@vilhalmer You've mentioned in #16 that you may do this for --padding
too, have you gotten around to that? Or do you have no need for it?
I'm using Telegram Desktop and, when I receive several messages, the notifications pile up even if they are from the same person. There could be a way to group them and show the title (is it called summary?) only once, at the top.
I am not sure if you would consider this an issue, but I figure its worth pointing out that your project's name conflicts with the well known python template library, Mako.
http://www.makotemplates.org/
https://pypi.org/project/Mako/
This was momentarily confusing when I thought the other Mako made an updated release. :)
It would be great to have icon support in mako. What do you think?
Might be tricky to do this and wrap the text
The function “calloc” does not belong to the list of async-signal-safe functions.
I guess that a different program design will be needed for your function “handle_signal”.
As an example: if you putformat=%s\n%b
in the config file, the notification result wold be Summary\nBody
(those are two value that i'm using for testing).
Debugging the line that mako gets from the config file, you get that the \
char is escaped.
gdb output (breakpoint at config.c:378):
(gdb) p eq + 1
$1 = 0x555555572387 "%s\\n%b"
Are notification chimes something we'd like to implement? Maybe they could be configured based on application with #3?
Taken from my previous issue on playing a notification chime. Perhaps the same rules for #3 could be used to run user-defined scripts so that they could be notification/urgency/etc specific?
Specify a max size in the config. Should ellipsize text that's too long.
The notification body can contain markup, but the notification summary cannot.
Running mako in a terminal in regular X11/i3 causes a segfault. Not a big deal functionally, but might be nice to handle this cleanly.
$ git describe --long --all
heads/master-0-gf66545
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6efc033 in wl_proxy_marshal_constructor (proxy=0x0, opcode=1, interface=0x555555761c80 <wl_registry_interface>) at src/wayland-client.c:824
824 src/wayland-client.c: No such file or directory.
(gdb) bt full
#0 0x00007ffff6efc033 in wl_proxy_marshal_constructor (proxy=0x0, opcode=1, interface=0x555555761c80 <wl_registry_interface>) at src/wayland-client.c:824
args = {{i = 2, u = 2, f = 2, s = 0x2 <error: Cannot access memory at address 0x2>, o = 0x2, n = 2, a = 0x2, h = 2}, {i = 0, u = 0, f = 0, s = 0x0, o = 0x0, n = 0, a = 0x0, h = 0} <repeats 19 times>}
ap = {{gp_offset = 0, fp_offset = 0, overflow_arg_area = 0x0, reg_save_area = 0x0}}
#1 0x000055555555cbf2 in wl_display_get_registry (wl_display=0x0) at /usr/local/include/wayland-client-protocol.h:978
registry = 0x7fffffffe180
#2 0x000055555555db3e in init_wayland (state=0x7fffffffdeb0) at ../wayland.c:263
No locals.
#3 0x000055555555b0bc in init (state=0x7fffffffdeb0) at ../main.c:41
No locals.
#4 0x000055555555b288 in main (argc=1, argv=0x7fffffffe188) at ../main.c:83
state = {config = {font = 0x555555770ec0 "monospace 10", width = 300, height = 100, padding = 5, border_size = 1, markup = true, format = 0x555555770ee0 "<b>%s</b>\n%b", actions = true, margin = {top = 10, right = 10,
bottom = 10, left = 10}, max_visible = 5, output = 0x555555770f00 "", default_timeout = 0, colors = {background = 676689919, text = 4294967295, border = 1282972159}, button_bindings = {
left = MAKO_BUTTON_BINDING_INVOKE_DEFAULT_ACTION, right = MAKO_BUTTON_BINDING_DISMISS, middle = MAKO_BUTTON_BINDING_NONE}}, event_loop = {fds = {{fd = 0, events = 0, revents = 0}, {fd = 0, events = 0,
revents = 0}, {fd = 0, events = 0, revents = 0}}, bus = 0x0, display = 0x0, running = false, timers = {prev = 0x0, next = 0x0}, next_timer = 0x0}, bus = 0x555555771130, xdg_slot = 0x5555557741b0,
mako_slot = 0x5555557740d0, display = 0x0, registry = 0x0, compositor = 0x0, shm = 0x0, layer_shell = 0x0, xdg_output_manager = 0x0, pointers = {prev = 0x7fffffffdfa8, next = 0x7fffffffdfa8}, outputs = {
prev = 0x7fffffffdfb8, next = 0x7fffffffdfb8}, surface = 0x0, surface_output = 0x0, layer_surface = 0x0, layer_surface_output = 0x0, configured = false, scale = 0, width = 0, height = 0, buffers = {{buffer = 0x0,
surface = 0x0, cairo = 0x0, pango = 0x0, width = 0, height = 0, data = 0x0, size = 0, busy = false}, {buffer = 0x0, surface = 0x0, cairo = 0x0, pango = 0x0, width = 0, height = 0, data = 0x0, size = 0,
busy = false}}, current_buffer = 0x0, last_id = 0, notifications = {prev = 0x0, next = 0x0}}
ret = 0
sa = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {0, 18374686479671623680, 71776123339472640, 18446744073709551360, 18446744073709551615, 18374686479671623680, 71776123339472640,
0, 0, 93824994427904, 93824994427152, 0, 0, 0, 0, 0}}, sa_flags = 0, sa_restorer = 0x0}
Hello. All I get when I try to run mako is this line.
Dbus is running, as far as I can see.
message+ 331 0.0 0.0 17256 3160 ? Ss Oct20 3:47 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
sorrow 1467 0.0 0.0 15824 2112 ? Ss Oct26 0:00 /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --session
sorrow 26793 0.0 0.0 15456 2284 ? Ss 03:45 0:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
I'm running sway-1.0-beta1 on gentoo.
Which should read the config again.
Running mako I get this error:
Failed to acquire service name: Permission denied
Following this thread now mako works.
Related issue.
Should be able to set the format to display something like "8 more". Should also be able to hide it with an empty format.
See #43
Which could then be bound to a key.
See e.g. swaywm/sway#2677
(Also see swaywm/sway#2691)
And use the default one instead
When a window is in fullscreen mode, notifications do not show.
I'm running Sway 1.0 alpha 2.
And specify a max number of notifications.
Should it be dunst-compatible?
I would like to point out that an identifier like “_MAKO_CRITERIA_H
” does eventually not fit to the expected naming convention of the C language standard.
Would you like to adjust your selection for unique names?
I occasionally see this error: "no buffer available"
This means we're trying to render but the compositor is still using all of our buffers.
This is solved by waiting for the compositor to tell us to render via the wl_surface.frame
event:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.