Add icon support for notifications and clean up installation script

This commit is contained in:
Edgar P. Burkhart 2025-03-09 23:51:32 +01:00
parent 58b864a2eb
commit bb397847ce
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
4 changed files with 34 additions and 36 deletions

View file

@ -33,4 +33,5 @@ package() {
python -m installer --destdir="${pkgdir}" dist/*.whl
install -Dm644 config.example.toml "${pkgdir}/etc/${pkgname%-git}/config.toml"
install -Dm644 ${pkgname%-git}.service "${pkgdir}/usr/lib/systemd/system/${pkgname%-git}.service"
install -Dm644 icon.svg "${pkgdir}/usr/share/icons/hicolor/scalable/apps/fr.edgarpierre.hasspy.svg"
}

View file

@ -1,35 +0,0 @@
# This is a default template for a post-install scriptlet.
# Uncomment only required functions and remove any functions
# you don't need (and this header).
## arg 1: the new package version
#pre_install() {
# do something here
#}
## arg 1: the new package version
#post_install() {
# do something here
#}
## arg 1: the new package version
## arg 2: the old package version
#pre_upgrade() {
# do something here
#}
## arg 1: the new package version
## arg 2: the old package version
#post_upgrade() {
# do something here
#}
## arg 1: the old package version
#pre_remove() {
# do something here
#}
## arg 1: the old package version
#post_remove() {
# do something here
#}

View file

@ -264,7 +264,14 @@ class HassUserClient(HassClient):
payload = message.payload.decode("utf-8")
log.info(f"Received notification: {payload}")
run_command(["notify-send", payload])
run_command(
[
"notify-send",
payload,
"-i",
"/usr/share/icons/hicolor/scalable/apps/fr.edgarpierre.hasspy.svg",
]
)
@property
def availability_topic(self) -> str:

25
icon.svg Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="256" height="256" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="Gradient" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" style="stop-color:#66CC33;stop-opacity:1" />
<stop offset="100%" style="stop-color:#3ABEFF;stop-opacity:1" />
</linearGradient>
<filter id="alpha-to-white">
<feColorMatrix in="SourceGraphic" type="matrix"
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.8 0"/>
</filter>
<g id="child-svg"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="16px" width="16px"><path d="M19,16C19,17.72 18.37,19.3 17.34,20.5C17.75,20.89 18,21.41 18,22H6C6,21.41 6.25,20.89 6.66,20.5C5.63,19.3 5,17.72 5,16H3C3,14.75 3.57,13.64 4.46,12.91L4.47,12.89C6,11.81 7,10 7,8V7A5,5 0 0,1 12,2A5,5 0 0,1 17,7V8C17,10 18,11.81 19.53,12.89L19.54,12.91C20.43,13.64 21,14.75 21,16H19M16,16A4,4 0 0,0 12,12A4,4 0 0,0 8,16A4,4 0 0,0 12,20A4,4 0 0,0 16,16M10,9L12,10.5L14,9L12,7.5L10,9M10,5A1,1 0 0,0 9,6A1,1 0 0,0 10,7A1,1 0 0,0 11,6A1,1 0 0,0 10,5M14,5A1,1 0 0,0 13,6A1,1 0 0,0 14,7A1,1 0 0,0 15,6A1,1 0 0,0 14,5Z" /></svg></g>
</defs>
<rect
width="256"
height="256"
fill="url(#Gradient)"
ry="128"
x="0"
y="0" />
<use xlink:href="#child-svg" filter="url(#alpha-to-white)"
transform="matrix(8,0,0,8,64,64)" />
</svg>

After

(image error) Size: 1.4 KiB