summaryrefslogtreecommitdiff
path: root/.local/bin/desktop/beautify
blob: e535129df9fd2b1960913c9834cf1b63a0dd3afd (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh

## properties of script

## set home screen and lock screen wallpaper
HOMEWALL="${XDG_DATA_HOME:-$HOME/.local/share}/wallpapers/artix-wampire.png"
LOCKWALL="${XDG_DATA_HOME:-$HOME/.local/share}/wallpapers/artix-wampire.png"

## choose random wallpaper from a directory
# WALLPAPERS="$HOME/.local/share/wallpapers"
## requires 'setbg' script found in lukesmithxyz github repo
setbg_link="https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/setbg"
## path to download script files like setbg
BIN="$HOME/.local/bin"

# Location to put lock screen wallpaper for lock program
LOCKWALL_LOC="/tmp/lockWall"

## list of programs to be installed/uninstalled
PROGRAMS="eza dust conky picom xwallpaper cxxmatrix"
## some additional programs that I think are essential are installed below
## these will be not removed during uninstall


help() { echo "beautify - beautify you desktop environment

USAGE:
	beautify [OPTION]...

OPTIONS:
	-h  show this help message

	-i  install programs for beautification
	-u  uninstall beautification programs
	-x  clear beautifications

	The above group of options are conflicting.
	Passing any one of them will disable the others.

This is very much a personal script and is meant to be configured directly.
I have only made it work with arch linux and the pacman package manager."; }

err() { printf 'beautify: %s\n' "$@" >&2; exit 1; }
while getopts 'iuxh' o; do case "$o" in
	i) opflag=0 ;;
	u) opflag=1 ;;
	x) opflag=2 ;;
	h) help >&2; exit ;;
	*) err "invalid option -- '$OPTARG'" ;;
esac done
shift $((OPTIND - 1))

case "$opflag" in
	0)
		PROGRAMS="$PROGRAMS neovim tmux dunst highlight starship"
		sudo pacman -Syu --noconfirm
		for pkg in $PROGRAMS; do
			if ! pacman -Q "$pkg" >/dev/null; then
				yay -S --noconfirm "$pkg"
			fi
		done

		mkdir -pv ~/.local/bin
		wget -c "$setbg_link" -o "${BIN}/setbg" && chmod +x "${BIN}/setbg"
		;;

	1)
		for pkg in $PROGRAMS; do
			if pacman -Q "$pkgs" >/dev/null; then
				sudo pacman -Rns --noconfirm "$pkg"
			fi
		done
		rm -f "$setbg"
		;;

	2)
		i3-msg 'gaps inner all set 0'
		xwallpaper --clear
		rm -f "$LOCKWALL_LOC"
		killall -q -o 1s conky picom beautify
		;;
esac

[ -n "$opflag" ] && exit

if [ "${LOCKWALL%.png}" = "$LOCKWALL" ]; then
	temp="/tmp/$(basename "${LOCKWALL%.*}.png")"
	convert "$LOCKWALL" "$temp"
	cp -f "$temp" "$LOCKWALL_LOC"
	rm -f "$temp"
else
	cp -f "$LOCKWALL" "$LOCKWALL_LOC"
fi

i3-msg 'gaps inner all set 10'
xwallpaper --zoom "$HOMEWALL"
pidof -q conky || conky
pidof -q picom || picom -b

if [ -e "$WALLPAPERS" ]; then
	while sleep 1m; do setbg "$WALLPAPERS"; done
fi