Coder Social home page Coder Social logo

toqozz / wired-notify Goto Github PK

View Code? Open in Web Editor NEW
560.0 14.0 27.0 32.37 MB

Lightweight notification daemon with highly customizable layout blocks, written in Rust.

License: MIT License

Rust 94.12% Nix 2.59% Shell 3.29%
notification notification-daemon wired x11

wired-notify's Introduction









Wired

Wired is light and fully customizable notification daemon that provides you with powerful and extensible layout tools.

Features

  • Layout - position every element how you want it, see wiki for more info.
  • Programmable and Interactable Layout Elements - code your own or use layout elements from wired and contributors (accepting pull requests!).
    • Text blocks which scroll.
    • Backgrounds which reflect state (paused, active, extended, etc).
    • Layout elements can fire events on click (open url, etc).
    • More soon.
  • First Class Mouse Actions - close, pause, and open urls within a notification with a click.
    • Open an issue if you have ideas of more actions.
  • Every notification is a different window - pretty sick of stuff only being able to show one notification at a time honestly.

Showcase

Check out what other people have made with Wired!

Config

See the Config wiki page for configuration settings.

Wiki

See the wiki for everything else you need to know about using Wired.

Making your own elements

Making your own layout elements is designed to be as easy as possible. Anybody who knows basic Rust should be able to make a layout element. See the wiki for a detailed tutorial on making and adding a layout element to Wired.

Building

Dependencies

rust, dbus, cairo, pango, glib2, x11, xss (for idle support)

Build and Run

$ git clone https://github.com/Toqozz/wired-notify.git
$ cd wired-notify
$ cargo build --release
$ ./target/release/wired

Installing

AUR

Wired is available on the AUR!

$ yay -S wired

There's also a -git version which tracks master. Beware! No guarantees are made about stability on the master branch. However, I do appreciate any help finding bugs before they make it to a release:

$ yay -S wired-git

Nix (Flakes)

Flake support was added to Nix in version 2.4. As of Nix 2.8, you must enable the nix-command and flakes experimental features.

Wired can be run directly from the repository, using:

nix run 'github:Toqozz/wired-notify'

To install Wired to your user profile:

# note: the systemd service will not be available if installed with this method
nix profile install 'github:Toqozz/wired-notify'

To use it in another flake:

{
  inputs = {
    wired.url = "github:Toqozz/wired-notify";
  };
}

Install for all users in NixOS

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    wired.url = "github:Toqozz/wired-notify";
  };
  outputs = { self, nixpkgs, wired }: let
    std = nixpkgs.lib;
    system = "x86_64-linux";
  in {
    nixosConfigurations.alice = std.nixosSystem {
      inherit system;
      modules = [
        ./configuration.nix
        {
          environment.systemPackages = [ wired.packages.${system}.wired ];
        }
      ];
    };
  };
}

Home-Manager

Standalone

This flake also provides a module for home-manager if you installed it standalone. To use it in your configuration:

{
  # ...
  outputs = { self, nixpkgs, home-manager, wired, ... }: {
    homeConfigurations.alice = let
      system = "x86_64-linux";
    in home-manager.lib.homeManagerConfiguration {
      pkgs = import nixpkgs {
        inherit system;
        overlays = [ wired.overlays.default ];
      };

      modules = [
        wired.homeManagerModules.default
        ({ ... }: {
          services.wired = {
            enable = true;
            config = ./wired.ron;
          };
        })
      ];
    };
  };
}
Home-Manager - NixOS-Module

If you're using home-manager as a NixOS-Module, then you simply need to add the provided overlay and home-manager-module to nixpkgs.overlays and home-manager.sharedModules:

nixpkgs.overlays = [
  inputs.wired-notify.overlays.default
];

home-manager.sharedModules = [
    inputs.wired-notify.homeManagerModules.default
];

then you'll have services.wired in your home-manager config.

NetBSD

Wired is available from the official repositories,

$ pkgin install wired-notify

or, if you prefer to build from source

$ cd /usr/pkgsrc/x11/wired-notify
$ make install

Fedora, CentOs and other RHEL-based distributions

Make sure you have DNF installed, and run the script with sudo permissions, otherwise the necessary dependencies cannot be installed.

$ cd wired-notify
$ chmod +x installer.sh
$ sudo ./installer.sh

Running

The recommended way to start Wired is just to put the following in your autostart script:

/path/to/wired &

There is also a wired.service file in the root of the repository if you want to use systemd. Just copy it to /usr/local/lib/systemd/user/wired.service (or your distro equivalent) and run:

$ systemctl enable --now --user wired.service

wired-notify's People

Contributors

0323pin avatar andresd172 avatar archwand avatar bcspragu avatar beyondmagic avatar blarse avatar christian-rades avatar dependabot[bot] avatar dithpri avatar epsylon42 avatar github-actions[bot] avatar jokeyrhyme avatar jx11r avatar lordmzte avatar lukasdoesdev avatar matanhamilis avatar oddlama avatar pleshevskiy avatar sevenautumns avatar signalwalker avatar tdpeuter avatar toqozz avatar tornaxo7 avatar vuimuich avatar xero-lib 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

wired-notify's Issues

[Documentation] Service file path should start from /etc/systemd/system

man 7 file-hierarchy

GENERAL STRUCTURE
(...)
       /etc/
           System-specific configuration. This directory may or may not be read-only. Frequently, this directory is pre-populated with vendor-supplied configuration files, but
           applications should not make assumptions about this directory being fully populated or populated at all, and should fall back to defaults if configuration is missing.
(...)
VENDOR-SUPPLIED OPERATING SYSTEM RESOURCES
       /usr/
           Vendor-supplied operating system resources. Usually read-only, but this is not required. Possibly shared between multiple hosts. This directory should not be modified by
           the administrator, except when installing or removing vendor-supplied packages.

man 5 systemd.unit

UNIT FILE LOAD PATH
(...)
       Table 1.  Load path when running in system mode (--system).
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚Path                          โ”‚ Description                                                โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/etc/systemd/system.control   โ”‚ Persistent and transient configuration created using the   โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค dbus API                                                   โ”‚
       โ”‚/run/systemd/system.control   โ”‚                                                            โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/run/systemd/transient        โ”‚ Dynamic configuration for transient units                  โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/run/systemd/generator.early  โ”‚ Generated units with high priority (see early-dir in       โ”‚
       โ”‚                              โ”‚ systemd.generator(7))                                      โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/etc/systemd/system           โ”‚ System units created by the administrator                  โ”‚ <----- Here
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/run/systemd/system           โ”‚ Runtime units                                              โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/run/systemd/generator        โ”‚ Generated units with medium priority (see normal-dir in    โ”‚
       โ”‚                              โ”‚ systemd.generator(7))                                      โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/usr/local/lib/systemd/system โ”‚ System units installed by the administrator                โ”‚
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/usr/lib/systemd/system       โ”‚ System units installed by the distribution package manager โ”‚ <----- Not here
       โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
       โ”‚/run/systemd/generator.late   โ”‚ Generated units with low priority (see late-dir in         โ”‚
       โ”‚                              โ”‚ systemd.generator(7))                                      โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

TL;DR: /etc/systemd/system should have units made by the system administrator and /usr/lib/systemd/system should have units from packages.

[Feature request] Tag-based notification replacement

dunst supports string:x-dunst-stack-tag:<tag> hint, which allows both replacing notifications using unpatched notify-send and doing so without having to remember ID on the side of a script. Similar feature would in wired would be very useful for sending notifications from scripts.

Mouse warping to notifications (i3)

On i3 (and I'm assuming any other WM with mouse warping), notifications from wired will often steal the input focus from whatever other application currently has it, additionally causing the cursor to be instantly placed in the center of the notification. This is especially painful when the notification appears on a different monitor, moving your cursor and focus to the notification, and then the window below it once the notification disappears. Vim user? You just threw a lot of odd input at whatever buffer you currently have open. According to this issue, it seems that wired is not setting the proper hints to tell the window manager how to properly handle the notification windows. The issue links to this standards guide, where it looks like the correct hint to fix this is "Passive" input focus, but I have zero real knowledge in this area so I could be talking nonsense. I've also tried no_focus [class="wired"] as suggested in the thread, but this doesn't reliably fix anything, so it looks like it must be fixed on wired's side.

Display and handle notification actions

There should be a way to handle the notification's actions, for example I should be able to set it such that right clicking a notif executes the default action. There should also be a way to see all the actions in the notification. For example, discord notifications come with an action of going to that chat - so if I've configured my right mouse click to the default action, right clicking a discord notification should take me to that chat.

Weird clipping issue

Depending on which window I'm focusing on, this clipping happens. I see it more often while focused and scrolling through my terminal.

weird-clipping.mov

Background Transparency

A feature to make the background of notifications transparent would be great. I could configure picom to make the whole notification transparent, but ideally, there'd be a feature to make just the background transparent. This could be implemented as a config option inNotificationBlock.

Feature: SVG Support

I know SVG isn't easy to play with, but many notification servers have it, so I'm just asking.


Pretty innovative idea though, thank you very much for it.

Notifications blinking when displaying long text with picom

Notifications are blinking when displaying long text with picom running
Sometimes when just one notification is on screen it doesn't happen but since every notification is a new window it shoudn't make a diffrence so I spammed them so it's easier to see

I'm using default configuration with wired from AUR, and here is my picom.conf

Picom running, short text: https://i.imgur.com/zLNpE9V.gif
zLNpE9V

Picom running, long text: https://i.imgur.com/spjtWmX.gif
spjtWmX

Picom killed, short text: https://i.imgur.com/b87TrEN.gif
b87TrEN

Picom killed, long text: https://i.imgur.com/01MzJS8.gif
01MzJS8

Feature: Display notifications on both/multiple/all monitors

I noticed that there's support for focus following the mouse, some notifications are still missed. Having a multi-monitor setup, I often miss notifications if I'm looking at another screen.

To keep this ticket/story/request short and sweet, it would be great to have the ability to display notifications on all monitors simultaneously.

Allow using hint values in TextBlock

I'd like to be able to refer to hint values inside TextBlock#text property.

TextBlock(text: "%p")

Example use case, display the progress value alongside the progress bar.

Idle CPU usage to high

I noticed that in idle while waiting for incoming notifications the COU usage sits relatively constant around 5% or slightly above.
Do you experience this as well?
Other daemons like my hotkey daemon typically use about 0.5% while listening for events.

Reliably vertically and horizontally center NotificationBlock on screen

Would you entertain an easy way to center notifications on any screen size?

(
 name: "root",
 hook: Hook(parent_hook: MM, self_hook: MM), // MM = Middle Middle? Or, BM = Bottom Middle?
 offset: Vec2(x: 0, y: 150),
 params: NotificationBlock(( ... )),
 ...
)

Ultimately I'm interested in making notifications such as the following volume display:
image

crashing when notification closes while mouse is hovering?

here's the output with RUST_BACKTRACE=full

Couldn't load a config because we couldn't find one, so will use default.
Acquired notification bus name.
DBus Init Success.
[src/bus/dbus.rs:251] hints.get("urgency") = Some(
U8(
1,
),
)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/management/mod.rs:208:49
stack backtrace:
0: 0x56224128d090 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h065a832482834301
1: 0x5622412b362f - core::fmt::write::h2b69bbb8432077e1
2: 0x562241289e55 - std::io::Write::write_fmt::h7ba36cb591b30c0e
3: 0x56224128f12b - std::panicking::default_hook::{{closure}}::h4a86d06b0c355a30
4: 0x56224128ebfd - std::panicking::default_hook::hf15750add1a66ef3
5: 0x56224128f74d - std::panicking::rust_panic_with_hook::h890451a2e631ad12
6: 0x56224128f2a7 - std::panicking::begin_panic_handler::{{closure}}::h33319620d050e505
7: 0x56224128d52c - std::sys_common::backtrace::__rust_end_short_backtrace::h41c9a51013c798bc
8: 0x56224128f239 - rust_begin_unwind
9: 0x5622410a4251 - core::panicking::panic_fmt::h4cabb5e7744685f2
10: 0x5622410a419d - core::panicking::panic::h922388c45c3756a7
11: 0x5622410c826c - wired::management::NotifyWindowManager::process_event::hb206944b544f469b
12: 0x5622410fd831 - wired::main::{{closure}}::he400883b0fbe329d
13: 0x5622410f940b - winit::platform_impl::platform::sticky_exit_callback::h4b0235a2b03a5d74
14: 0x5622411067d8 - winit::platform_impl::platform::x11::event_processor::EventProcessor::process_event::h431e38761293b294
15: 0x5622410dd4fd - winit::platform_impl::platform::x11::EventLoop::run_return::hbbe4c1990aca263d
16: 0x56224111a92b - wired::main::h5c9df09baa00d3dd
17: 0x5622410c1fa3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h243499eb11bd21ac
18: 0x56224111cdf9 - std::rt::lang_start::{{closure}}::h7c54d5a0d18cc90c
19: 0x56224128fc4a - std::rt::lang_start_internal::had36925571e04f2b
20: 0x56224111b452 - main
21: 0x7f35bc0c8e0a - __libc_start_main
at /builddir/glibc-2.32/csu/../csu/libc-start.c:314:16
22: 0x5622410a49ca - _start
at /builddir/glibc-2.32/csu/../sysdeps/x86_64/start.S:120
23: 0x0 -

Feature: show notifications on active screen

I think it would be neat if wired would support showing notifications on the current active monitor (so the monitor the active window is on) instead of choosing the monitor number.

Strange behaviour with < and > symbols

Current behaviour

When the title of a notification contains <, then the body is displayed in the title.
For example, when sending a notification with this command notify-send 'title <' 'body' then the text body is displayed in both the title and body of the notification.

Also, the XML entities &lt; and &gt; are displayed as-is and aren't being converted. Other daemons (tested with dunst) do this, and some programs (tested with discord) send notifications with these XML entities, which also don't look right in wired.

Expected behaviour

Notifications containing < in their title should be displayed normally.
XML entities like &lt; and &gt; should be displayed as < and >.

Version information

  • wired version: commit 043f2b2
  • OS: arch linux

My wired config which I can use to reproduce this is available here

Crash on resuming from suspend

Hi there! I've been using wired for a few months now, and sometime within the last few weeks I noticed that if I woke my laptop up from being suspended, I would not get anymore notifications (or in the case of Telegram, I'd get their default notifications). I'm not sure if this will include a whole lot of useful details, but this is the output I get from running wired, then systemctl suspend, and then waking up the machine 30 seconds later.

This is on Arch Linux, if you need details as to what WM I'm running or any package versions or anything let me know and I'll give more details.

> RUST_BACKTRACE=full wired

A wired socket exists; taking ownership.  Existing wired processes will not receive CLI calls.
Acquired notification bus name.
DBus Init Success.
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 4, kind: Interrupted, message: "Interrupted system call" }', /home/alice/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.25.0/src/platform_impl/linux/x11/mod.rs:360:54
stack backtrace:
   0:     0x5561bc4c067c - <unknown>
   1:     0x5561bc4e65ac - <unknown>
   2:     0x5561bc4bc9c5 - <unknown>
   3:     0x5561bc4c2240 - <unknown>
   4:     0x5561bc4c1df7 - <unknown>
   5:     0x5561bc4c28f4 - <unknown>
   6:     0x5561bc4c23d0 - <unknown>
   7:     0x5561bc4c0b24 - <unknown>
   8:     0x5561bc4c2339 - <unknown>
   9:     0x5561bc2a02c1 - <unknown>
  10:     0x5561bc2a03b3 - <unknown>
  11:     0x5561bc2edd37 - <unknown>
  12:     0x5561bc2e4d5b - <unknown>
  13:     0x5561bc32a273 - <unknown>
  14:     0x5561bc310f89 - <unknown>
  15:     0x5561bc4c2efa - <unknown>
  16:     0x5561bc2e55f2 - <unknown>
  17:     0x7f745dd0db25 - __libc_start_main
  18:     0x5561bc2a0a9e - <unknown>
  19:                0x0 - <unknown>

[Request] Hold notifications while screen is off

It would make it easier to see missed notifications if wired would not show them while the screen is turned off (which happens after some time without input by default), and then show them once the screen turns back on so it's easier to catch up on missed notifications.

Trigger action AND close notification in one click

Is it possible to configure my keybinds with wired like this:

  • left click: trigger action and close
  • right click: close notification
  • middle click: close all

Currently, I use this as my shortcut config:

shortcuts: ShortcutsConfig (
    notification_action1: 1,
    notification_close: 2,
    notification_closeall: 3,
)

This almost does it, but it doesn't close the notification when I left click it, but only triggers the action. Is it possible to configure this how I want it? If not, it would be great if a feature like this could be added!

Multiple styles of notifications

Is there a way to have different styles of notifications running concurrently?
Maybe using hints?

string:wired-name:centered:

(
  name: "centered",
  params: NotificationBlock(( ... ))
)

string:wired-style:top-right:

(
  name: "top-right",
  params: NotificationBlock(( ... ))
)

Firefox doesn't detect "action" feature - resulting in using it's own notification system rather than wired

Essentially, I've been having this problem where ever since I switched to wired - Firefox notifications would be quite different from what I configured wired notifications to be to be. After further investigation with an acquaintance, it became clear that it was Firefox's own notification handler, which it used to override my choice of notification daemon for some reason. After even more investigation, it looked like Firefox didn't use wired because wired "didn't advertise" being able to handle notification "actions"

My question here would be how I'd tell it to, well, persuade Firefox that wired indeed does handle them, and also if this is intended behavior. Thank for taking your time.

What's the proper way to start wired?

Hi,
Not so much of an issue, more like a general question.
After packaging wired-notify for NetBSD yesterday, I'm taking it for a spin.

I've added wired & to my LeftWM start-up file and it's working as it should using the default wired.ron for now.
But, I wonder if this is the correct way to do it, since the following shows-up in top

2021-12-20-scrot

As you can see there're several instances running, each using a chuck of RAM. Should I start it as I do with picom, i.e. using something like

if [ -x "$(command -v picom)" ]; then
  picom --config $SCRIPTPATH/picom.conf &> /dev/null &
fi

Thanks!

Percent-escapes being displayed literally

I'm not quite sure what caused this, but I just recently updated wired, and now all my notifications are broken:
image

It seems like the escape codes in the config aren't recognized anymore.

My config is available here. I had a look at the docs, but couldn't find anything that's changed. I'm not sure if this is a bug or not.

Suggestion for implementing keyboard shortcuts

Instead of writing a whole keyboard shortcut system yourself, here is a simpler alternative:
Expose an api, possibly via dbus or a named pipe or a socket, such that you could run $ wired_c notification_close. Then, anyone who wants keyboard shortcuts could set them up via their window manager, or via Autokey or sxhkd or some other prefered keyboard shortcut manager.

Run script on notification receive

It could be handy to have a script being called for each new notification. This would allow to format notification bodies that contain more than plain text (like HTML).

Installation failure

Both wired and wired-git are failing. First one to compile, second one to load sources from git

Dimensions#width->max is ignored

Description

Max width of a TextBox seems to be ignored whenever the text doesn't have spaces and max height is also provided.

notify-send 'vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv' 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

image

Config

    (
        name: "summary",
        parent: "root",
        hook: Hook(parent_anchor: BL, self_anchor: BL),
        offset: Vec2(x: 0.0, y: 0.0),
        // https://github.com/Toqozz/wired-notify/wiki/TextBlock
        params: TextBlock((
                text: "%s",
                font: "Arial Bold 16",
                ellipsize: End,
                color: Color(hex: "#ffffff"),
                padding: Padding(left: 0.0, right: 0.0, top: 0.0, bottom: 0.0),
                dimensions: (width: (min: -1, max: 500), height: (min: 100, max: 100)),
        )),
    ),

    (
        name: "body",
        parent: "summary",
        hook: Hook(parent_anchor: BL, self_anchor: BL),
        offset: Vec2(x: 0.0, y: 0.0),
        // https://github.com/Toqozz/wired-notify/wiki/ScrollingTextBlock
        params: TextBlock((
                text: "%b",
                font: "Arial 14",
                ellipsize: End,
                color: Color(hex: "#ffffff"),
                padding: Padding(left: 0, right: 0, top: 0, bottom: 0),
                dimensions: (width: (min: -1, max: 500), height: (min: 0, max: 0)),
                scroll_speed: 0.1,
                lhs_dist: 35.0,
                rhs_dist: 35.0,
                scroll_t: 1.0,
        )),
    ),

Getting Orca to Read Notifications

Greetings,

I recently discovered this utility while looking for things to replace the original notification-daemon ๏ปฟthat I am using on my system, due to its strange limitations. Unfortunately, I have hit somewhat of a snag in switching to wired, in that I can't get orca to read the notification messages. For those unaware, Orca is the desktop screenreader for Linux, which allows blind people to use applications. What are some things I can try to fix the issue?

For reference, I am running Arch Linux, Stumpwm 20.11, and Orca from the latest master.

Thanks!

API support

Hi, just found your notification daemon, and I'm quite interested. But the thing I spot right away is that there's no API, apparently.
And it is quite problematic for someone who loves keyboard driven control.

I would love to see how you can from terminal

  • close notification
  • show last N notifications
  • execute action 1, 2... (same as mouse actions)
  • manipulate layout
  • create a notification - notify-send is kind of limited

I might be completely wrong and there are all of these things, idk...
Been using wired for just about 15 minutes)

Can't figure out how to properly move notifications to the right corner

While trying to move notifications to top-right corner, I end up with this config

// ...
    min_window_width: 400,
    layout_blocks: [
        (
            name: "root",
            parent: "",
            hook: Hook(parent_anchor: TR, self_anchor: TR),
            offset: Vec2(x: -7.0, y: 30.0),
            // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
            params: NotificationBlock((
                monitor: 0,
                border_width: 1.0,
                border_rounding: 0.0,
                //background_color: Color(r: 0.15686, g: 0.15686, b: 0.15686, a: 1.0),
                background_color: Color(hex: "#0C0E15"),
                border_color: Color(hex: "#282828"),
                border_color_low: Color(hex: "#282828"),
                border_color_critical: Color(hex: "#fb4934"),
                border_color_paused: Color(hex: "#fabd2f"),

                gap: Vec2(x: 0.0, y: 8.0),
                notification_hook: Hook(parent_anchor: BL, self_anchor: TL),
            )),
        ),
// ...

It's okay, but now longer notifications renders outside of screen, while there is shorter notifications above
image

And shorter notifications appears aligned to right side of longer notification
image

So how I configure anchors to achieve optimal behaviour?

Something wrong is not right ('main' panicked at 'called `Result::unwrap()`)

This seems to happen when I start to strip down the notification blocks:

notify-send -h int:value:"13" -h string:wired-tag:volume "13%"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: XError { description: "BadValue (integer parameter out of range for operation)", error_code: 2, request_code: 12, minor_code: 0 }', /home/lukas/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.25.0/src/platform_impl/linux/x11/window.rs:1017:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    layout_blocks: [
        (
            name: "root",
            parent: "",
            hook: Hook(parent_anchor: MM, self_anchor: MM),
            offset: Vec2(x: 0.0, y: 0.0),
            // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
            params: NotificationBlock((
                    monitor: 0,
                    border_width: 0.0,
                    border_rounding: 15.0,
                    background_color: Color(hex: "#D3D3D3"),
                    border_color: Color(hex: "#00000000"),
                    border_color_low: Color(hex: "#00000000"),
                    border_color_critical: Color(hex: "#FF0000"),
                    border_color_paused: Color(hex: "#00000000"),
                    gap: Vec2(x: 0.0, y: 8.0),
                    notification_hook: Hook(parent_anchor: BL, self_anchor: TL),
            )),
        ),

        (
            name: "image",
            parent: "root",
            hook: Hook(parent_anchor: MM, self_anchor: MM),
            offset: Vec2(x: 0.0, y: 0.0),
            render_criteria: [HintImage],
            // https://github.com/Toqozz/wired-notify/wiki/ImageBlock
            params: ImageBlock((
                    image_type: Hint,
                    // We actually want 4px padding, but the border is 3px.
                    padding: Padding(left: 7.0, right: 0.0, top: 7.0, bottom: 7.0),
                    rounding: 3.0,
                    scale_width: 48,
                    scale_height: 48,
                    filter_mode: Lanczos3,
            )),
        ),

        (
            name: "progress",
            parent: "root",
            hook: Hook(parent_anchor: BM, self_anchor: TM),
            offset: Vec2(x: 0.0, y: 0.0),
            render_criteria: [Progress],
            params: ProgressBlock((
                    padding: Padding(left: 3.0, right: 3.0, top: 3.0, bottom: 3.0),
                    border_width: 3.0,
                    border_rounding: 15.0,
                    border_color: Color(hex: "#ebdbb2"),
                    fill_rounding: 10.0,
                    background_color: Color(hex: "#000000"),
                    fill_color: Color(hex: "#ffffff"),
                    width: -1.0,
                    height: 30.0,
                    border_color_hovered: Color(hex: "#fbf1c7"),
                    background_color_hovered: Color(hex: "#3c3836"),
                    fill_color_hovered: Color(hex: "#fbf1c7"),
            )),
        ),
    ],

wayland support?

Howdie, thanks so much for sharing your work here, wired is working terrifically for me! <3

I thought I'd create a dedicated issue for this conversation ( although there are mentions #34 (comment) and #34 (comment) )

I've been using wired with both sway and river compositors (wayland) and I'd like to report that it's working very well

I do see fuzzy font issues when running it on a high-density display with scale=2.0 , which is typical when running an X11 application via xwayland within a wayland compositor

That said, for my use case, I read a notification quickly and then it goes away, I'm not reading this fuzzy text for very long so it doesn't seem super important to me

So, yeah, I thought maybe it would be good to track a decision/reports/progress on wayland, if only to address the fuzzy fonts at scale=2.0 (might become more of a problem as more distributions go wayland-by-default)

Thanks again!

Edit: adding this checklist (to help summarise items from comments)

minimum required to start without crashing and to display something

  • need a wayland-friendly way of getting a cairo context/surface without using xlib (ignoring transparency to start with)
  • need to use winit::event_loop::EventLoop::new() instead of winit::event_loop::EventLoop::new_x11()
  • data for focus_follows: Mouse|Window should only be interrogated when layouts specify monitor: -1 (would help unblock some wayland use cases, and is a possible optimisation), see: #89

feature parity for wayland

Show off your Wired config here!

It's about time we had something like this.

Uploading your wired.ron file alongside a screenshot is encouraged but not mandatory.

Note: you can format your config like the following to make the code block collapsible:

<details><summary>Config</summary>

```rust
<!-- your config here -->
```

</details>

Here's the default Wired config -- pretty simple!:

image

Config
    layout_blocks: [
        // Layout 1, when an image is present.
        (
            name: "root",
            parent: "",
            hook: Hook(parent_anchor: TL, self_anchor: TL),
            offset: Vec2(x: 7.0, y: 7.0),
            //render_criteria: [HintImage],
            // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
            params: NotificationBlock((
                monitor: 0,
                border_width: 3.0,
                border_rounding: 3.0,
                //background_color: Color(r: 0.15686, g: 0.15686, b: 0.15686, a: 1.0),
                background_color: Color(hex: "#282828"),
                border_color: Color(hex: "#ebdbb2"),
                border_color_low: Color(hex: "#282828"),
                border_color_critical: Color(hex: "#fb4934"),
                border_color_paused: Color(hex: "#fabd2f"),

                gap: Vec2(x: 0.0, y: 8.0),
                notification_hook: Hook(parent_anchor: BL, self_anchor: TL),
            )),
        ),

        (
            name: "image",
            parent: "root",
            hook: Hook(parent_anchor: TL, self_anchor: TL),
            offset: Vec2(x: 0.0, y: 0.0),
            // https://github.com/Toqozz/wired-notify/wiki/ImageBlock
            params: ImageBlock((
                image_type: Hint,
                // We actually want 4px padding, but the border is 3px.
                padding: Padding(left: 7.0, right: 0.0, top: 7.0, bottom: 7.0),
                rounding: 3.0,
                scale_width: 48,
                scale_height: 48,
                filter_mode: Lanczos3,
            )),
        ),

        (
            name: "summary",
            parent: "image",
            hook: Hook(parent_anchor: MR, self_anchor: BL),
            offset: Vec2(x: 0.0, y: 0.0),
            // https://github.com/Toqozz/wired-notify/wiki/TextBlock
            params: TextBlock((
                text: "%s",
                font: "Arial Bold 11",
                ellipsize: Middle,
                color: Color(hex: "#ebdbb2"),
                color_hovered: Color(hex: "#fbf1c7"),
                padding: Padding(left: 7.0, right: 7.0, top: 7.0, bottom: 0.0),
                dimensions: (width: (min: 50, max: 150), height: (min: 0, max: 0)),
            )),
        ),

        (
            name: "body",
            parent: "summary",
            hook: Hook(parent_anchor: BL, self_anchor: TL),
            offset: Vec2(x: 0.0, y: -3.0),
            // https://github.com/Toqozz/wired-notify/wiki/ScrollingTextBlock
            params: ScrollingTextBlock((
                text: "%b",
                font: "Arial 11",
                color: Color(hex: "#ebdbb2"),
                color_hovered: Color(hex: "#fbf1c7"),
                padding: Padding(left: 7.0, right: 7.0, top: 3.0, bottom: 7.0),
                width: (min: 150, max: 250),
                scroll_speed: 0.1,
                lhs_dist: 35.0,
                rhs_dist: 35.0,
                scroll_t: 1.0,
            )),
        ),
    ],

Error when i tried build using Cargo

Today I tried to compile Wired Notify following the instructions in the readme file, but when I ran cargo build --release Cargo gave me the following error:
2022-02-18-210724_1226x169_scrot
and I cannot continue the build, can someone help me with my problem?

Thx <3!

Create wired-git AUR package

A wired-git AUR package in addition to the current wired package would be great for users who want to be on the newest version of wired.

wired-git AUR package failing to build

It seems like the wired-git AUR package is unable to retrieve the wired sources due to some changes on github's side. Here's the output:

$ paru -S wired-git
:: Resolving dependencies...
:: Calculating conflicts...
:: Calculating inner conflicts...

Aur (1) wired-git-r163.4460e60-1

:: Proceed to review? [Y/n]:

:: Downloading PKGBUILDs...
 PKGBUILDs up to date
 nothing new to review
fetching devel info...
error: failed to lookup: wired-git: fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.

==> Making package: wired-git r163.4460e60-1 (Sun 17 Apr 2022 02:06:11 PM CEST)
==> Retrieving sources...
  -> Cloning wired-notify git repo...
Cloning into bare repository '/home/lordmzte/.cache/paru/clone/wired-git/wired-notify'...
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
==> ERROR: Failure while downloading wired-notify git repo
    Aborting...
error: failed to download sources for 'wired-git-r163.4460e60-1':
error: packages failed to build: wired-git-r163.4460e60-1

`anti_render_criteria` doesn't seem to work

https://i.imgur.com/QVIPaBX.gif
QVIPaBX

I'm using wired-git with latest wired.ron from master, the only thing I changed is that I added offset to root block to be next to the image one
If I don't do that they just appear on top of each other
The same thing happens with discord so it's not problem with application sending the notification
Also, if text notifications (from layout 2) are replacing the old ones then I think the same should be true for the image ones (layout 1)

HELP: Labels of actions being repeated.

Strangely, the label of actions are being repeated. I don't think that's the normal behaviour, so I tried fixing it, but my zero knowledge of Rust is not helping.

$ notify-call \
  --hint string:image-path:/home/iris/.local/share/icons/neovim.png \
  -o 'echo reset':'Ok' \
  -o 'echo reset':'Nooo' \
  'Neovim' \
  'Give a look at the file.'

last_image_screenshot

Info from debug:

[src/manager.rs:87] &notification = Notification: {
  id: 4,
  app_name: ,
  summary: Neovim,
  body: Give a look at the file.,
  actions: {"0": "Ok", "1": "Nooo"},
  app_image: false,
  hint_image: false,
  urgency: Normal,
  percentage: None,
  time: 2022-03-24 22:55:06.202442324 -03:00,
  timeout: 10000
}

[feature] add systemd/dbus service

it would be nice, for convenient autostart to have systemd and dbus services 'shipped with' wired, similar as dunst has.

Also documentation on how to setup wired as standard notification daemon would be nice.

Question: centering posiiton of multiple elements?

I am using this type of positioning for some time now, but still confused at some things, for example this:

image

Usingo parent_anchor: BR, self_anchor: TR to have space downside and centering works for one -- however, when after adding other action labels with parent_anchor: MR, self_anchor: ML to the right, the parent doesn't count the new space to center horizontally.

I tried with multiple settings, a few go inside other elements, others straight go beyond the geometry of the notification. Is there any way to do this that I don't understand?

Whole config: https://github.com/BeyondMagic/MaGiCK/blob/main/.config/wired/wired.ron

Shortcut config overhaul

As previously discussed in #9, the current system for click actions isn't all that flexible, and there is still room for improvement by allowing one mouse button to run multiple actions. I think the best way to implement this would be to replace the shortcut config with this kind of data structure:

shortcuts: ShortcutsConfig (
    // support old format
    notification_closeall: 3,

    // new format; actions will be executed sequentially
    1: [
        notification_action1,
        notification_close,
    ],
)

as I mentioned in #9.
Should we wait on this for the next release since this might break existing configs, or should we allow for backwards compatibility like I suggested in #9?

Feature: rendering criterea for specific appnames.

I think the title is pretty straightfoward, would make this 100x more customisable, being able to put some notifications in the center, others in the left top with different font sizes, etc.

(
    name: "root",
    parent: "",
    hook: Hook(parent_anchor: TM, self_anchor: MM),
    offset: Vec2(x: 0.0, y: .0),
    render_criteria: [AppName(["telegram-deskto", "firefox"])],
    params: NotificationBlock((...)),
),

(
    name: "root",
    parent: "",
    hook: Hook(parent_anchor: TR, self_anchor: RT),
    offset: Vec2(x: -25.0, y: 40.0),
    render_anti_criteria: [AppName(["telegram-deskto", "firefox"])],
    // https://github.com/Toqozz/wired-notify/wiki/NotificationBlock
    params: NotificationBlock((...)),
),

I'll try to see how it works and see if I can actually make somewhat a prototype.

Templating inside content

Screenshot from Telegram's desktop app:
image

Should Wired be able to handle content that contains templating?

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.