Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.0 KiB

4 years ago
4 years ago
  1. #!/bin/sh
  2. case "$(readlink -f /sbin/init)" in
  3. *systemd*) export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus ;;
  4. esac
  5. ping -q -c 1 example.org > /dev/null || exit
  6. pgrepoutput="$(pgrep -a X\(org\|wayland\))"
  7. displays="$(echo "$pgrepoutput" | grep -wo "[0-9]*:[0-9]\+" | sort -u)"
  8. notify() {
  9. [ -n "$pgrepoutput" ] && for x in ${displays:-:0}; do
  10. export DISPLAY=$x
  11. notify-send --app-name="auto-update" "$1" "$2"
  12. done ;
  13. }
  14. notify " Repository Sync" "Checking for package updates..."
  15. sudo pacman -Syyuw --noconfirm || notify " An error occured" "Error downloading updates.
  16. Check your internet connection, if pacman is already running, or run update manually to see errors."
  17. if pacman -Qu | grep -v "\[ignored\]"
  18. then
  19. checkupdates 2> /dev/null > ~/.cache/pacman_updates
  20. notify " Repository Sync" "$(pacman -Qu | grep -v "\[ignored\]" | wc -l) Updates available. Click statusbar icon (  ) for update."
  21. else
  22. notify " Repository Sync" "Sync complete. No new packages for update."
  23. fi
  24. kill -49 "$(pidof dwmblocks)"