Git Product home page Git Product logo

ntfd's Introduction

ntfd - Notification daemon

GitHub GitHub release (latest by date)

A lightweight notification daemon for fancy desktop integrations.

ntfd synchronizes with different services and offers synchronous APIs for desktop integration via D-Bus.
It can be used as a data source for Polybar, Rofi or any other similar tool.

ntfd feeding data to Polybar and Dunst

Installation

Arch users can install ntfd-bin from the AUR.
Other Linux users can either grab a statically linked binary from the release page or build from source.
Instructions to build from source can be found at the bottom of the README.

Configuration

If you installed from the AUR, just edit ~/.config/ntfd/config.toml as you need and enable the modules you're interested in.
Keep scrolling for module specific instructions.

If you're building from source, copy config.toml into your config directory, then edit it to enable what you need:

mkdir -p ~/.config/ntfd
cp config.toml ~/.config/ntfd

Usage

First, make sure ntfd is running in the background. You can start it at the begining of you session:

ntfd &

Here are a few example DBus queries you can use from shell scripts, you'll need jq to run the examples:

DBus properties:

# Get the current weather icon
busctl --user -j get-property io.ntfd /weather openweathermap.strings CurrentIcon | jq -r .data

# Rendered version of the configured weather template:
busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data

DBus methods:

# Supported units are "celsius", "kelvin" and "fahrenheit":

# Current temperature in celsius:
busctl --user -j call io.ntfd /weather openweathermap.strings CurrentTemperature s "celsius" | jq -r '.data[0]'

# Forecast temperature in fahrenheit:
busctl --user -j call io.ntfd /weather openweathermap.strings CurrentTemperature s "fahrenheit" | jq -r '.data[0]'

To explore the DBus API, I recommend d-feet, a graphical tool to explore DBus interfaces.
In d-feet, go to the Session Bus tab from the top bar, and look for io.ntfd.

The busctl documentation might also come in handy, especially for method calls.

Weather module

The weather module sends desktop notifications when weather conditions are degrading.
It also exposes a D-Bus API with some convenience methods for easier desktop integration.

Polybar integration

In the screenshot, the first number is the current temperature and the second one is a 3 hour forecast.
The output is fully configurable via templating, you can also query individual values.
Edit the ~/.config/ntfd/config.toml and follow the instructions.
For Polybar integration like in the example, update your Polybar config like so:

[module/weather]
type = custom/script
exec = busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data
interval = 60
label-font = 3

I recommend a 60 second interval, this way the bar will stay in sync with the notifications.
Note that the Polybar integration depends on both Weather Icons and Material Icons, don't forget to add them to your config or it won't render correctly:

font-1 = WeatherIcons:size=17
...
font-3 = MaterialIcons:size=19
...

GitHub module

The GitHub module sends desktop notifications when there's activity on GitHub.
It exposes a D-Bus similar to the weather module.

Polybar integration

The screenshots shows the number of currently unread notifications. Nothing is rendered unless some notifications are unread.
Edit the ~/.config/ntfd/config.toml and follow the instructions.
For Polybar integration like in the example, update your Polybar config like so:

[module/github]
type = custom/script
exec = busctl --user -j get-property io.ntfd /github github.strings RenderedTemplate | jq -r .data
interval = 10
label-font = 3

I recommend a 10 second interval, this way the bar will stay in sync with the notifications.
The example in the default config file needs the Octicons font to render correctly.

MPD module

The MPD module sends desktop notifications when songs start playing.
See config.toml for configuration options.

Roadmap

Integration with the following services is planned:

  • OperweatherMap
    • Current weather, forecast
    • Template rendering for Polybar integration
    • Re-implement polybar-forecast)
    • Alerts through notifications
  • MPD
    • Desktop notifications
  • Github
    • Unread notifications count
    • Live notifications
  • Arch
    • Pacman updates ? (how ?)
  • Gmail
    • Live notifications
    • Unread messages count, multi account support
  • Facebook (?)
    • Live messages (?)
    • Unread notifications count (?)
  • Twitch
    • Live streams count (followed by the user)
    • Rofi integration with mpv
  • Reddit (?)

Build from source

You can setup a Stack toolchain to build the project, or use Docker to build a statically linked executable:

docker build -t kamek-pf/ntfd .
docker run --rm -ti -v $(pwd):/mnt kamek-pf/ntfd /bin/sh -c 'cp ntfd /mnt'

The binary will be available as ntfd from the project's root.

Run tests

The test suite expects a valid OWM_API_KEY and GITHUB_TOKEN environment variables. Simply run stack test.

Troubleshooting

My Dunst notification icons look tiny

Dunst has an unreleased fix for this. In the meantime you can copy the weather-xyz icons from
/usr/share/icons/YourTheme/status/symbolic somewhere else, resize them and add the new path to icon_folders in your dunstrc.

ntfd's People

Contributors

kamek-pf avatar mmarx 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

ntfd's Issues

Network.Socket.Connect does not exist

Hello,
I installed ntfd-bin from AUR. When I run 'ntfd &' I get the following:

   /etc ntfd &
[1] 2687
   /etc The following modules were ignored:
 - Github (Disabled)

Started MPD notification service.
Started OpenWeatherMap synchronization service.
ntfd: Network.Socket.connect: <socket: 12>: does not exist (Connection refused)

[1]  + 2687 exit 1     ntfd

Any idea what I'm doing wrong?

two issues. one with running mpd and ntfd simultaneously conflicts and standard linux binary build.

1.if i run mpd first or ntfd first then enable mpd later on. one or the other wont start later on as the socket is preoccupied for the latter.
2.the binary currently available is for musl and the biuld process is convoluted. i use debian so it would be great if you have a standard build process available for it(glibc if im not wrong). in which case i would be able to maintain in the mpr which is a rather new, aur like central repo for debian and ubuntu.
mpr

ntfd not providing .service (manual install Debian)

I get this error: Failed to get property RenderedTemplate on interface openweathermap.strings: The name io.ntfd was not provided by any .service files

I used the example weather module for polybar in the README.
How would I fix this?

Cannot modify text

I have both icon fonts (weather and material) installed and referenced in my config.
font-8 = WeatherIcons:style=Regular:size=16;3
font-9 = MaterialIcons:style=Regular:size=12;3

[module/weather]
type = custom/script
exec = busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data
interval = 60
label-font = 9

Data is in my polybar and I can change the icon sizes, but the numbers are too big, how can the numbers be adjusted?

only works when started manually

I've been running a startup script that launches polybar after starting ntfd with ntfd &, but after changing my display manager to greetd that no longer works and I have to start ntfd manually to get it to work. I assume this is a permissions issue somehow? Any idea how to fix that?

Weather icons don't show unless ntfd is started manually

I have followed the installation guide correctly, I believe. I put the polybar module in my polybar config, enabled the weather module in the config, and started ntfd in my bspwmrc. However, the weather icons on the bar don't actually show unless ntfd is started manually. Even if ntfd is running, there is just nothing in polybar. I have confirmed it with
$ ps -aux | grep ntfd name 521 0.0 0.0 1073750228 7048 ? Sl 17:11 0:00 ntfd

Also, if ntfd isn't started, it shows an error message in polybar, which is expected. If I then immediatly kill ntfd and start it again manually, everything works as expected.

Polybar config:


font-0 = WeatherIcons:size=10
font-1 = NotoSans-Regular:size=8;-1
font-2 = MaterialIcons:size=10;0
font-3 = Termsynu:size=8:antialias=false;-2
font-4 = FontAwesome:size=10;0

modules-right = weather volume wireless-network wired-network battery date

[module/weather]
type = custom/script
exec = busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data
interval = 60

bspwmrc:

#! /bin/sh

sxhkd &
ntfd & 
polybar top &
wmname LG3D

pgrep -x sxhkd > /dev/null || sxhkd &

bspc monitor -d '1' '2' '3' '4' '5' '6' '7' '8' '9' '10'

I've also tried replacing exec part of of the polybar module with the ntfd binary, which also causes the weather icons to not show up, however ntfd still runs. Maybe I'm overlooking something, but can't find what it is. Thanks!

Icon colors.

Is it possible to change the icon colors i.e. the weather icon?

Weather icon problem

Hi,
Thx for this program.

When i use the AUR version i have got the the same error

#17

After using you last release all work great but not the weather icon.

busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data

 26°C   26°C

Polybar config font

font-0 = "Inconsolata Nerd Font:bold:size=11;2"
font-1 = "WeatherIcons:size=17"
font-2 = "UbuntuMono Nerd Font:size=14;3"
font-3 = "Font Awesome 5 Free:style=Regular:pixelsize=8;1"
font-4 = "Font Awesome 5 Free:style=Solid:pixelsize=8;1"
font-5 = "Font Awesome 5 Brands:pixelsize=8;1"

If i use weather icon on the first place all other symbol are weather icon but not the weather module.

Thx

Weather 'trend' icon does not display

The trend icon in the weather module does not display. I looked in "weather icons" and can not find the trend icons. I assume they are in a different font package? If so can you tell me which so I can make sure it is installed?

Weather Icons won't show properly when adding the module to Polybar

I have done everything as it says in the Github but for some reason I don't get the cloud icons, I get some gear icons instead.

if I do: busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data I get:  22°C   22°C

Does anyone know why this is?

Weird rendering with polybar integration of weather

Hi, i am making my own polybar with your deamon, it wont display the current temperature and the forecast temperature.
All the font are set correctly and the module is a copy paste of your example. Can u find a solution for this?
(Ps. i am non that experienced with arch linux)

immagine

OpenWeatherMap to Weather Icon mapping breaks with Nerd Fonts

Even with Weather Icons installed, listed in the the Polybar config and the font entry referenced in the config as label-font, the icons are all wrong with Nerd Fonts installed. Even using the test lines at the console return the wrong icons, though admittedly, I also have Nerd Fonts defined in my alacritty config. I've looked up the correct unicode values on Nerd Font site and found the mappings in OpenWeatherMap.hs, but I don't' understand the values listed as '\xxxxx' and how to set it to the Nerd Font values.

It seems like the Polybar config should be working with the alternate font, but it isn't. Following, are the relevant lines from my Polybar config. Maybe I'm missing something here.

font-0 = DejaVu Sans Mono Nerd Font:style=Regular:pixelsize=16
font-1 = Material Icons:style=Regular:pixelsize=16
font-3 = Weather Icons:style=Regular:pixelsize=16

[module/weather]
type = custom/script
exec = busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data
interval = 60
format = <label>
label = %output%
label-font = 3

Add feels_like token

It would be nice to have a {{feels_like}} token for the weather as its very informative.

Display does not change from the default

As title says, no matter what I change the display string to, I only receive the default output string of the weather.

ntfd configuration relevant line (.config/ntfd/config.toml):

display = "{{ temp_icon }} {{ temp_celsius }}°C"

(All other configuration changes are applied correctly such as location, API key, etc. Only display does not change.)

command and response:

busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data
 15°C   15°C

The trend, forecast icon, and forecast temperature should not be showing.

I have tried restarting the daemon, restarting my system, uninstalling and reinstalling ntfd, and waiting for sync_frequency (10 minutes), and nothing has changed.

Weather don't show on polybar

Hi, thx for this awesome program.
I have read and do the change in the config file with api and city code and i add the module to polybar.
After restart the polybar i don't see weather inside the bar.

for

busctl --user -j get-property io.ntfd /weather openweathermap.strings RenderedTemplate | jq -r .data

The result is empty.

Weather icons don't display for some reason

Okay so for some reason the weather icons don't display properly in my polybar. Instead of the clouds I get two cogs.. and the trend icon is just a regular arrow like this: → and I would like to get them to display properly. Do you have any idea what the issue might be? I checked my polybar config and it doesn't seem like you can set the fonts for the weather icons, it happens automatically in some script I assume, so I don't know why it isn't displaying.

IOERROR

using the config provided on github prevents the start up of ntfd with the error
Failed to read config file: hGetContents: invalid argument (invalid byte sequence)

dbus interactions

Thanks for this great tool. As an exercise I'm trying to more or less clone it in Elixir/Erlang but don't have access to a fully featured or well documented DBus lib in those languages. I don't really know Haskell so I can't quite figure out how you're setting up the DBus object to have the properties you want. Would you mind pointing me to the code that handles this? Or even better the DBus documentation or tutorial that showed you how to do it in the first place?

Use script to see update on polybar ( for arch )

Hi i use this on my polybar if this can help you

Script for polybar

`#!/bin/sh
#source https://github.com/x70b1/polybar-scripts

if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi

if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
updates_aur=0
fi

updates=$(("$updates_arch" + "$updates_aur"))

if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo "0"
fi
`

Inside polybar

type = custom/script exec = ~/.config/polybar/scripts/check-all-updates.sh interval = 1000 label = " %output%" format-foreground = #ededed format-background = #313842 format-prefix = "  " format-prefix-foreground = #d7d7d7

sorry for the typo

Terminated by signal SIGSEGV (Address boundary error)

Running into the following issue:

❯ ntfd
The following modules were ignored: 
 - mpd (Disabled)

Started OpenWeatherMap synchronization service.
Started Github synchronization service.
fish: “ntfd” terminated by signal SIGSEGV (Address boundary error)

from syslog:

Apr  7 07:31:00 EventHorizon01 systemd[1]: systemd-localed.service: Succeeded.
Apr  7 07:31:07 EventHorizon01 kernel: [423164.998337] ntfd:w[2051913]: segfault at 0 ip 0000000000000000 sp 00007fddc64af888 error 14 in ntfd[400000+1000]
Apr  7 07:31:07 EventHorizon01 kernel: [423164.998345] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.

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.