Giter Club home page Giter Club logo

linux_notification_center's Introduction

https://github.com/phuhl/linux_notification_center/workflows/CI/badge.svg?branch=master

Linux Notification Center

A haskell-written notification center for users that like a desktop with style…

Take part in the discussion on our discussion board!

          ▙              █  █ ████████████  ███▙                  █   ▄██████▄
          ███▄           █  █ ████        █  ███▙                █    ████    ██
          ▜█████▄        █  █ ████         █  ███▙              █   █  ████    ▜█
            ▜██████▄     █  █ ████          █  ███▙      ▙     █     █  ████
          █▄   ▜██████▄  █  █ ████████████   █  ███▙    ██▙   █       █  ████
          █ ▜█▄   ▜█████▄█  █ ████            █  ███▙   ███▙ █         █  ████
          █    ▜█▄   ▜████  █ ████             █  ███▙█  ████           █  ████
          █       ▜█▄   ▜█  █ ████              █  ███ █  ██       █▙    █  ████
          █          ▜█▄    █ ████               █  █   █           █▙    █  ████
          █             ▜▄  █ ████████████        █      █           ▜████▛  ██▛


    ▄▇▇▀▀▀▀█▌        ▄▄▄▄▄▀▀██▇█▄▄▀▀▀▀▀    ▄▄▄▄▄▄      ▄▄█▇██▀▀▄▄▄▄▄        ▐█▀▀▀▀▇▇▄
   ▐██▌   ▀▀    ▄▄▄████████▄▄█▀        ▄█████▀▀▀███▄      ▀█▄▄████████▄▄▄    ▀▀   ▐██▌
   ████▄  ▄▄▄██████████▀▀   ▀▀▀█▄     ▇████▀    ▀▀██▌   ▄█▀▀▀   ▀▀██████████▄▄▄  ▄████
    ▀███████████████▀▀         ▐█▌   ██████    ▄ ▐███  ▐█▌         ▀▀███████████████▀
       ▀▀▀▀██████▀             ▀▀   ▐██▐▇▇     ▀▀▀▀      ▀▀             ▀██████▀▀▀▀
       ▄▄██████▀                     ██ ██▌         ▄                     ▀██████▄▄
     ▄███████▀                      █▀██ ▀█▄▄      ▄▄                       ▀███████▄
    ▄███████                          ▀██▄▄█████████▀                         ███████▄
    ██████                               ▀▀█████▀▀▀                            ███████
    ▐████▌                                                                      ▐████▌
     ███▄▄▄▄▄▌                                                             ▐▄▄▄▄▄███
      ▀▀▀▀▀▀                                                                 ▀▀▀▀▀▀


                                        ╒══════╕
                                    NEW │ 2023 │ Update:
                                        ╘══════╛


                          For all users of the non-git packages:
                                  ¨¨¨¨¨        ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨

       Customize all CSS might [probably will] brake your current styling settings.
             (more information on this in the file updateyourconfig2021.org)


                                     New config style
                                     ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

                  █▀▄ █▀▄ █▀█ █ █ ▀█▀ █▀█ █▀▀   █▀▀ █ █ █▀█ █▀█ █▀▀ █▀▀
                  █▀▄ █▀▄ █▀█ █▀▄  █  █ █ █ █   █   █▀█ █▀█ █ █ █ █ █▀▀
                  ▀▀  ▀ ▀ ▀ ▀ ▀ ▀ ▀▀▀ ▀ ▀ ▀▀▀   ▀▀▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀▀▀ ▀▀▀

            The configuration file is now in YAML format. It's also massively
                       cleaned up thanks to the input of MyriaCore!

                            The new configuration allows for:

                                  Extended Scriptability
                                  ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

             Now any notification can be modified by an external script. This
            allows for all the logic you could possibly do on a notification.

                     Define special styles for special notifications!


                                     Many more fixes
                                     ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

                               Additional Features from 2021
                               ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

                             New deadd.css configuration file
                               Style all elements yourself

                              Reload CSS styling on the fly

                    Use CSS transitions when loading a new colortheme
                               and smoothly change the mood



                       As always, many thanks to our contributors:


        (¯`·.¸¸.·´                                                     `·.¸¸.·´¯)
       ( \                                                                     / )
       ( \ )          MyriaCore S-NA ahmubashshir mgil2 resolritter          ( / )
      ( ) (           woutervb avdv TaylanTatli rbowden91 kianmeng            ) ( )
       ( / )          opalmay balsoft trk9001 CobaltSpace lierdakil          ( \ )
       ( /                                                                     \ )
        (_.·´¯`·.¸                                                    ¸.·´¯`·.¸_)


                                   Thank you very much!


            Finally, thank you to everyone who created issues, commented, and
                             helped to further this project.

                                                                                         ▝
                                                                                         ▝
▖                                                                                        ▐
▖                                                                                        ▐
▌                                                       Further news in releasenotes.org ▐
▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟

Features

The notification center receives notifications via DBUS (like any notification daemon) and shows them in the upper right corner of the screen. The notification (if not specified in the notification otherwise) will also be shown in the notification center even after the notification disappeared by itself. The notifications can be clicked to make them disappear.

Notifications can be replaced by the use of the replaces-id feature of the notification specification.

The notification center can (optionally) show user-specified buttons in the bottom that can be in two states (highlighted/not highlighted) and that can run customizable shell commands.

Screenshots

Some applications, notification: README.org.img/org_20200223_193450_1en7sh.jpg

Notification Center opened: README.org.img/org_20200223_193345_VhlbOf.jpg

Link, Markup, Progressbar, and Action support: README.org.img/org_20201220_000601_9V037T.jpg

Usage

To start it:

> deadd-notification-center

Toggle between hidden and shown state of the notification center:

kill -s USR1 $(pidof deadd-notification-center)

Set the state of a user defined button (in this example the first button, which has id 0):

# turn highlighting on
notify-send.py a --hint boolean:deadd-notification-center:true \
               int:id:0 boolean:state:true type:string:buttons

# turn highlighting off
notify-send.py a --hint boolean:deadd-notification-center:true \
               int:id:0 boolean:state:false type:string:buttons

This snippet uses notify-send.py, an improved version of libnotify (notify-send).

Clear all notifications

# within the notification center
notify-send.py a --hint boolean:deadd-notification-center:true \
               string:type:clearInCenter

# popups
notify-send.py a --hint boolean:deadd-notification-center:true \
               string:type:clearPopups

Pause/Unpause popup notifications

# pause popup notifications
notify-send.py a --hint boolean:deadd-notification-center:true \
                 string:type:pausePopups

# unpause popup notifications
notify-send.py a --hint boolean:deadd-notification-center:true \
                 string:type:unpausePopups

Reload CSS Styling file

notify-send.py a --hint boolean:deadd-notification-center:true \
                 string:type:reloadStyle

Send notifications that only show up in the notification center but do not produce a popup:

notify-send.py "Does not pop up" -t 1

Supported hints and features

Action buttons with gtk icons

notify-send.py "And buttons" "Do you like buttons?" \
               --hint boolean:action-icons:true \
               --action yes:face-cool no:face-sick  

Notification images by gtk icon

notify-send.py "Icons are" "COOL" \
               --hint string:image-path:face-cool

Notification images by file

notify-send.py "Images are" "COOL" \
               --hint string:image-path:file://path/to/image/from/root.png

Notification with progress bar

notify-send.py "This notification has a progressbar" "33%" \
                         --hint int:has-percentage:33)
#or
notify-send.py "This notification has a progressbar" "33%" \
                         --hint int:value:33)

Notification with slider

notify-send.py "This notification has a slider" "33%" \
                         --hint int:has-percentage:33
                         --action changeValue:abc)

Example: Brightness indicator

This snippet can be used to produce a brightness-indicator. It requires the notify-send.py script.

#!/bin/bash

if [ "$1" == "inc" ]; then
    xbacklight -inc 5
fi

if [ "$1" == "dec" ]; then
    xbacklight -lower 5
fi

BRIGHTNESS=$(xbacklight -get)
NOTI_ID=$(notify-send.py "Bildschirmhelligkeit" "$BRIGHTNESS/100" \
                         --hint string:image-path:video-display boolean:transient:true \
                                int:has-percentage:$BRIGHTNESS \
                         --replaces-process "brightness-popup")

Example: Volume indicator

This snippet can be used to produce a volume-indicator. It requires the notify-send.py script.

#!/bin/bash

if [ "$1" == "inc" ]; then
   amixer -q sset Master 5%+
fi

if [ "$1" == "dec" ]; then
   amixer -q sset Master 5%-
fi

if [ "$1" == "mute" ]; then
   amixer -q sset Master toggle
fi


AMIXER=$(amixer sget Master)
VOLUME=$(echo $AMIXER | grep 'Right:' | awk -F'[][]' '{ print $2 }' | tr -d "%")
MUTE=$(echo $AMIXER | grep -o '\[off\]' | tail -n 1)
if [ "$VOLUME" -le 20 ]; then
    ICON=audio-volume-low
else if [ "$VOLUME" -le 60 ]; then
         ICON=audio-volume-medium
     else 
         ICON=audio-volume-high
     fi
fi
if [ "$MUTE" == "[off]" ]; then
    ICON=audio-volume-muted
fi 



NOTI_ID=$(notify-send.py "Lautstärke" "$VOLUME/100" \
                         --hint string:image-path:$ICON boolean:transient:true \
                                int:has-percentage:$VOLUME \
                         --replaces-process "volume-popup")

Install

Install from the AUR for Arch: deadd-notification-center.

OR

If you want to spare yourself the hassle of the build time there is a binary package available: deadd-notification-center-bin.

OR

If you don’t want to wait for me to publish the next stable release: Use the new AUR git-package.

deadd-notification-center-git.

OR

On Ubuntu, Debian, everything… Replace 1.7.2 with the current-most release from the release section.

Manually install the dependencies (exact names might differ in your distribution):

  • gtk3
  • gobject-introspection-runtime
tar -xvzf linux_notification_center-1.7.2.tar.gz
cd linux_notification_center-1.7.2
wget https://github.com/phuhl/linux_notification_center/releases/download/1.7.2/deadd-notification-center
mkdir -p .out
mv deadd-notification-center .out
sudo make install

OR

Dependencies:

  • stack
  • cairo
  • pango
  • gobject-introspection
  • gtk3
make
sudo make install

Configuration

NOTE: Some styling config has moved. More infos in this file: updateyourconfig2021.org

No configuration is necessary, the notification center comes with sensible defaults™.

All colors and sizes are customizable, as well as the default timeout for notifications and the optional buttons in the notification center. Below are possible configurable options shown. The configuration file must be located at ~/.config/deadd/deadd.yml (or, if configured differently on your system: ${XDG_CONFIG_HOME}/deadd/deadd.yml).

Additionally, a deadd.css will be loaded from the same folder. It contains the styling of the notification center. You can load changes from the deadd.css file by using the command described in the section “Usage”.

### Margins for notification-center/notifications
margin-top: 0
margin-right: 0

### Margins for notification-center
margin-bottom: 0

### Width of the notification center/notifications in pixels.
width: 500

### Command to run at startup. This can be used to setup
### button states.
# startup-command: deadd-notification-center-startup

### Monitor on which the notification center/notifications will be
### printed. If "follow-mouse" is set true, this does nothing.
monitor: 0

### If true, the notification center/notifications will open on the
### screen, on which the mouse is. Overrides the "monitor" setting.
follow-mouse: false

notification-center:
  ### Margin at the top/right/bottom of the notification center in
  ### pixels. This can be used to avoid overlap between the notification
  ### center and bars such as polybar or i3blocks.
  # margin-top: 0
  # margin-right: 0
  # margin-bottom: 0

  ### Width of the notification center in pixels.
  # width: 500

  ### Monitor on which the notification center will be printed. If
  ### "follow-mouse" is set true, this does nothing.
  # monitor: 0

  ### If true, the notification center will open on the screen, on which
  ### the mouse is. Overrides the "monitor" setting.
  # follow-mouse: false

  ### Notification center closes when the mouse leaves it
  hide-on-mouse-leave: true

  ### If newFirst is set to true, newest notifications appear on the top
  ### of the notification center. Else, notifications stack, from top to
  ### bottom.
  new-first: true

  ### If true, the transient field in notifications will be ignored,
  ### thus the notification will be persisted in the notification
  ### center anyways
  ignore-transient: false

  ### Custom buttons in notification center
  buttons:
    ### Numbers of buttons that can be drawn on a row of the notification
    ### center.
    # buttons-per-row: 5

    ### Height of buttons in the notification center (in pixels).    
    # buttons-height: 60

    ### Horizontal and vertical margin between each button in the 
    ### notification center (in pixels).
    # buttons-margin: 2

    ### Button actions and labels. For each button you must specify a
    ### label and a command.
    actions:
      # - label: VPN
      #   command: "sudo vpnToggle"
      # - label: Bluetooth
      #   command: bluetoothToggle
      # - label: Wifi
      #   command: wifiToggle
      # - label: Screensaver
      #   command: screensaverToggle
      # - label: Keyboard
      #   command: keyboardToggle

notification:
  ### If true, markup (<u>, <i>, <b>, <a>) will be displayed properly
  use-markup: true

  ### If true, html entities (&#38; for &, &#37; for %, etc) will be
  ### parsed properly. This is useful for chromium-based apps, which
  ### tend to send these in notifications.
  parse-html-entities: true

  dbus:

    ### If noti-closed messages are enabled, the sending application
    ### will know that a notification was closed/timed out. This can
    ### be an issue for certain applications, that overwrite
    ### notifications on status updates (e.g. Spotify on each
    ### song). When one of these applications thinks, the notification
    ### has been closed/timed out, they will not overwrite existing
    ### notifications but send new ones. This can lead to redundant
    ### notifications in the notification center, as the close-message
    ### is send regardless of the notification being persisted.
    send-noti-closed: false

  app-icon:

    ### If set to true: If no icon is passed by the app_icon parameter
    ### and no application "desktop-entry"-hint is present, deadd will
    ### try to guess the icon from the application name (if present).
    guess-icon-from-name: true

    ### The display size of the application icons in the notification 
    ### pop-ups and in the notification center
    icon-size: 20

  image:

    ### The maximal display size of images that are part of
    ### notifications for notification pop-ups and in the notification
    ### center
    size: 100

    ### The margin around the top, bottom, left, and right of
    ### notification images.
    margin-top: 15
    margin-bottom: 15
    margin-left: 15
    margin-right: 0

  ### Apply modifications to certain notifications:
  ### Each modification rule needs a "match" and either a "modify" or
  ### a "script" entry.
  modifications:
  ### Match:
  ### Matches the notifications against these rules. If all of the
  ### values (of one modification rule) match, the "modify"/"script"
  ### part is applied.
  # - match:
      ### Possible match criteria:
      # title: "Notification title"
      # body: "Notification body"
      # time: "12:44"
      # app-name: "App name"
      # urgency: "low" # "low", "normal" or "critical"

    # modify:
      ### Possible modifications
      # title: "abc"
      # body: "abc"
      # app-name: "abc"
      # app-icon: "file:///abc.png"
      ### The timeout has three special values:
      ### timeout: 0 -> don't time out at all
      ### timeout: -1 -> use default timeout
      ### timeout: 1 -> don't show as pop-up
      ### timeout: >1 -> milliseconds until timeout
      # timeout: 1
      # margin-right: 10
      # margin-top: 10
      # image: "file:///abc.png"
      # image-size: 10
      # transient: true
      # send-noti-closed: false
      ### Remove action buttons from notifications
      # remove-actions: true
      ### Set the action-icons hint to true, action labels will then
      ### be intergreted as GTK icon names
      # action-icons: true
      ### List of actions, where the even elements (0, 2, ...) are the
      ### action name and the odd elements are the label
      # actions:
      #   - previous
      #   - media-skip-backward
      #   - play
      #   - media-playback-start
      #   - next
      #   - media-skip-forward
      ### Action commands, where the keys (e.g. "play") is the action
      ### name and the value is a program call that should be executed
      ### on action. Prevents sending of the action to the application.
      # action-commands:
      #   play: playerctl play-pause
      #   previous: playerctl previous
      #   next: playerctl next

      ### Add a class-name to the notification container, that can be
      ### used for specific styling of notifications using the
      ### deadd.css file
      # class-name: "abc"

  # - match:
      # app-name: "Chromium"

    ### Instead of modifying a notification directly, a script can be
    ### run, which will receive the notification as JSON on STDIN. It
    ### is expected to return JSON/YAML configuration that defines the
    ### modifications that should be applied. Minimum complete return
    ### value must be '{"modify": {}, "match": {}}'. Always leave the "match"
    ### object empty (technical reasons, i.e. I am lazy).
    # script: "linux-notification-center-parse-chromium"
  - match:
      app-name: "Spotify"
    modify:
      image-size: 80
      timeout: 1
      send-noti-closed: true
      class-name: "Spotify"
      action-icons: true
      actions:
        - previous
        - media-skip-backward
        - play
        - media-playback-start
        - next
        - media-skip-forward
      action-commands:
        play: playerctl play-pause
        previous: playerctl previous
        next: playerctl next

  # - match:
  #     title: Bildschirmhelligkeit
  #   modify:
  #     image-size: 60
  popup:

    ### Default timeout used for notifications in milli-seconds.  This can
    ### be overwritten with the "-t" option (or "--expire-time") of the
    ### notify-send command.
    default-timeout: 10000

    ### Margin above/right/between notifications (in pixels). This can
    ### be used to avoid overlap between notifications and a bar such as
    ### polybar or i3blocks.
    margin-top: 50
    margin-right: 50
    margin-between: 20

    ### Defines after how many lines of text the body will be truncated. 
    ### Use 0 if you want to disable truncation.
    max-lines-in-body: 3

    ### Determines whether the GTK widget that displays the notification body
    ### in the notification popup will be hidden when empty. This is especially
    ### useful for transient notifications that display a progress bar.
    # hide-body-if-empty: false

    ### Monitor on which the notifications will be
    ### printed. If "follow-mouse" is set true, this does nothing.
    # monitor: 0

    ### If true, the notifications will open on the
    ### screen, on which the mouse is. Overrides the "monitor" setting.
    # follow-mouse: false

    click-behavior:

      ### The mouse button for dismissing a popup. Must be either "mouse1", 
      ### "mouse2", "mouse3", "mouse4", or "mouse5"
      dismiss: mouse1

      ### The mouse button for opening a popup with the default action.
      ### Must be either "mouse1", "mouse2", "mouse3", "mouse4", or "mouse5"
      default-action: mouse3

CSS styling

The default CSS style can be found in /etc/xdg/deadd/deadd.css. It is advised to copy this file to ${XDG_CONFIG_HOME}/deadd/deadd.css (usually .config/deadd/deadd.css) if you want to make changes.

In the file you can change CSS styles (GTK3-flavor). Should the installation not have created a dead.css, you can use the content of style.css as a foundation.

The following class-names for labels are defined:

  • Notifications:
    label.deadd-noti-center.notification.appname
    Appname
    label.deadd-noti-center.notification.body
    Textbody
    label.deadd-noti-center.notification.title
    Notification title
    image.deadd-noti-center.notification.image
    Image of a notification
    image.deadd-noti-center.notification.icon
    Appicon
    button.deadd-noti-center.notification.actionbutton
    Action buttons
  • Notifications in the notification center:
    label.deadd-noti-center.in-center.appname
    Appname
    label.deadd-noti-center.in-center.body
    Textbody
    label.deadd-noti-center.in-center.title
    Notification title
    label.deadd-noti-center.in-center.time
    Notification time
    image.deadd-noti-center.in-center.image
    Image of a notification
    image.deadd-noti-center.in-center.icon
    Appicon
    button.deadd-noti-center.in-center.button-close
    Close button on notification
    button.deadd-noti-center.in-center.actionbutton
    Action buttons
  • Notification-center:
    label.deadd-noti-center.noti-center.time
    The big time at the top
    label.deadd-noti-center.noti-center.date
    The date text
    label.deadd-noti-center.noti-center.delete-all
    “Delete all” Button
    button.deadd-noti-center.noti-center.userbutton
    User buttons

Additionally, you can specify custom class-names in the modifications-section of your deadd.yml. These class names will be defined on the notification container (all notification elements lie within) of pop-ups and in-center.

Examples:

Remove appname and icon from notifications

image.deadd-noti-center.notification.icon,
label.deadd-noti-center.notification.appname,
image.deadd-noti-center.in-center.icon,
label.deadd-noti-center.in-center.appname {
    opacity: 0
}

Change font

.deadd-noti-center {
    font-family: monospace;
}

Specify special background for one app

README.org.img/org_20210119_120536_adyKnd.jpg

.notificationInCenter.Spotify {
    background: linear-gradient(130deg, rgba(0, 0, 0, 0.1), rgba(0, 255, 0, 0.3));
    border-radius: 5px;
}

This change requires a modification in your deadd.yml:

notification:
  modifications:
  - match:
      app-name: "Spotify"
    modify:
      class-name: "Spotify"

Notification-based scripting

You can modify notifications if they match certain criteria.

Matching:

The criteria you can specify are equality for the following parameters:

  • title
  • body
  • app-name
  • time

The matching parameters can be specified in the section notification.modifications.match of your deadd.yml.

Modifying:

You can set the following parameters:

  • title
  • body
  • app-name
  • timeout (specified in milliseconds)
  • margin-right (overrides distanceRight from the configuration)
  • margin-top (overrides distanceTop from the configuration)
  • icon (overrides the app-icon, value must be either empty, a path to an image or a gtk-icon-name)
  • image (overrides the image of the notification, value must be either empty, a path to an image or a gtk-icon-name)
  • image-size
  • transient (value has to be true or false)
  • send-noti-closed (value has to be true or false, if set to true it will prevent that a DBUS NotificationClosed message will be send for this notification. Only applies if the configuration parameter configSendNotiClosedDbusMessage is set to true)
  • class-name (adds a CSS-class name to the container of the notification for styling)
  • remove-actions (value can be anything, if used, no action buttons will be displayed on the notifications)
  • action-icons (true or false, if set to true the action label will be interpreted as an gtk-icon-name and an icon is displayed)
  • actions (array where every even element is the action name, every odd element is the action label. Actions are rendered as buttons in a notification. As the action most likely won’t be known by the notification sender, you probably want to use this with the action-commands modification)
  • action-commands (object where the keys are the action name and the value is a program call that should be executed when the action button has been clicked. Prevents sending of the action to the application.)

The modification parameters can be specified in the section notification.modifications.modify of your deadd.yml.

Running Scripts:

Instead of modifying a notification directly, a script can be run, which will receive the notification as JSON on STDIN. The script is expected to return JSON/YAML configuration that defines the modifications that should be applied. Minimum complete return value must be {"modify": {}, "match": {}}. Always leave the “match” object empty (technical reasons, i.e. I am lazy).

Example script to turn a notification from WhatsApp in Chromium into something sensible:

Before:

README.org.img/org_20210119_122628_AUuEu3.jpg

After:

README.org.img/org_20210119_122031_BNYKTp.jpg

Configuration:

notification:
  modifications:
  - match:
      app-name: "Chromium"
    script: "linux-notification-center-parse-chromium"

Script executed on Chromium notifications:

#!/bin/bash

# Read notification from STDIN
noti=""
while read line
do
    noti=${noti}${line}
done < "${1:-/dev/stdin}"

# Use jq to parse JSON and get the body field of the notification
body=$(echo $noti | jq '.body')
if [[ "$body" == "\"<a href=\\\"https://web.whatsapp.com/\\\">web.whatsapp.com</a>"* ]]; then
      # It's Whatsapp web, lets modify the notification
      isWhatsapp=1
      body=$(echo $body | cut -c 64-)
      img=$(echo $noti | jq '.image')
      if [[ "$img" == "\"NamedIcon \\\""* ]]; then
          filepath=$(echo $img | cut -c 14- | head -c -4)
          cp $filepath /tmp/whatsappimg.png
      fi
fi

if [[ "$isWhatsapp" == "1" ]]; then
    # Returning the modifications to dnc as JSON
    echo "{\"modify\": {\"app-icon\": \"whatsapp-desktop\", \"app-name\": \"WhatsApp\", \"image-size\": 50, \"image\": \"file:///tmp/whatsappimg.png\", \"remove-actions\": true, \"class-name\": \"WhatsApp\", \"body\":\"${body}}, \"match\": {}}"
else
    echo '{"modify": {}, "match": {}}'
fi

Contribute

First of all: Contribution is obviously 100% optional.

If you want to join the development chat, join our matrix channel: #deadd-notification-center:beeper.com or drop by on the discussion board: https://github.com/phuhl/linux_notification_center/discussions

If you do not want to contribute with your time, you can buy me a beer. Someone mentioned, they would be willing to donate, so here is my PayPal link: https://paypal.me/phuhl. Should you consider to donate, please be aware that this does not buy you the right to demand anything. This is a hobby and will be. But if you just want to give me some motivation by showing me that you appreciate my work, feel free to do so :)

See also

Also take a look at my notify-send.py which imitates notify-send (libnotify) but also is able to replace notifications.

linux_notification_center's People

Contributors

3jloy-pycckui avatar ahmubashshir avatar avdv avatar balsoft avatar cobaltspace avatar d3adb5 avatar kianmeng avatar lebensterben avatar lierdakil avatar mhcerri avatar mitchmg2 avatar myriacore avatar opalmay avatar phuhl avatar rbowden91 avatar resolritter avatar s-na avatar taylantatli avatar thomasqueirozb avatar trk9001 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  avatar

linux_notification_center's Issues

Support application icons

It will be great if we can have the icon provided by the application
notify-send has a argument for icon. And some applications have their icon in the notifications.

Virtual size of a process is huge

Screenshot from 2020-02-26 18-06-24

Using default config, just installed using make install

System: Linux pop-os 5.3.0-7629-generic #31158162882519.10~f90b7d5-Ubuntu SMP Fri Feb 14 19:56:45 UTC x86_64 x86_64 x86_64 GNU/Linux

Popup Timout/Timer UI

It'd be pretty neat if the user had some kind of visual indication of the time they have left to interact with a notification popup before it goes away. Plasma does this through a dial at the top-right of the popup, but this could also be done with a 'loading stripe' that moves across the underside of the popup.

Ideally, this would be disable-able via user customization as well.

binary releases

The dependencies for compiling this are enormous. It is not something that your average ubuntu user will want to go through, even if he is smart enough to use a tiling wm. As this only really needs a single executable and from my testing, a binary compiled on arch works just fine on ubuntu.
A buildbot or just a manually compiled binary in the github releases would be really helpful I think.

DNC Main window not clickable in QTile

So, I am not able to use any of the buttons in the notification center. The buttons show up just fine and hover colour and all work, but when I click them, the notification center closes and well, nothing happens. And this is true for all buttons, even the "delete all" button is not working.

I am using arch-linux with qtile as my window manager. I have also installed notify-send.py. So any help?

How to translate 'button_deleteAll' label

Observed behavior

The label Alle Löschen is shown as-is on a system in en_US.UTF-8. However, the date string is translated to English.

Screenshot:

2019-05-05--16-51-08

Version and system info

Expected behavior

Translated or translatable string for the button_deleteAll label. I have no clue how translations in Haskell / GTK work under the hood so tried some config options but none altered the behavior. So I assume either I'm missing something to correctly translate the label, or this is a bug.

Thanks in advance for your insights into this.

how to dismiss notifications?

I can't figure out how to dismiss notifications without clicking on them.

Brave browser keeps sending notifications and I want to be able to dismiss each notification individually when they pop up without doing the associated action (without opening the website that clicking on it opens).

How can I do this? Is it even possible?

buttons give xdg errors when using with systemd and lightdm

I have buttons bound to dm-tool functions in my notification center.

When trying to use these buttons, nothing happens, and systemctl --user status deadd-notification-center gives:

Not running inside a display manager, XDG_SEAT_PATH not defined

This seems to be related to dm-tool shenanigans, however it's not entirely dm-tool, since the buttons do work as intended when running deadd-notification-center manually from the command line. So, there's likely some kinda configuration magic that can be done to help make this work a bit better.

I tried to use a script that manually set the XDG_SEAT and XDG_SEAT_PATH before running dm-tool as a workaround, but that doesn't seem to be working either. Just getting the same old error.

Relevant

Keybindings

Dunst-like shortcuts would be great:

ctrl+space        close notification
ctrl+shift+space  close all notifications
ctrl+grave        pop notification from history

Modify position/size for matching notifications

I think it would be great to match certain notifications and place them elsewhere than the usual position. The use case I have in mind is to emulate something like which-key from emacs; that is, when hitting certain WM binds (e.g. sequenced binds of sxhkd) you display the next available ones.

Such popups are best placed at the bottom of the screen, while it seems to me regular notifications would seem intrusive in such a mainstream position.

Maybe this is the wrong type of program to do this but I can't think of anything, besides zenity, which seems to lack much graphical configuration.

Thanks

Add systemd unit

Please add a sytemd daemon properly configured to start service in background

Disable Notifications

Is there a way to stop notification pop-ups for a while, like DND? So during that time no pop-up shows but the notifications are present in the notification center.

Dunst seems to do it using
killall -SIGUSR1 dunst
or
notify-send "DUNST_COMMAND_PAUSE"

Stay visible

..instead of fading away on losing focus. Is this possible?

how to change position of notifications

Is there a way to change where the notifications pop up from the top right of the screen to the bottom right, or the bottom left? I cant seem to find this setting in the configurations

Build failure due to `gi-pango`

Hi, thanks for the project.

I'm trying to build the project to try to send some contributions and add changes (notably translations, stuff like that).

But when I build, I have this error:

gi-pango                 > /tmp/stack-054c1088f1687d92/gi-pango-1.0.16/GI/Pango/Structs/AttrShape.hs:519:88: error:
gi-pango                 >     Variable not in scope:
gi-pango                 >       destroyFunc :: FunPtr GLib.Callbacks.C_DestroyNotify
gi-pango                 >     |
gi-pango                 > 519 |     result <- pango_attr_shape_new_with_data inkRect' logicalRect' data_ maybeCopyFunc destroyFunc
gi-pango                 >     |                                                                                        ^^^^^^^^^^^
gi-pango                 > 

I googled it and seems like it happens when the generated code is wrong, but as I am a newbie in GUI Haskell, I'm unsure how to move forward.

Es könnten Daten auf die Festplatte geschrieben werden...

Issue

When I play a certain song this message shows up in German (see title). My system locale is en_GB.UTF-8. The title of the song played is smaller than other songs. The author string is also smaller.

What is happening and what data is it trying to write/written to the harddisk?

Package: deadd-notification-center-bin from AUR
Version: 1.6.1-1
OS: Arch Linux (5.4.3-zen1-1-zen)
Hardware: ThinkPad T490

Steps to reproduce

  1. Open Spotify
  2. Navigate to the Zelda & Chill playlist by Mikel, GameChops
  3. Play the song "Minuet of Forest"

Notification popup getting stuck

I've installed and tried the notification center and looks awesome! I'm just having an issue with the arch package. I managed to install it based on #4 on my arch installation. Everything looks like works fine but I'm having a weird issue where opening the network settings of KDE. I have two network devices configured in my system and as soon as I open It I get two notifications about the adapter getting up, one of those notifications gets stuck and It's impossible to close.

For example: https://imgur.com/tQYKBIX

The notification is still over everything but won't close anyway. Is there any log or something I can provide to help trace the issue?
I'm using i3 as window manager with compton-tryone.

(Btw the multi-monitor support works fine)

marginBottom?

My status bar is at the bottom of the screen--how do I configure a bottom margin?

More comments in the default deadd.conf

I am currently trying to configure deadd to match with the style of my system and I found myself struggling with the default configuration file and customization. Some of the problems I found:

  1. Several option names are hard to understand. I had to test by changing only some values and restarting each time the X server with the deadd-notification-center daemon to understand the meaning of some options.
  2. Some options names are duplicated in different sections. For example buttonColor is in the sections [colors] and buttons, with a different behaviour.
  3. The default option for buttonBackground in the section [colors] is transparent. But are there any alternatives? If yes, how can I learn about them?

A first solution would be to add comments to explain each section/option in details.
I think changing the names of some options might be beneficial, but not as much as adding proper comments above each option.

I will probably send a pull request in the following days with some of the comments I wished to have a few days ago. I couldn't find the meaning/default values for some options though, for example the buttonBackground possible values.

PS: Thanks for the nice and configurable tool! Nice job :)

Text too long for row?

It seems that this is what this message is saying (my german is rusty)

image

It seems to be happening when an image should be included, but I am not sure

Force Notifications to be kept in Notification Center

Feature Request:

Add a feature to force some notifications to be kept in the notification center. I see you have said "The notification (if not specified in the notification otherwise) will also be shown in the notification center", so it is controlled by some flag set by the actual program issuing the notification?

Horrible hacks or workarounds are welcome

Make notification timeout modifiable through "modify" configuration

The README's Notification-based scripting section mentions that "time" is customizable through the modify configuration. I was thinking this would be related to the time it takes for the notification to disappear, but after looking at the source, it does not seem to be the case.

Similar to how time is handled

| k == "time" = noti { notiTime = Text.pack v }

there should be a timeout option which sets notiTimeout

systemtray support

Is it support system tray?
like Stalonetray.
If not support, I want hear about support in future.

Fontsize of title

How to change the fontsize of the title?

Notification seems to be uneffected by the following settings in my gtk.css

label.deadd-noti-center.notification.title {
	font-size: 1.5em;
}

/* Nor does label / .title work for me */

I am using latest AUR bin build 1.7.2-1.

Any more customizations?

I was looking for a replacement for Dunst since it doesn't support rgba so i cannot make the background transparent and the text non-transparent so i installed deadd

Is there any way of customize the deadd on things like font, 1 or 2 line notifications, any way of hiding the name of the app which the notification comes from, and stuff like that? I would really like to. Thanks.

Self-compile not working on Debian Buster

Since my glibc version is not high enough on Debian, I had to self-compile the project. I installed all the dependencies, but when I ran make, it installed most of the stuff and then throws an error. Here's a screenshot:

image

What has me a bit worried is that it says linux-notification-center-1.6.0. Is it supposed to do that? I definitely downloaded version 1.7.2.

Support for Ubuntu 18.04

I'm getting this when I run deadd-notification-center after following the instructions from the README:

deadd-notification-center: /lib/x86_64-linux-gnu/libm.so.6: version 'GLIBC_2.29' not found (required by deadd-notification-center)

Choose Monitor for notifications

Feature Request:
Add an option to choose a monitor to display the notifications and the center ( like dunst does)
An follow option would also be nice (show notifications on focused screen)

makepkg fails due to wrong encoding

Using pikaur and getting this after starting to build: Any idea what might be going on?

[ 2 of 14] Compiling NotificationCenter.Glade

/home/dlg/.cache/pikaur/build/deadd-notification-center/src/linux_notification_center-1.7.2/src/NotificationCenter/Glade.hs:8:3: error:
    * Exception when trying to run compile-time code:
        notification_center.glade: hGetContents: invalid argument (invalid byte sequence)
      Code: template-haskell-2.13.0.0:Language.Haskell.TH.Quote.quoteExp
              hereFile "notification_center.glade"
    * In the quasi-quotation: [hereFile|notification_center.glade|]
  |
8 |   [hereFile|notification_center.glade|]
  |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


--  While building package linux-notification-center-1.6.0 using:
      /home/dlg/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1 build lib:linux-notification-center exe:deadd-notification-center --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
make: *** [Makefile:38: stack] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

Command 'makepkg --force' failed to execute.
:: Try recovering?
[R] retry build
[p] PGP check skip
[c] checksums skip
[i] ignore architecture
[d] delete build dir and try again
[e] edit PKGBUILD
------------------------
[s] skip building this package
[a] abort building all the packages
> 

Changes to deadd.conf should apply to running instance

Whenever I make changes to ~/.config/deadd/deadd.conf, they don't reflect in the running instance of the notification center... I have to restart it.. I would expect to be able to send it a signal to reload the config at the least, or have it detect the config file has changed in some manner. Restarting it also only changes the "panel" styling, not the notification bubble styling. I have to logout/login for that to change. Is there something I'm missing?

[Request] Wayland/Wlroots support?

I love the look of this notification daemon, and notice it has GTK3 in the dependencies. However, I'm on sway full time right now, and there's no good way for this to work on sway without implementing a layer-shell surface with wlroots.

No XDG_CONFIG_HOME support

Currently this hard-codes ~/.config, which is a pain for people who use an abnormal home layout.

A variables exists that is used to change this ($XDG_CONFIG_HOME), but it isn't set by default on most distros, so you'd need to check if it exists and use it accordingly. (In sh this can be done by using ${XDG_CONFIG_HOME:-~/.config}, but I'm not sure how to do it in haskell.)

Aur package does not build

When trying to build (with yay), I get:

==> Starting build()...
stack setup
stack will use a sandboxed GHC it installed
<snip>...</snip>
Building library for linux-notification-center-1.0.1..
[ 1 of 11] Compiling Helpers          ( src/Helpers.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1/build/Helpers.o )
                                             
/home/xananax/.cache/yay/deadd-notification-center/src/linux_notification_center-1.0.1/src/Helpers.hs:4:1: warning: [-Wdeprecations]
    Module ‘Control.Monad.Error’ is deprecated:
      Use "Control.Monad.Except" instead     
  |                                          
4 | import qualified Control.Monad.Error as Error
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                             
/home/xananax/.cache/yay/deadd-notification-center/src/linux_notification_center-1.0.1/src/Helpers.hs:12:37: warning: [-Wdeprecations]
    In the use of ‘runErrorT’                
    (imported from Control.Monad.Error, but defined in Control.Monad.Trans.Error):
    Deprecated: "Use Control.Monad.Trans.Except instead"
   |                                         
12 |   $ fromEither (Right defaultVal) $ Error.runErrorT $ CF.get conf sec opt
   |                                     ^^^^^^^^^^^^^^^
[ 2 of 11] Compiling NotificationCenter.Glade ( src/NotificationCenter/Glade.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1/build/NotificationCenter/Glade.o )
<command line>: can't load .so/.DLL for: /home/xananax/.stack/snapshots/x86_64-linux-tinfo6/lts-12.19/8.4.4/lib/x86_64-linux-ghc-8.4.4/libHSgi-gtk-3.0.26-Go8bObhKK4v7CUOOhG6z4k-ghc8.4.4.so (/home/xananax/.stack/snapshots/x86_64-linux-tinfo6/lts-12.19/8.4.4/lib/x86_64-linux-ghc-8.4.4/libHSgi-gtk-3.0.26-Go8bObhKK4v7CUOOhG6z4k-ghc8.4.4.so: undefined symbol: gtk_cell_accessible_parent_get_row_header_cells)
Completed 4 action(s).                       

--  While building package linux-notification-center-1.0.1 using:
      /home/xananax/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.4 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1 build lib:linux-notification-center exe:deadd-notification-center --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
make: *** [Makefile:12: stack] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
Error making: deadd-notification-center

Any idea?

Invalid icon size causing icons not to display

Hello there !

I'd like to begin by showing my appreciation for your work, I really like what you did !

Now for the issue : when I get a Telegram notification (native), the notifications buttons show broken icons (both in popups and in center) while the program gives this :

(deadd-notification-center:255448): Gtk-WARNING **: 03:07:41.477: Invalid icon size 10

I have got this from dbus-monitor if it can help (it is the Telegram notification) :

   string "Telegram Desktop"
   uint32 0
   string ""
   string "Test"
   string "Test Notification
This is a test message"
   array [
      string "default"
      string ""
      string "mail-mark-read"
      string "Mark as read"
      string "mail-reply-sender"
      string "Reply"
   ]
   array [
      dict entry(
         string "action-icons"
         variant             boolean true
      )
      dict entry(
         string "category"
         variant             string "im.received"
      )
      dict entry(
         string "desktop-entry"
         variant             string "telegramdesktop"
      )

The two icons here are "mail-mark-read" and "mail-reply-sender". I have checked that I have them (I have a common Papirus icon theme). It though seems that all icons start from size 16, which could explain why GTK can't print it in size 10.

I have looked for a way to set this value in the configuration file but did not succeed. Or maybe there could be a way to completely ignore button icons ?

Thank you for your time !

Reactivate notification

A fresh install of the program gave notifications with buttons for not showing the pop-up again. I clicked on it when internet connected but it was not intended. How can I start receiving the internet ones again?

Support for Gauges / Sliders in notif action UI

I'm not sure if there's a standard for this, but it'd be cool if users could put guages, or other forms of "analog actions" onto notification UIs. Even if these UI elements aren't necessarily "actionable", it'd be good to at least have the option to display them.

Sliders are my top pick, because they could be used in an always-present notification for scrubbing through a song, video, etc. Usually, you'd need to adopt a DE's notification daemon to accomplish this, and just deal with the lack of customization options.

Non-interactable gauges could easily be implemented with an int32 "value" hint. If we wanted to provide a bit more flexibility over NotifyOSD, we could allow gauge to be displayed alongside text and action buttons, as currently NotifyOSD doesn't display anything other than some icons when a gauge is displayed.

Support for inline images

Hi.

According to the response

> import notify2
> notify2.init('py3')
> notify2.get_server_caps()
['body', 'hints', 'actions', 'persistence', 'icon-static', 'action-icons', 'body-images', 'body-markup', 'body-hyperlinks']

I am assuming that deadd supports inline images. Alas, embedding an image with e.g.

<img src='/home/claudio/x.png' alt='text'/>

neither shows the image nor the alt text. Actually, it seems the body is completely lost...

I am using notify-send if that's important..

FTR, Gtk helpfully displays a warning message to this extent:

Failed to set text '<markup>[view] [Folder]

<img src="/home/claudio/Screenshots/shot-2020-03-04_161607.png" alt="shot"></img>
</markup>' from markup due to error parsing markup: Unknown tag 'img' on line 3 char 77

followMouse doesn't work

Hi,
I'm on arch lnux with i3 and installed the package bin with aur.
I created a config file in ~/.config/deadd/deadd.conf copied the conf from the git and changed followmouse to true in both sections but when a notification appears it doesn't follow the mouse to the other monitor.

Query number of notifications?

Is there a simple way to query the number of notifications? I have a polybar text module that I would like to make into a script module that would query the number of unread notifications once every 30 seconds or so. Currently the text module uses

[module/notifications]
type = custom/text
content = 
click-left = kill -s USR1 $(pidof deadd-notification-center)

but it would be nice to have

[module/notifications]
type = custom/script
exec = command-to-get-number-of-notifications
tail = true
interval = 30
click-left = kill -s USR1 $(pidof deadd-notification-center)
label =  %output%

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.