aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/storeless
blob: a7114d5d1d9675ba9d26a3ae9f583c6180452ef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

store() {
	selection=$(yay -Ss | sed -z 's/\n\s\+/ - /g' | sed -E 's/^[^\/]*\///g' | sed -e 's/([0-9.]* .iB /(/g' | sed -e 's/\[base-devel\]//g' | sed -e 's/ \+/ /g' | dmenu)

	name=$(echo $selection | awk '{ print $1 }')

	if [ -z "$name" ]; then
		exit
	fi

	if [ -z "$(yay -Qs $name)" ]; then
		selection=$(printf 'Install\nInfo\nBack' | dmenu -p "Package: $name ")
	else
		selection=$(printf 'Remove\nInfo\nBack' | dmenu -p "Package: $name ")
	fi

	echo $name

	case "$selection" in
		Install)window "yay -S $name" && notify-send "Storeless" "$name Successfully Installed";;
		Remove)window "yay -Rns $name" && notify-send "Storeless" "$name Successfully Removed ";;
		Info)notify-send -t 0 "$name" "$(yay -Si $name)";;
		Back)store;;
	esac
}

primaryscreenwidth() {
	xrandr | grep primary | awk '{ print $4 }' | grep -o '^[0-9]*'
}

window() {
	st -g 108x24+10+40 -c floating $1
}

update() {
	window yay
	notify-send "Storeless" "System Up To Date"
}

case "$(printf "Store\nUpdate" | dmenu)" in
	Store)store;;
	Update)update;;
esac