aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/script/dmenu-newsboat
blob: 15cd78b51185e76b8bf928b3d3f092d9b800e8ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

profiles="$(find "${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/" -name 'urls-*' -exec sh -c 'basename "$1" | sed "s/^urls-//"' /bin/sh {} \;)"
if [ -z "$profiles" ]; then
	# shellcheck disable=SC2086
	setsid -f $TERMINAL -e newsboat
	exit 0
fi
choice="$(printf "Default\n%s" "$profiles" | dmenu -i -p "Profile")"
if [ -z "$choice" ]; then
	exit 0
elif [ "$choice" = "Default" ]; then
	# shellcheck disable=SC2086
	setsid -f $TERMINAL -e newsboat
else
	# shellcheck disable=SC2086
	setsid -f $TERMINAL -e newsboat -u "${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/urls-${choice}" -c "${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/cache-${choice}.db"
fi