1#!/usr/bin/env bash
2
3function command_exists() {
4 if ! command -v "$1" >/dev/null 2>&1
5 then
6 echo "<$1> could not be found"
7 return 1
8 else
9 return 0
10 fi
11}
12
13function command_needed() {
14 if ! command_exists "$1" ;
15 then
16 echo "$1 is a needed dependency"
17 fi
18}
19
20function font_exists() {
21 if ! fc-list | grep "$1" >/dev/null 2>&1
22 then
23 echo "please install font $1"
24 return 1
25 else
26 return 0
27 fi
28}
29
30function install_apple_emojis() {
31 local download_url=$(curl -s https://api.github.com/repos/samuelngs/apple-emoji-linux/releases/latest | jq --raw-output '.assets[0].browser_download_url')
32 mkdir -pv ~/.local/share/fonts
33 if [ -n "$download_url" ]; then
34 curl -L -o ~/.local/share/fonts/AppleColorEmoji.ttf "$download_url"
35 else
36 echo "error: could not find download url for apple emojis >.<"
37 fi
38}
39
40function install_bat_theme() {
41 mkdir -pv ~/.config/bat/themes/
42 curl -L -o ~/.config/bat/themes/Catppuccin\ Mocha.tmTheme 'https://raw.githubusercontent.com/catppuccin/bat/main/themes/Catppuccin Mocha.tmTheme'
43}
44
45command_needed stow
46command_needed fc-list
47command_needed fc-cache
48command_needed curl
49command_needed jq
50command_needed wl-copy
51
52stow xdg-user-dirs
53
54install_apple_emojis
55
56font_exists "Berkeley Mono"
57font_exists "Apple Color Emoji"
58font_exists "Noto Color Emoji"
59
60stow fontconfig
61fc-cache -f -v
62
63command_exists ghostty
64stow ghostty
65
66command_needed bat
67stow bat
68install_bat_theme
69bat cache --clear
70bat cache --build
71
72stow scripts