topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
2.01k stars 139 forks source link

Topgrade hangs after notify-send exits with an error #369

Closed RunningDroid closed 1 year ago

RunningDroid commented 1 year ago

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 dbus

What actually happened?

Topgrade hangs indefinitely after notify-send exits with an error

Additional Details

$ env -u DBUS_SESSION_BUS_ADDRESS -u DISPLAY topgrade --dry-run --verbose --env=RUST_BACKTRACE=full
DEBUG Configuration at /home/runningdroid/.config/topgrade.toml
DEBUG Loaded configuration: ConfigFile { pre_sudo: Some(true), pre_commands: Some({}), post_commands: None, commands: Some({"Config update": "git --git-dir=/home/runningdroid/.local/share/min_config.git --work-tree=/home/runningdroid pull --quiet --stat --ff-only"}), git_repos: None, predefined_git_repos: None, disable: Some([Pip3]), ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, display_preamble: Some(false), assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, python: Some(Python { enable_pip_review: None, enable_pipupgrade: None }), no_retry: None, run_in_tmux: None, cleanup: Some(true), notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, apt_arguments: None, enable_tlmgr: None, redhat_distro_sync: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None }), git: Some(Git { max_concurrency: None, arguments: None, repos: None, pull_predefined: None }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None, wsl_update_pre_release: None, wsl_update_use_web_download: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: Some(Distrobox { use_root: None, containers: None }) }
DEBUG Detected "/usr/bin/notify-send" as "notify-send"
DEBUG Version: 10.3.1
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["topgrade", "--dry-run", "--verbose", "--env=RUST_BACKTRACE=full"] }
DEBUG Binary path: Ok("/usr/bin/topgrade")
DEBUG Self Update: false
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Detected "/usr/bin/doas" as "doas"

── 20:07:03 - Sudo ─────────────────────────────────────────────────────────────
Dry running: /usr/bin/doas echo
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Step "System update"

── 20:07:03 - System update ────────────────────────────────────────────────────
Dry running: /usr/bin/doas xbps-install -Su xbps
Dry running: /usr/bin/doas xbps-install -u
DEBUG Step "config-update"
DEBUG Step "Brew"
DEBUG Step "yadm"
DEBUG Step "nix"
DEBUG Step "guix"
DEBUG Step "home-manager"
DEBUG Step "asdf"
DEBUG Step "pkgin"
DEBUG Step "bun"
DEBUG Path "/home/runningdroid/.config/emacs" doesn't exist
DEBUG Path "/home/runningdroid/.emacs.d" doesn't exist
DEBUG /home/runningdroid/.doom.d does not exists
DEBUG /home/runningdroid/.vim does not exists
DEBUG Checking if /home/runningdroid/.config/nvim is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any of the parent directories): .git
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:167

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl
      at ./csu/../csu/libc-start.c:381

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.)
DEBUG /home/runningdroid/.ideavimrc does not exists
DEBUG /home/runningdroid/.intellimacs does not exists
DEBUG /home/runningdroid/.dotfiles does not exists
DEBUG /home/runningdroid/.zshrc is a file. Checking /home/runningdroid
DEBUG Checking if /home/runningdroid is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any of the parent directories): .git
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:167

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl
      at ./csu/../csu/libc-start.c:381

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.)
DEBUG /home/runningdroid/.tmux does not exists
DEBUG /home/runningdroid/.config/fish does not exists
DEBUG /home/runningdroid/.config/openbox does not exists
DEBUG /home/runningdroid/.config/bspwm does not exists
DEBUG Checking if /home/runningdroid/.config/i3 is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any of the parent directories): .git
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:167

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl
      at ./csu/../csu/libc-start.c:381

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.)
DEBUG /home/runningdroid/.config/sway does not exists
DEBUG Step "Git repositories"
DEBUG Step "zr"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Step "antibody"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Step "antigen"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Path "/home/runningdroid/.zshrc" exists
DEBUG Path "/home/runningdroid/.cache/antigen/dotdir" exists

── 20:07:03 - antigen ──────────────────────────────────────────────────────────
Dry running: /usr/bin/zsh -l -c 'source /home/runningdroid/.zshrc && (antigen selfupdate ; antigen update)'
DEBUG Step "zgenom"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Path "/home/runningdroid/.zshrc" exists
DEBUG Step "zplug"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Path "/home/runningdroid/.zshrc" exists
DEBUG Step "zinit"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Path "/home/runningdroid/.zshrc" exists
DEBUG Step "zi"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Path "/home/runningdroid/.zshrc" exists
DEBUG Step "zim"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Executing command `zsh -c '[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}'`
DEBUG Command failed: Err(
   0: Command failed: `zsh -c '[[ -n ${ZIM_HOME} ]] && print -n ${ZIM_HOME}'`
   1: `zsh` failed: exit status: 1

Location:
   src/steps/zsh.rs:122

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl
      at ./csu/../csu/libc-start.c:381

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.)
DEBUG Step "oh-my-zsh"
DEBUG Detected "/usr/bin/zsh" as "zsh"
DEBUG Step "fisher"
DEBUG Step "bash-it"
DEBUG Step "oh-my-fish"
DEBUG Step "fish-plug"
DEBUG Step "fundle"
DEBUG Step "tmux"
DEBUG Step "TLDR"
DEBUG Step "pearl"
DEBUG Step "Gnome Shell Extensions"
DEBUG Detected "/usr/bin/gdbus" as "gdbus"
DEBUG Step "SDKMAN!"
DEBUG Detected "/usr/bin/bash" as "bash"
DEBUG Step "rcm"
DEBUG Step "apm"
DEBUG Step "fossil"
DEBUG Step "rustup"
DEBUG Step "juliaup"
DEBUG Step ".NET"
DEBUG Step "choosenim"
DEBUG Step "cargo"
DEBUG Path "/home/runningdroid/.cargo" exists
DEBUG Detected "/usr/bin/cargo" as "cargo"
DEBUG Path "/home/runningdroid/.cargo/.crates.toml" exists

── 20:07:03 - Cargo ────────────────────────────────────────────────────────────
DEBUG Detected "/home/runningdroid/.cargo/bin/cargo-install-update" as "cargo-install-update"
Dry running: /home/runningdroid/.cargo/bin/cargo-install-update install-update --git --all
DEBUG Step "Flutter"
DEBUG Step "go-global-update"
DEBUG Detected "/usr/bin/go" as "go"
DEBUG Executing command `/usr/bin/go env GOPATH`
DEBUG Step "gup"
DEBUG Detected "/usr/bin/go" as "go"
DEBUG Executing command `/usr/bin/go env GOPATH`
DEBUG Step "Emacs"
DEBUG Step "opam"
DEBUG Step "vcpkg"
DEBUG Step "pipx"
DEBUG Step "conda"
DEBUG Step "pip-review"
DEBUG Step "pipupgrade"
DEBUG Step "ghcup"
DEBUG Step "stack"
DEBUG Step "tlmgr"
DEBUG Step "myrepos"
DEBUG Step "chezmoi"
DEBUG Step "jetpack"
DEBUG Step "vim"
DEBUG Detected "/usr/bin/vim" as "vim"
DEBUG Executing command `/usr/bin/vim --version`
DEBUG Step "Neovim"
DEBUG Detected "/usr/bin/nvim" as "nvim"
DEBUG Path "/home/runningdroid/.config/nvim/init.vim" exists

── 20:07:03 - Neovim ───────────────────────────────────────────────────────────
DEBUG Wrote vim script to "/tmp/.tmpQLrjoE"
Dry running: /usr/bin/nvim -u /home/runningdroid/.config/nvim/init.vim --headless -V1 -nS /tmp/.tmpQLrjoE
DEBUG Step "The Ultimate vimrc"
DEBUG Step "voom"
DEBUG Step "Kakoune"
DEBUG Step "helix"
DEBUG Step "npm"
DEBUG Detected "/usr/bin/npm" as "npm"

── 20:07:03 - Node Package Manager ─────────────────────────────────────────────
DEBUG Executing command `/usr/bin/npm --version`
DEBUG Executing command `/usr/bin/npm root '--location=global'`
DEBUG Executing command `/usr/bin/npm --version`
Dry running: /usr/bin/npm update '--location=global'
DEBUG Step "yarn"
DEBUG Detected "/usr/bin/yarn" as "yarn"
DEBUG Detected "/usr/bin/yarn" as "yarn"
DEBUG Executing command `/usr/bin/yarn --version`

── 20:07:05 - Yarn Package Manager ─────────────────────────────────────────────
DEBUG Executing command `/usr/bin/yarn global dir`
DEBUG Step "pnpm"
DEBUG Step "Containers"
DEBUG Step "deno"
DEBUG Step "composer"
DEBUG Step "krew"
DEBUG Step "helm"
DEBUG Step "gem"
DEBUG Detected "/usr/bin/gem" as "gem"
DEBUG Step "rubygems"
DEBUG Step "julia"
DEBUG Step "haxelib"
DEBUG Step "sheldon"
DEBUG Step "rtcl"
DEBUG Step "bin"
DEBUG Step "gcloud"
DEBUG Step "micro"
DEBUG Step "raco"
DEBUG Step "spicetify"
DEBUG Step "GitHub CLI Extensions"
DEBUG Step "am"
DEBUG Step "deb-get"
DEBUG Step "toolbx"
DEBUG Step "Flatpak"
DEBUG Detected "/usr/bin/flatpak" as "flatpak"

── 20:07:06 - Flatpak User Packages ────────────────────────────────────────────
Dry running: /usr/bin/flatpak update --user
Dry running: /usr/bin/flatpak uninstall --user --unused

── 20:07:06 - Flatpak System Packages ──────────────────────────────────────────
Dry running: /usr/bin/flatpak update --system
Dry running: /usr/bin/flatpak uninstall --system --unused
DEBUG Step "snap"
DEBUG Step "pacstall"
DEBUG Step "pacdef"
DEBUG Step "protonup"
DEBUG Step "distrobox"
DEBUG Step "dkp-pacman"
DEBUG Step "Config update"

── 20:07:06 - Config update ────────────────────────────────────────────────────
Dry running: /bin/zsh -c 'git --git-dir=/home/runningdroid/.local/share/min_config.git --work-tree=/home/runningdroid pull --quiet --stat --ff-only'
DEBUG Step "pihole"
DEBUG Step "Firmware upgrades"
DEBUG Step "Restarts"
DEBUG Step "Vagrant boxes"

── 20:07:06 - Summary ──────────────────────────────────────────────────────────
System update: OK
config-update: OK
Brew: SKIPPED: Cannot find "brew" in PATH
yadm: SKIPPED: Cannot find "yadm" in PATH
nix: SKIPPED: Cannot find "nix" in PATH
guix: SKIPPED: Cannot find "guix" in PATH
home-manager: SKIPPED: Cannot find "home-manager" in PATH
asdf: SKIPPED: Cannot find "asdf" in PATH
pkgin: SKIPPED: Cannot find "pkgin" in PATH
bun: SKIPPED: Cannot find "bun" in PATH
Git repositories: SKIPPED: No repositories to pull
zr: SKIPPED: Cannot find "zr" in PATH
antibody: SKIPPED: Cannot find "antibody" in PATH
antigen: OK
zgenom: SKIPPED: Path "/home/runningdroid/.zgenom" doesn't exist
zplug: SKIPPED: Path "/home/runningdroid/.zplug" doesn't exist
zinit: SKIPPED: Path "/home/runningdroid/.zinit" doesn't exist
zi: SKIPPED: Path "/home/runningdroid/.zi" doesn't exist
zim: SKIPPED: Path "/home/runningdroid/.zim" doesn't exist
oh-my-zsh: SKIPPED: Path "/home/runningdroid/.oh-my-zsh" doesn't exist
fisher: SKIPPED: Cannot find "fish" in PATH
bash-it: SKIPPED: Path "/home/runningdroid/.bash_it" doesn't exist
oh-my-fish: SKIPPED: Cannot find "fish" in PATH
fish-plug: SKIPPED: Cannot find "fish" in PATH
fundle: SKIPPED: Cannot find "fish" in PATH
tmux: SKIPPED: Path "/home/runningdroid/.tmux/plugins/tpm/bin/update_plugins" doesn't exist
TLDR: SKIPPED: Cannot find "tldr" in PATH
pearl: SKIPPED: Cannot find "pearl" in PATH
Gnome Shell Extensions: SKIPPED: Desktop doest not appear to be gnome
SDKMAN!: SKIPPED: Path "/home/runningdroid/.sdkman/bin/sdkman-init.sh" doesn't exist
rcm: SKIPPED: Cannot find "rcup" in PATH
apm: SKIPPED: Cannot find "apm" in PATH
fossil: SKIPPED: Cannot find "fossil" in PATH
rustup: SKIPPED: Cannot find "rustup" in PATH
juliaup: SKIPPED: Cannot find "juliaup" in PATH
.NET: SKIPPED: Cannot find "dotnet" in PATH
choosenim: SKIPPED: Cannot find "choosenim" in PATH
cargo: OK
Flutter: SKIPPED: Cannot find "flutter" in PATH
go-global-update: SKIPPED: Path "/home/runningdroid/.local/share///go/bin/go-global-update" doesn't exist
gup: SKIPPED: Path "/home/runningdroid/.local/share///go/bin/gup" doesn't exist
Emacs: SKIPPED: Cannot find "emacs" in PATH
opam: SKIPPED: Cannot find "opam" in PATH
vcpkg: SKIPPED: Cannot find "vcpkg" in PATH
pipx: SKIPPED: Cannot find "pipx" in PATH
conda: SKIPPED: Cannot find "conda" in PATH
pip-review: SKIPPED: Cannot find "pip-review" in PATH
pipupgrade: SKIPPED: Cannot find "pipupgrade" in PATH
ghcup: SKIPPED: Cannot find "ghcup" in PATH
stack: SKIPPED: Cannot find "stack" in PATH
tlmgr: SKIPPED: tlmgr must be explicity enabled in the configuration to run in Android/Linux
myrepos: SKIPPED: Cannot find "mr" in PATH
chezmoi: SKIPPED: Cannot find "chezmoi" in PATH
jetpack: SKIPPED: Cannot find "jetpack" in PATH
vim: SKIPPED: vim binary might be actually nvim
Neovim: OK
The Ultimate vimrc: SKIPPED: Path "/home/runningdroid/.vim_runtime" doesn't exist
voom: SKIPPED: Cannot find "voom" in PATH
Kakoune: SKIPPED: Cannot find "kak" in PATH
helix: SKIPPED: Cannot find "helix" in PATH
npm: OK
yarn: SKIPPED: Yarn root at /home/runningdroid/.local/share/yarn/global doesn't exist
pnpm: SKIPPED: Cannot find "pnpm" in PATH
Containers: SKIPPED: Cannot find "docker" in PATH
deno: SKIPPED: Cannot find "deno" in PATH
composer: SKIPPED: Cannot find "composer" in PATH
krew: SKIPPED: Cannot find "kubectl-krew" in PATH
helm: SKIPPED: Cannot find "helm" in PATH
gem: SKIPPED: Path "/home/runningdroid/.gem" doesn't exist
rubygems: SKIPPED: Path "/home/runningdroid/.gem" doesn't exist
julia: SKIPPED: Cannot find "julia" in PATH
haxelib: SKIPPED: Cannot find "haxelib" in PATH
sheldon: SKIPPED: Cannot find "sheldon" in PATH
rtcl: SKIPPED: Cannot find "rupdate" in PATH
bin: SKIPPED: Cannot find "bin" in PATH
gcloud: SKIPPED: Cannot find "gcloud" in PATH
micro: SKIPPED: Cannot find "micro" in PATH
raco: SKIPPED: Cannot find "raco" in PATH
spicetify: SKIPPED: Cannot find "spicetify" in PATH
GitHub CLI Extensions: SKIPPED: Cannot find "gh" in PATH
am: SKIPPED: Cannot find "am" in PATH
deb-get: SKIPPED: Cannot find "deb-get" in PATH
toolbx: SKIPPED: Cannot find "toolbox" in PATH
Flatpak: OK
snap: SKIPPED: Cannot find "snap" in PATH
pacstall: SKIPPED: Cannot find "pacstall" in PATH
pacdef: SKIPPED: Cannot find "pacdef" in PATH
protonup: SKIPPED: Cannot find "protonup" in PATH
distrobox: SKIPPED: Cannot find "distrobox" in PATH
dkp-pacman: SKIPPED: Cannot find "dkp-pacman" in PATH
Config update: OK
pihole: SKIPPED: Cannot find "pihole" in PATH
Firmware upgrades: SKIPPED: Cannot find "fwupdmgr" in PATH
Restarts: SKIPPED: Cannot find "needrestart" in PATH
Vagrant boxes: SKIPPED: Cannot find "vagrant" in PATH
DEBUG Desktop notification: Topgrade finished successfully
DEBUG Executing command `/usr/bin/notify-send -t 10000 -a Topgrade Topgrade 'Topgrade finished successfully'`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/notify-send -t 10000 -a Topgrade Topgrade 'Topgrade finished successfully'`

      Stderr:
      Cannot autolaunch D-Bus without X11 $DISPLAY
   1: `/usr/bin/notify-send` failed: exit status: 1

Location:
   src/terminal.rs:108

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_call_main
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
   2: __libc_start_main_impl
      at ./csu/../csu/libc-start.c:381

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.)
^\zsh: quit       env -u DBUS_SESSION_BUS_ADDRESS -u DISPLAY topgrade --dry-run --verbose

A workaround is to add a function like this to your shell config:

if command -v topgrade >/dev/null; then
    topgrade() {
        if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -z "$DISPLAY" ]; then
            env topgrade --skip-notify "$@"
        else
            env topgrade "$@"
        fi
    }
fi
m4lin commented 1 year ago

I can confirm on Void the adding of the snippet of code on .zshrc solve the issue. thanks

s34m commented 1 year ago

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.

SteveLauC commented 1 year ago

This issue should be resolved now as notify-send was removed in #438

cloudishBenne commented 1 year ago

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.