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.

36 lines
1.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #!/bin/sh
  2. [ -f "$XDG_CACHE_HOME/dbus_settings" ] && "$XDG_CACHE_HOME/dbus_settings" # Load the dbus settings for current session
  3. ping -q -c 1 example.org > /dev/null || exit
  4. displays="$(ps -u $(id -u) -o pid= \
  5. | xargs -I PID -r cat /proc/PID/environ 2> /dev/null \
  6. | tr '\0' '\n' \
  7. | grep ^DISPLAY=: \
  8. | sort -u \
  9. | xargs \
  10. | cut -d ":" -f2)"
  11. notify() {
  12. IFS="\n"
  13. for x in $displays; do
  14. export DISPLAY=$x
  15. notify-send --app-name="$1" "$2"
  16. done ;
  17. }
  18. notify " Repository Sync" "Checking for package updates..."
  19. sudo pacman -Syyuw --noconfirm || notify " An error occured" "Error downloading updates.
  20. Check your internet connection, if pacman is already running, or run update manually to see errors."
  21. if pacman -Qu | grep -v "\[ignored\]"
  22. then
  23. checkupdates 2> /dev/null > ~/.cache/pacman_updates
  24. notify " Repository Sync" "$(pacman -Qu | grep -v "\[ignored\]" | wc -l) Updates available. Click statusbar icon (  ) for update."
  25. else
  26. notify " Repository Sync" "Sync complete. No new packages for update."
  27. fi
  28. kill -49 "$(pidof dwmblocks)"