Skip to content

Commit da758c7

Browse files
authored
Detect latest upstream versions (pkgforge-dev#9)
* Detect latest upstream versions - Detect latest upstream versions - Separate appdata.xml from script code (prepare for multi-arch builds) - Ignore some files * Add some fixes * Optimize images * Add icon to appdata * Investigate failure * Fix * Fix Gnome dock issues * Configure desktop file as it is done in WezTerm * Revert and use static versions - Make the code to pick the latest versions require the parameter "latest" * Remove wezterm refernece from commented section
1 parent f9de6ea commit da758c7

File tree

8 files changed

+157
-33
lines changed

8 files changed

+157
-33
lines changed

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
*.AppImage
2+
*.tar.gz
3+
4+
# Swap
5+
[._]*.s[a-v][a-z]
6+
!*.svg # comment out if you don't need vector files
7+
[._]*.sw[a-p]
8+
[._]s[a-rt-v][a-z]
9+
[._]ss[a-gi-z]
10+
[._]sw[a-p]
11+
12+
# Session
13+
Session.vim
14+
Sessionx.vim
15+
16+
# Temporary
17+
.netrwhist
18+
*~
19+
# Auto-generated tag files
20+
tags
21+
# Persistent undo
22+
[._]*.un~

assets/1.png

-8.5 KB
Loading

assets/2.png

-13.8 KB
Loading

assets/appimage.png

-9.91 KB
Loading

assets/ghostty.appdata.xml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<component type="desktop-application">
3+
<content_rating type="oars-1.0" />
4+
<id>com.mitchellh.ghostty</id>
5+
<metadata_license>MIT</metadata_license>
6+
<project_license>MIT</project_license>
7+
<name>Ghostty</name>
8+
<icon type="remote">https://raw.githubusercontent.com/ghostty-org/ghostty/refs/heads/main/images/icons/icon_256.png</icon>
9+
<summary>Fast, native, feature-rich terminal emulator pushing modern features</summary>
10+
<description>
11+
<p>
12+
Ghostty is a terminal emulator that differentiates itself by being fast,
13+
feature-rich, and native. While there are many excellent terminal
14+
emulators available, they all force you to choose between speed,
15+
features, or native UIs. Ghostty provides all three.
16+
</p>
17+
18+
<p>
19+
In all categories, I am not trying to claim that Ghostty is the best
20+
(i.e. the fastest, most feature-rich, or most native). But Ghostty is
21+
competitive in all three categories and Ghostty doesn't make you choose
22+
between them.
23+
</p>
24+
25+
<p>
26+
Ghostty also intends to push the boundaries of what is possible with a
27+
terminal emulator by exposing modern, opt-in features that enable CLI
28+
tool developers to build more feature rich, interactive applications.
29+
</p>
30+
31+
<p>
32+
While aiming for this ambitious goal, our first step is to make Ghostty
33+
one of the best fully standards compliant terminal emulator, remaining
34+
compatible with all existing shells and software while supporting all of
35+
the latest terminal innovations in the ecosystem. You can use Ghostty as
36+
a drop-in replacement for your existing terminal emulator.
37+
</p>
38+
</description>
39+
40+
<launchable type="desktop-id">com.mitchellh.ghostty.desktop</launchable>
41+
42+
<url type="homepage">https://ghostty.org/</url>
43+
<url type="help">https://ghostty.org/docs/about</url>
44+
<url type="bugtracker">https://github.com/ghostty-org/ghostty/issues</url>
45+
46+
<!-- tbd
47+
<screenshots>
48+
<screenshot type="default">
49+
<caption>Use background image attachments</caption>
50+
<image>https://ghostty.org/tbd-screenshot.png</image>
51+
</screenshot>
52+
</screenshots>
53+
-->
54+
55+
<developer id="com.mitchellh">
56+
<name>Mitchell Hashimoto</name>
57+
</developer>
58+
59+
<releases>
60+
<release version="v1.0.1+1" date="2025-01-09">
61+
<description>
62+
<p>
63+
Initial AppImage build.
64+
</p>
65+
</description>
66+
</release>
67+
</releases>
68+
</component>

assets/ghostty.desktop

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Desktop Entry]
2+
Name=Ghostty
3+
Type=Application
4+
Comment=A terminal emulator
5+
Exec=ghostty
6+
Icon=com.mitchellh.ghostty
7+
StartupWMClass=com.mitchellh.ghostty
8+
Categories=System;TerminalEmulator;Utility;
9+
Keywords=terminal;tty;pty;
10+
StartupNotify=true
11+
Terminal=false
12+
Actions=new-window;
13+
X-GNOME-UsesNotifications=true
14+
X-TerminalArgExec=-e
15+
X-TerminalArgTitle=--title=
16+
X-TerminalArgAppId=--class=
17+
X-TerminalArgDir=--working-directory=
18+
X-TerminalArgHold=--wait-after-command
19+
20+
[Desktop Action new-window]
21+
Name=New Window
22+
Exec=ghostty

build.sh

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,25 @@
33
set -e
44

55
export ARCH="$(uname -m)"
6+
67
GHOSTTY_VERSION="1.0.1"
8+
9+
# Detect latest version numbers when jq is available.
10+
if command -v jq >/dev/null 2>&1; then
11+
if [ "$1" = "latest" ]; then
12+
GHOSTTY_VERSION="$(
13+
curl -s https://api.github.com/repos/ghostty-org/ghostty/tags |
14+
jq '[.[] | select(.name != "tip") | .name | ltrimstr("v")] | sort_by(split(".") | map(tonumber)) | last'
15+
)"
16+
fi
17+
fi
18+
719
TMP_DIR="/tmp/ghostty-build"
820
APP_DIR="${TMP_DIR}/ghostty.AppDir"
921
PUB_KEY="RWQlAjJC23149WL2sEpT/l0QKy7hMIFhYdQOFy0Z7z7PbneUgvlsnYcV"
10-
UPINFO="gh-releases-zsync|$(echo "$GITHUB_REPOSITORY" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
22+
UPINFO="gh-releases-zsync|$(echo "${GITHUB_REPOSITORY:-no-user/no-repo}" | tr '/' '|')|latest|*$ARCH.AppImage.zsync"
23+
APPDATA_FILE="${PWD}/assets/ghostty.appdata.xml"
24+
DESKTOP_FILE="${PWD}/assets/ghostty.desktop"
1125

1226
rm -rf "${TMP_DIR}"
1327

@@ -20,7 +34,7 @@ wget -q "https://release.files.ghostty.org/${GHOSTTY_VERSION}/ghostty-${GHOSTTY_
2034

2135
minisign -V -m "ghostty-${GHOSTTY_VERSION}.tar.gz" -P "${PUB_KEY}" -s "ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
2236

23-
rm ghostty-${GHOSTTY_VERSION}.tar.gz.minisig
37+
rm "ghostty-${GHOSTTY_VERSION}.tar.gz.minisig"
2438

2539
tar -xzmf "ghostty-${GHOSTTY_VERSION}.tar.gz"
2640

@@ -52,7 +66,7 @@ if ! mv ./usr/lib/ld-linux-x86-64.so.2 ./; then
5266
cp -v /lib64/ld-linux-x86-64.so.2 ./
5367
fi
5468

55-
# prep appimage
69+
# Prepare AppImage -- Configure launcher script, metainfo and desktop file with icon.
5670
cat <<'EOF' >./AppRun
5771
#!/usr/bin/env sh
5872
@@ -66,33 +80,15 @@ EOF
6680

6781
chmod +x AppRun
6882

69-
ln -s usr/share/applications/com.mitchellh.ghostty.desktop .
70-
ln -s usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png .
71-
72-
sed -i 's/;TerminalEmulator;/;TerminalEmulator;Utility;/' com.mitchellh.ghostty.desktop
73-
74-
cat <<'EOF' >./usr/share/metainfo/com.mitchellh.ghostty.appdata.xml
75-
<?xml version="1.0" encoding="UTF-8"?>
76-
<component type="desktop-application">
77-
<content_rating type="oars-1.0" />
78-
<description>
79-
<p>
80-
👻 Ghostty is a fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration.
81-
</p>
82-
</description>
83-
<developer id="com.mitchellh">
84-
<name>Mitchell Hashimoto</name>
85-
</developer>
86-
<icon type="remote">https://raw.githubusercontent.com/ghostty-org/ghostty/refs/heads/main/images/icons/icon_256.png</icon>
87-
<id>com.mitchellh.ghostty</id>
88-
<launchable type="desktop-id">com.mitchellh.ghostty.desktop</launchable>
89-
<metadata_license>MIT</metadata_license>
90-
<name>Ghostty</name>
91-
<project_license>MIT</project_license>
92-
<summary>A terminal emulator</summary>
93-
<url type="homepage">https://ghostty.org</url>
94-
</component>
95-
EOF
83+
cp "${APPDATA_FILE}" "usr/share/metainfo/com.mitchellh.ghostty.appdata.xml"
84+
85+
# Fix Gnome dock issues -- StartupWMClass attribute needs to be present.
86+
cp "${DESKTOP_FILE}" "usr/share/applications/com.mitchellh.ghostty.desktop"
87+
# WezTerm has this, it might be useful.
88+
ln -s "com.mitchellh.ghostty.desktop" "usr/share/applications/ghostty.desktop"
89+
90+
ln -s "usr/share/applications/com.mitchellh.ghostty.desktop" .
91+
ln -s "usr/share/icons/hicolor/256x256/apps/com.mitchellh.ghostty.png" .
9692

9793
cd "${TMP_DIR}"
9894

setup.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ set -e
55
export DEBIAN_FRONTEND="noninteractive"
66

77
ZIG_VERSION="0.13.0"
8+
MINISIGN_URL="https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz"
9+
10+
# Detect latest version numbers when jq is available.
11+
if command -v jq >/dev/null 2>&1; then
12+
if [ "$1" = "latest" ]; then
13+
ZIG_VERSION="$(
14+
curl -s "https://ziglang.org/download/index.json" |
15+
jq -r '[keys[] | select(. != "master" and contains("."))] | sort_by(split(".") | map(tonumber)) | last'
16+
)"
17+
MINISIGN_URL="$(
18+
curl -s "https://api.github.com/repos/jedisct1/minisign/releases/latest" |
19+
jq -r --arg prefix "minisign" --arg suffix "linux.tar.gz" \
20+
'.assets[] | select(.name | startswith($prefix) and endswith($suffix)) | .browser_download_url'
21+
)"
22+
fi
23+
fi
824

925
# update & install os base dependencies
1026
buildPkgs="build-essential libonig-dev libbz2-dev pandoc wget fuse libfuse2t64 file zsync appstream"
@@ -17,8 +33,8 @@ wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/a
1733
install appimagetool-x86_64.AppImage /usr/local/bin/appimagetool
1834

1935
# minisign: https://github.com/jedisct1/minisign
20-
wget -q "https://github.com/jedisct1/minisign/releases/download/0.11/minisign-0.11-linux.tar.gz"
21-
tar -xzf minisign-0.11-linux.tar.gz
36+
wget -q "${MINISIGN_URL}" -O "minisign-linux.tar.gz"
37+
tar -xzf "minisign-linux.tar.gz"
2238
mv minisign-linux/x86_64/minisign /usr/local/bin
2339

2440
# zig: https://ziglang.org
@@ -29,6 +45,6 @@ ln -s "/opt/zig-linux-x86_64-${ZIG_VERSION}/zig" /usr/local/bin/zig
2945
# cleanup
3046
rm -r \
3147
"appimagetool-x86_64.AppImage" \
32-
"minisign-0.11-linux.tar.gz" \
48+
"minisign-linux.tar.gz" \
3349
"minisign-linux" \
3450
"zig-linux-x86_64-${ZIG_VERSION}.tar.xz"

0 commit comments

Comments
 (0)