Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure critical notifications #2271

Closed
alfunx opened this issue May 24, 2018 · 7 comments
Closed

Configure critical notifications #2271

alfunx opened this issue May 24, 2018 · 7 comments
Assignees

Comments

@alfunx
Copy link
Contributor

alfunx commented May 24, 2018

Output of awesome --version:

awesome v4.2-311-g4e17cc6b (Human after all)
• Compiled against Lua 5.3.4 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.6
• LGI version: 0.9.2

How to reproduce the issue:

After overriding naughty.config.presets.critical in the config, send critical notification with naughty.notify and through dbus, e.g. with notify-send (from libnotify).

Actual result:

screenshot

Expected result:

I'd say it would be nice if this were configurable. The current configuration feels like monkey patching, though should work that way, at least according to the docs. Any ideas on how to fix that?

@Elv13
Copy link
Member

Elv13 commented May 25, 2018

I don't have time for this, but I am 95%+ done with it. See #1874 and the various branches and pull requests containing those commits.

It gives you a full API to declare the look of notification like I did for the tasklist/taglist widgets.

If you have some time to complete the code review issues and get more of it merged, it would be immensely appreciated. It's mostly there. I am using it "in production" right now without much issues. It's mostly all the code reviews and iterations that take the time I don't have.

@alfunx
Copy link
Contributor Author

alfunx commented May 25, 2018

Oh right I forgot about that, I think you guys mentioned it in one of my pull requests before.

That looks great. I will try and test it, and see if I'll be able to complete some of the issues. Thanks!

@Elv13
Copy link
Member

Elv13 commented May 29, 2018

I just merged a few commits and taken the opportunity to rebase by branch. It's not perfect and the doc is not 100% up to my standards, but it's good enough for using it

https://elv13.github.io/classes/naughty.widget.box.html
https://elv13.github.io/classes/naughty.notification.html

My notification style:

naughty.disconnect_signal("request::display", naughty.default_notification_handler)

naughty.connect_signal("request::display", function(n)
    local w = naughty.widget.box {
        notification    = n,
        shape           = gears.shape.rounded_bar,
        border_width    = 2,
        placement       = awful.placement.top,
        offset          = 20,
        widget_template = {
            {
                {
                    naughty.widget.icon {notification = n},
                    {
                        naughty.widget.title   {notification = n},
                        naughty.widget.message {notification = n},
                        layout = wibox.layout.fixed.vertical
                    },
                    fill_space = true,
                    layout     = wibox.layout.fixed.horizontal
                },
                naughty.widget.actionlist {notification = n},
                spacing_widget = {
                    forced_height = 10,
                    span_ratio    = 0.9,
                    color = "#ff0000",
                    widget        = wibox.widget.separator
                },
                spacing = 10,
                layout  = wibox.layout.fixed.vertical
            },
            left    = 20,
            right   = 20,
            top     = 5,
            widget  = wibox.container.margin
        },
    }
end)

The branch name is doc_tests_and_notif (in my fork) and contains 10k lines of unfinished things. Among those is the notification system rewrite.

@Elv13 Elv13 self-assigned this Jun 28, 2018
@Elv13
Copy link
Member

Elv13 commented Jun 9, 2019

The rules API for notification will be a better solution, but this is technically now fixed. This assume the code to actually hook into the notification API is added manually to rc.lua. The rule will make integrating this a lot easier.

@Elv13 Elv13 closed this as completed Jun 9, 2019
@mathieufrh
Copy link

I can't manage to get it working. I have the exact same problem. The notification from the widgets inside my awesome wm configuration is configured via naughty presets. But when using notify-send, notifications does not look the same as when using awesome-client.
Can someone help please ?

@Elv13
Copy link
Member

Elv13 commented Jul 12, 2019

@mathieufrh Have you tried with AwesomeWM git-master version? Did you try to enable the new API?

(enabling the new API can be done with this code. It will auto-disable the legacy popups)

naughty.connect_signal("request::display", function(n)
      naughty.layout.box { notification = n }
end)

Note that with the new API, you can theme everything explicitly too and bypass the presets (which I will deprecate soon in favor of an awful.rules like API).

@mathieufrh
Copy link

@Elv13 It's ok. I've tried with the git-master build and it's working fine. I haven't manage to set the critical preset for notifications (using notify-send -u critical ... send notification with the same style as normal norifications). But at least it's consistent now. Encore merci :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants