Giter Club home page Giter Club logo

mako's Introduction

mako

A lightweight notification daemon for Wayland. Works on Sway.

mako screenshot

mako implements the FreeDesktop Notifications Specification.

Feel free to join the IRC channel: #emersion on irc.libera.chat.

Running

mako will run automatically when a notification is emitted. This happens via D-Bus activation, so you don't really need to explicitly start it up (this also allows delaying its startup time and speed up system startup).

If you have several notification daemons installed though, you might want to explicitly start this one. Some ways of achieving this is:

  • If you're using Sway you can start mako on launch by putting exec mako in your configuration file.

  • If you are not using systemd, you might need to manually start a dbus user session: dbus-daemon --session --address=unix:path=$XDG_RUNTIME_DIR/bus

Configuration

mako can be extensively configured and customized - feel free to read more using the command man 5 mako

For control of mako during runtime, makoctl can be used; see man makoctl

Building

Install dependencies:

  • meson (build-time dependency)
  • wayland
  • pango
  • cairo
  • systemd, elogind or basu (for the sd-bus library)
  • gdk-pixbuf (optional, for icons support)
  • dbus (runtime dependency, user-session support is required)
  • scdoc (optional, for man pages)
  • jq (optional, runtime dependency)

Then run:

meson build
ninja -C build
build/mako

mako

I have a question!

See the faq section in the wiki.

License

MIT

mako's People

Contributors

algmyr avatar b1rger avatar bobsaintcool avatar ddevault avatar dixslyf avatar emantor avatar emersion avatar folliehiyuki avatar fourstepper avatar grahamc avatar hpdeifel avatar ianyfan avatar jbeich avatar kennylevinsen avatar masozzi avatar mikewalrus avatar moverest avatar nefsen402 avatar rianadon avatar rileysu avatar roosemberth avatar ryandwyer avatar sauyon avatar smlx avatar tbm avatar triallax avatar vilhalmer avatar williamvds avatar xdavidwu avatar xpmo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mako's Issues

Support icons

It would be great to have icon support in mako. What do you think?

Directional padding

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?

Add option to group notifications with same title

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.

Center position for notifications

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.

Let us set max width. *feature request*

Hi,

I use both long and short notification in terms of line lenght. I can set width but that's looking ugly for short notification.

See screenshot of what I mean, or maybe honoring the line break and calculate the lenght of the longest line?

2018-10-01-232102_grim
2018-10-01-232201_grim

Segfault when terminating mako with visible notifications

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)

Changing fromat from configuration file does not recognize '\n' character

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"

Use wl_surface.frame events

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:

  • Instead of re-rendering when our state changes, mark the surface as dirty and schedule a frame event
  • When we get a frame event, clear our dirty flag and render

Add animation

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...

Systemd Startup Failure

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!

Failed to connect to system bus: No such file or directory

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.

Segfault running in X

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}

Receiving notification content with invalid pango markup breaks format markup

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:

  • Attempt to parse the body alone using pango_parse_markup, without saving the result.
  • If this reported success, continue as usual.
  • Otherwise, escape the body using the existing escape_markup function before formatting.
  • Parse the entire thing as we do now.

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.


screenshot_2018-07-03-131047
An example of the < character causing parsing to fail.

cannot parse pango markup: Error on line 2 char 7: '<' is not a valid name

mako -h prints error

It should behave like --help, which incidentally tells you that -h is supposed to work like --help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.