Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/codelif/hyprnotify

DBus Implementation of Freedesktop Notification spec for 'hyprctl notify'
https://github.com/codelif/hyprnotify

dbus desktop-notifications freedesktop freedesktop-notifications hyprland notifications notify notify-send

Last synced: 2 months ago
JSON representation

DBus Implementation of Freedesktop Notification spec for 'hyprctl notify'

Lists

README

        

[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![Go][golang-shield]][golang-url]
![](https://github.com/codelif/hyprnotify/actions/workflows/go.yml/badge.svg)





Logo

Hyprnotify


A DBus Implementation for 'hyprctl notify'





Table of Contents



  1. About The Project


  2. Getting Started


  3. Usage

  4. Roadmap

  5. Contributing

  6. License

  7. Contact

  8. Acknowledgments

## About The Project

Hyprnotify is a [Freedesktop.org](https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html) compliant notification daemon implementing `hyprctl notify` as its backend.

![](assets/demo.gif)

(back to top)

## Getting Started

To get hyprnotify you can either download the binary build by github actions. Or build it locally.

### Arch Linux
`hyprnotify` is available on the AUR. You can install it with a AUR helper like `yay`.
```sh
yay -S hyprnotify
```
### Other Linux Distributions
You can download the release binaries directly from the [releases](https://github.com/codelif/hyprnotify/releases) page.

### Building from Source
#### Prerequisites

- `go` compiler
- `libnotify` to send notifications with `notify-send` (optional)

#### Compiling

1. Clone the repo and cd into it
```sh
git clone https://github.com/codelif/hyprnotify.git
cd hyprnotify
```
2. Build
```sh
go build ./cmd/hyprnotify
```
3. Run the binary
```sh
./hyprnotify
```

(back to top)

## Usage
Execute the daemon:
```sh
hyprnotify
```

### Examples

Send a notification:
```sh
notify-send "Hello, World!"
```
Add a font-size hint:
```sh
notify-send "This is very big!" -h int:x-hyprnotify-font-size:40
```
Add an urgency hint and last for 20 seconds:
```sh
notify-send "This is serious stuff!" -u critical -t 20000
```
### Custom Hints
| Hint | Example | Comment |
|:-----------------------:|:-----------------------------------:|:---------------------------------|
| `x-hyprnotify-font-size`| `int:x-hyprnotify-font-size:30` | font size for notification |
| `x-hyprnotify-color` | `string:x-hyprnotify-color:#ff30fa` | hex color code for notif. color |
| `x-hyprnotify-icon` | `int:x-hyprnotify-icon:3` | icon identifier for notification |

#### `x-hyprnotify-icon`
| ID | Icon | Preview |
|:--:|:-------|:-------:|
|`0` |WARNING |![WARNING](https://github.com/codelif/hyprnotify/assets/68972644/7bf5ff97-1d6a-45b0-9715-7e8d1535d866)|
|`1` |INFO |![INFO](https://github.com/codelif/hyprnotify/assets/68972644/473e5752-42b3-44cf-bd07-bed64abc9660)|
|`2` |HINT |![HINT](https://github.com/codelif/hyprnotify/assets/68972644/ffc6ff60-1058-4e5b-8fe3-611ba4b40206)|
|`3` |ERROR |![ERROR](https://github.com/codelif/hyprnotify/assets/68972644/630b2979-382b-4fe3-902e-6ee3526fcfe4)|
|`4` |CONFUSED|![CONFUSED](https://github.com/codelif/hyprnotify/assets/68972644/64ae100b-dc2c-46dd-be8c-afdacb03042b)|
|`5` |OK |![OK](https://github.com/codelif/hyprnotify/assets/68972644/2b66a258-5e07-4683-a798-fe6f47d67716)|

### Audio Playback
A notification sound is played along with a notification.

To disable this behaviour pass `--silent` flag when executing.
```sh
hyprnotify --silent
```
`--no-sound` and `-s` also works the same way.

### Note about `replace-id`:
When using `replace-id` with `notify-send`
```sh
notify-send --replace-id=10 "Hello"
```
All the notifications with IDs of more than `replace-id` will also be deleted. (11, 12, 13...) \
This is due to the inherent design of `hyprctl dismissnotify`. So, it is not fixable.\
\
Due to this, it is advisable to use it to replace only the latest notification.

(back to top)

## Roadmap

- [x] Implement the DBus Specification
- [x] Replace shell command invocation with IPC
- [x] Hints Support:
- [x] urgency
- [x] font-size
- [x] color
- [x] icon
- [ ] Add support for sound
- [x] Default sound support
- [ ] sound hints
- [x] Fix race condition in `CloseNotification` Signal
- [ ] Scrap the Project

(back to top)

## Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

(back to top)

## License

Distributed under the Apache-2.0 License. See `LICENSE` for more information.

(back to top)

## Contact

Harsh Sharma - [@codelif_](https://x.com/codelif_) - [email protected]

Project Link: [https://github.com/codelif/hyprnotify](https://github.com/codelif/hyprnotify)

(back to top)

## Acknowledgments

* [hyprwm community](https://github.com/hyprwm/Hyprland) for Hyprland (special thanks to [vaxry](https://github.com/vaxerski))
* [go](https://go.dev) for go
* [Freedesktop.org Desktop Notification Specification](https://specifications.freedesktop.org/notification-spec/notification-spec-latest.html)

(back to top)

[contributors-shield]: https://img.shields.io/github/contributors/codelif/hyprnotify.svg?style=for-the-badge
[contributors-url]: https://github.com/codelif/hyprnotify/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/codelif/hyprnotify.svg?style=for-the-badge
[forks-url]: https://github.com/codelif/hyprnotify/network/members
[stars-shield]: https://img.shields.io/github/stars/codelif/hyprnotify.svg?style=for-the-badge
[stars-url]: https://github.com/codelif/hyprnotify/stargazers
[issues-shield]: https://img.shields.io/github/issues/codelif/hyprnotify.svg?style=for-the-badge
[issues-url]: https://github.com/codelif/hyprnotify/issues
[license-shield]: https://img.shields.io/github/license/codelif/hyprnotify.svg?style=for-the-badge
[license-url]: https://github.com/codelif/hyprnotify/blob/master/LICENSE.txt
[product-screenshot]: images/screenshot.png
[golang-shield]: https://img.shields.io/badge/Golang-00ADD8?style=for-the-badge&logo=go&logoColor=FFFFFF
[golang-url]: https://go.dev