Notifications now stay in history.

This commit is contained in:
baduhai
2021-08-26 23:21:40 +02:00
parent d0396c4916
commit 79c18873d5
7 changed files with 18 additions and 4 deletions

View File

@@ -10,4 +10,11 @@ install:
# files in /usr/lib # files in /usr/lib
install -d $(DESTDIR)$(PREFIX)/lib/gotify-dunst/ install -d $(DESTDIR)$(PREFIX)/lib/gotify-dunst/
install main.py $(DESTDIR)$(PREFIX)/lib/gotify-dunst/ install main.py $(DESTDIR)$(PREFIX)/lib/gotify-dunst/
install gotify-dunst.conf $(DESTDIR)$(PREFIX)/lib/gotify-dunst/ install gotify-dunst.conf $(DESTDIR)$(PREFIX)/lib/gotify-dunst/
# files in /usr/share
install gotify-dunst.desktop $(DESTDIR)$(PREFIX)/share/applications
install gotify-16.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/gotify.png
install gotify-32.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/gotify.png
install gotify-96.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/96x96/apps/gotify.png
install gotify-128.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/gotify.png

BIN
gotify-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
gotify-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

BIN
gotify-32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
gotify-96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

7
gotify-dunst.desktop Normal file
View File

@@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=gotify-dunst
Exec=/usr/lib/gotify-dunst/main.py
Icon=gotify
# Hide application from user menu
NoDisplay=true

View File

@@ -57,11 +57,11 @@ def get_picture(appid):
def send_notification(message): def send_notification(message):
m = json.loads(message) m = json.loads(message)
if m['priority'] <= 3: if m['priority'] <= 3:
subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "low", "-i", get_picture(m['appid']), "-a", "Gotify"]) subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "low", "-i", get_picture(m['appid']), "-a", "Gotify", "-h", "string:desktop-entry:gotify-dunst"])
if 4 <= m['priority'] <= 7: if 4 <= m['priority'] <= 7:
subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "normal", "-i", get_picture(m['appid']), "-a", "Gotify"]) subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "normal", "-i", get_picture(m['appid']), "-a", "Gotify", "-h", "string:desktop-entry:gotify-dunst"])
if m['priority'] > 7: if m['priority'] > 7:
subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "critical", "-i", get_picture(m['appid']), "-a", "Gotify"]) subprocess.Popen(['notify-send', m['title'], m['message'], "-u", "critical", "-i", get_picture(m['appid']), "-a", "Gotify", "-h", "string:desktop-entry:gotify-dunst"])
def on_message(ws, message): def on_message(ws, message):
print(message) print(message)