13 releases

0.0.13 Jul 20, 2020
0.0.12 Apr 8, 2020
0.0.10 Mar 3, 2020
0.0.8 Feb 25, 2020

#1049 in GUI

GPL-2.0 license

29KB
682 lines

I use this to route notifications from remote machines to the current desktop I'm using.

A central instance notif route receives notifications and forwards them to the currently active notifier. A notifier is run with notif notify on a desktop machine and displays received notifications. notif send is used in place of a local notify-send.

Example:

  • remote machine A: notif route
  • laptop1: notif notify
  • laptop2: notif notify
  • remote machine B: notif send -u critical "something noteworthy" "just happened"

Laptop2's notifier will receive & feed the notification to the desktop's notification manager and you'll see "@machineB: something noteworthy just happened". Send a SIGUSR2 to laptop1's notifier and it will receive future notifications.

For this to happen notif looks for a config file in ~/.notif, /etc/notif, or as an argument notif -c <file>: localhost example. Notif can generate config files for multiple hosts: for 5 clients & a server with curve certificates for each:

notif generate topo 10.99.0.1:9961 10.99.0.1:9962 5

On a desktop I use notif notify with this script: this ensures that the machine that has most recently unlocked X session will receive the notifications.

xscreensaver-command -watch | while read xs; do
  case "$xs" in
    LOCK*)
      # pause dunst so notifications don't appear over xscreensaver
      # pause notif so notifications queue up on server & will be routed later (maybe to another desktop)
      svc-s6 -1 $s6/notif || killall -s SIGUSR1 dunst
      svc-s6 -1 $s6/dunst || killall -s SIGUSR1 notif
      ;;
    UNBLANK*)
      # have notif send a SEIZE message to become the active notifier. resume dunst.
      svc-s6 -2 $s6/notif || killall -s SIGUSR2 dunst
      svc-s6 -2 $s6/dunst || killall -s SIGUSR2 notif
      ;;
  esac
done

I use this with this kind of things:

Dependencies

~22MB
~181K SLoC