summaryrefslogtreecommitdiff
path: root/polybar/scripts/updates-action.sh
blob: a22a747446be9ed2345d12f5da44f31ab8c06e3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
set -euo pipefail

cmd='sudo pacman -Syu; echo; read -r -p "Press Enter to close..."'

if command -v kitty >/dev/null 2>&1; then
  exec kitty --title "System update" /usr/bin/env bash -lc "$cmd"
elif command -v foot >/dev/null 2>&1; then
  exec foot --title "System update" /usr/bin/env bash -lc "$cmd"
elif command -v xterm >/dev/null 2>&1; then
  exec xterm -T "System update" -e /usr/bin/env bash -lc "$cmd"
fi

if command -v dunstify >/dev/null 2>&1; then
  dunstify -a polybar -u normal "Updates" "No terminal found"
fi