Closed RunningDroid closed 1 year ago
I can confirm on Void the adding of the snippet of code on .zshrc solve the issue. thanks
I will have a look on that when I have more time. Currently I'm pretty stressed with work... For now please use the fix described in the Issue.
This issue should be resolved now as notify-send
was removed in #438
Just for information, i don't want to spam:
I saw the "deactivate notify-send" message earlier and wanted at least give an alternative solution for those who want to send a notification from the terminal but don't want to rely on the sub optimal notify-send (not restricted to topgrade). Create the file ~/.local/bin/send-notification
with this content:
#!/bin/bash
# Exit on error
set -e
# Get unique name of the org.freedesktop.Notifications bus
UNIQUE_NOTIF=$(
# Send a Ping message to the Notifications interface
# and extract the sender's unique name
dbus-send --session --print-reply \
--dest=org.freedesktop.Notifications \
/org/freedesktop/Notifications \
org.freedesktop.DBus.Peer.Ping \
| awk '/sender/ {gsub(/sender=/,"",$4); print $4}'
)
# Check if the notification service was found
if [ -z "$UNIQUE_NOTIF" ]; then
echo -e "[ERROR]\nNotification interface not found."
exit 1
else
echo -e "[Unique name notifications interface]\n${UNIQUE_NOTIF}\n"
fi
# Send a notification with buttons to trigger their ActionInvoked signals
app_name="TestApp"
replaces_id=0
app_icon="steam"
summary="Testsummary"
body="Testbody"
n_actions=2
key_action_1="key_action_1"
btn_action_1="Button 1"
key_action_2="key_action_2"
btn_action_2="Button 2"
n_hints=3
key_hint_1="urgency"
type_hint_1=y
value_hint_1=0x02
key_hint_2="resident"
type_hint_2=b
value_hint_2=true
key_hint_3="x-key-hint"
type_hint_3=s
value_hint_3="https://duckduckgo.com"
expire_timeout=-1
NOTIF_ID=$(
busctl --user -- \
call \
org.freedesktop.Notifications \
/org/freedesktop/Notifications \
org.freedesktop.Notifications \
Notify 'susssasa{sv}i' \
"$app_name" \
"$replaces_id" \
"$app_icon" \
"$summary" \
"$body" \
"$((n_actions*2))" \
"$key_action_1" "$btn_action_1" \
"$key_action_2" "$btn_action_2" \
"$n_hints" \
"$key_hint_1" "$type_hint_1" "$value_hint_1" \
"$key_hint_2" "$type_hint_2" "$value_hint_2" \
"$key_hint_3" "$type_hint_3" "$value_hint_3" \
"$expire_timeout" \
| grep -oP '[0-9]+'
)
# Print the notification id
echo "Notification ID: ${NOTIF_ID}"
Customize the input args by assigning them to the desired variable and enjoy.
kind of related to #288, but the description for that one is kind of broad. The easiest way to test this is to have notify-send installed and run
env -u DBUS_SESSION_BUS_ADDRESS -u DISPLAY topgrade --dry-run
so notify-send can't talk to dbusWhat actually happened?
Topgrade hangs indefinitely after notify-send exits with an error
Additional Details
A workaround is to add a function like this to your shell config: