Closed twouters closed 3 years ago
I'm a little hesitant because the libnotify was added more like an example than a full-blown feature, my intention was to keep this project as a backend process and let people build any frontend they want on top. So if we start adding abilities to configure icons, we will open the door for configurable text and title in notification, then template support, then grouping notifications by type, etc...
Might I suggest trying out the API to build your own notification on top? In a simplest form, it's a script like so:
nc -U /run/user/1000/yubikey-touch-detector.socket | while read -n5 cmd; do
if [ "${cmd:4:1}" = "1" ]; then
# YubiKey is waiting for a touch! Call notify-send, play sound, change wallpaper, etc...
fi
done
But I would suggest taking my waybar module as a starting point and then replace printf
calls with a notification.
Alright, that makes perfect sense.
In case somebody every passes by: I've worked around this by overriding the icon path in dunstrc
— I'm using dunst as a notification daemon.
[yubikey-touch-detector]
appname = "yubikey-touch-detector"
new_icon = <path-to-icon>
The only change needed to support notification icon is this:
--- notifier/libnotify.go.orig
+++ notifier/libnotify.go
@@ -33,6 +33,7 @@
notification := notify.Notification{
AppName: "yubikey-touch-detector",
+ AppIcon: "yubikey-touch-detector",
Summary: "YubiKey is waiting for a touch",
}
You don’t have to provide the actual icon. If the notification service doesn’t find any, it just doesn’t display any icon (i.e. the current behaviour). This one-line change will allow the users (or linux package maintainers) to add their own icon named yubikey-touch-detector.[ext]
to one of the standard icon directories.
For example, you can use:
wget -O /usr/share/pixmaps/yubikey-touch-detector.svg https://raw.githubusercontent.com/alpinelinux/aports/1f596c2461794305a92b6ee5e53d9bb1c9a6f864/community/yubikey-touch-detector/yubikey-touch-detector.svg
I like this compromise 🙂 Applied in https://github.com/maximbaz/yubikey-touch-detector/commit/916faea86ca3932ae096a7f03ec86f6a1845394a
Added via #46
Would it be possible to add an optional icon to libnotify notifications to make it stand out a bit?
Could be based on touch.svg from yubioath-desktop if it's allowed to use their images.