Skip to content

Commit

Permalink
chore(default-flatpaks): No need to query DISPLAY variable for `not…
Browse files Browse the repository at this point in the history
…ify-send`

Notifications work without it & custom images without XWayland don't have `DISPLAY` variable at all (eg. secureblue & custom images based on it)
  • Loading branch information
fiftydinar authored Oct 23, 2024
1 parent 7d08c2e commit 89ea220
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions modules/default-flatpaks/v1/system-flatpak-setup
Original file line number Diff line number Diff line change
Expand Up @@ -157,32 +157,28 @@ function notify-send-pre-install {
user_name=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .user')
uid=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .uid')
xdg_runtime_path="/run/user/$uid"
display_var=$(printenv DISPLAY)
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus DISPLAY="$display_var" notify-send "Flatpak Installer" "Started install of system flatpaks" --app-name="Flatpak Installer" -u NORMAL
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus notify-send "Flatpak Installer" "Started install of system flatpaks" --app-name="Flatpak Installer" -u NORMAL
}

function notify-send-install {
user_name=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .user')
uid=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .uid')
xdg_runtime_path="/run/user/$uid"
display_var=$(printenv DISPLAY)
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus DISPLAY="$display_var" notify-send "Flatpak Installer" "Finished install of system flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus notify-send "Flatpak Installer" "Finished install of system flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
}

function notify-send-pre-uninstall {
user_name=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .user')
uid=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .uid')
xdg_runtime_path="/run/user/$uid"
display_var=$(printenv DISPLAY)
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus DISPLAY="$display_var" notify-send "Flatpak Installer" "Started uninstall of some system flatpaks" --app-name="Flatpak Installer" -u NORMAL
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus notify-send "Flatpak Installer" "Started uninstall of some system flatpaks" --app-name="Flatpak Installer" -u NORMAL
}

function notify-send-uninstall {
user_name=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .user')
uid=$(loginctl list-users --output=json | jq -r '.[] | select(.state == "active") | .uid')
xdg_runtime_path="/run/user/$uid"
display_var=$(printenv DISPLAY)
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus DISPLAY="$display_var" notify-send "Flatpak Installer" "Finished uninstall of system flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL
sudo -u "$user_name" DBUS_SESSION_BUS_ADDRESS=unix:path="$xdg_runtime_path"/bus notify-send "Flatpak Installer" "Finished uninstall of system flatpaks:\n$REMOVE_LIST" --app-name="Flatpak Installer" -u NORMAL
}

# Install flatpaks in list
Expand Down

0 comments on commit 89ea220

Please sign in to comment.