-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup-kitty
executable file
·69 lines (51 loc) · 2.23 KB
/
setup-kitty
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
#!/usr/bin/env bash
set -euo pipefail
setup_for_darwin() {
echo "Updating icon..."
local -r dark_icon_path="$(mktemp -t -u 'kitty-dark.XXX.icns')"
curl -o "${dark_icon_path}" -fsSL https://github.com/DinkDonk/kitty-icon/raw/main/kitty-dark.icns
osascript -e 'set aFile to (POSIX file "/Applications/kitty.app") as alias' \
-e 'tell application "Finder" to open information window of aFile' \
-e 'activate application "Finder"'
open -W "${dark_icon_path}"
sudo killall Finder
sudo killall Dock
echo "Done!"
}
setup_for_debian() {
local -r installer="${1:-}"
local -r app_path="/opt/kitty.app"
echo "Downloading kitty..."
curl -fsSL https://sw.kovidgoyal.net/kitty/installer.sh | sudo sh /dev/stdin \
dest=/opt installer="${installer}" launch=n
sudo chown -R "${USER}":"${USER}" "${app_path}"
echo "Installing kitty..."
local -r bin_dir="${HOME}/.local/bin"
ln -nsf ${app_path}/bin/kitty "${bin_dir}"
echo "Installing manual pages..."
mkdir -p ~/.local/share/man/man{1,5}
gzip -c ${app_path}/share/man/man1/kitty.1 | tee ~/.local/share/man/man1/kitty.1.gz > /dev/null
gzip -c ${app_path}/share/man/man5/kitty.conf.5 | tee ~/.local/share/man/man5/kitty.conf.5.gz > /dev/null
echo "Updating terminfo database..."
tic -x ${app_path}/lib/kitty/terminfo/kitty.terminfo
echo "Adding desktop shortcut..."
local -r desktop_applications_dir="${HOME}/.local/share/applications"
desktop-file-install --dir="${desktop_applications_dir}" ${app_path}/share/applications/kitty.desktop
desktop-file-install --dir="${desktop_applications_dir}" ${app_path}/share/applications/kitty-open.desktop
local -r dark_icon_path="${app_path}/share/icons/hicolor/1024x1024/kitty-dark.png"
mkdir -p "$(dirname "${dark_icon_path}")"
curl -o "${dark_icon_path}" -fsSL https://github.com/DinkDonk/kitty-icon/raw/main/kitty-dark.png
sed -i "s|Icon=kitty|Icon=${dark_icon_path}|g" "${desktop_applications_dir}"/kitty*.desktop
sed -i "s|Exec=kitty|Exec=${app_path}/bin/kitty|g" "${desktop_applications_dir}"/kitty*.desktop
update-desktop-database "${desktop_applications_dir}"
echo "Done!"
}
case $OSTYPE in
darwin*)
setup_for_darwin;;
linux*)
setup_for_debian "$@";;
*)
echo "Unknown OS!"
exit 1;;
esac