Switch to Ghostty as the default terminal

This commit is contained in:
David Heinemeier Hansson
2025-11-10 10:54:41 +01:00
parent bf3a5b0a36
commit b6ba588fa3
5 changed files with 38 additions and 41 deletions

View File

@@ -1,21 +0,0 @@
[Desktop Entry]
Type=Application
TryExec=alacritty
Exec=alacritty
Icon=Alacritty
Terminal=false
Categories=System;TerminalEmulator;
Name=Alacritty
GenericName=Terminal
Comment=A fast, cross-platform, OpenGL terminal emulator
StartupNotify=true
StartupWMClass=Alacritty
Actions=New;
X-TerminalArgExec=-e
X-TerminalArgAppId=--class=
X-TerminalArgTitle=--title=
X-TerminalArgDir=--working-directory=
[Desktop Action New]
Name=New Terminal
Exec=alacritty

View File

@@ -9,31 +9,43 @@ package="$1"
# Map package name to desktop entry ID
case "$package" in
alacritty)
desktop_id="Alacritty.desktop"
;;
ghostty)
desktop_id="com.mitchellh.ghostty.desktop"
;;
kitty)
desktop_id="kitty.desktop"
;;
*)
echo "Unknown terminal: $package"
exit 1
;;
alacritty) desktop_id="Alacritty.desktop" ;;
ghostty) desktop_id="com.mitchellh.ghostty.desktop" ;;
kitty) desktop_id="kitty.desktop" ;;
*)
echo "Unknown terminal: $package"
exit 1
;;
esac
# Install package
if omarchy-pkg-add $package; then
# Set as default terminal
echo "Setting $package as new default terminal..."
sed -i "/export TERMINAL=/ c\export TERMINAL=$package" ~/.config/uwsm/default
# Copy custom desktop entry for alacritty with X-TerminalArg* keys
if [ "$package" = "alacritty" ]; then
if [[ $package == "alacritty" ]]; then
mkdir -p ~/.local/share/applications
cp "$OMARCHY_PATH/applications/Alacritty.desktop" ~/.local/share/applications/
cat > ~/.local/share/applications/Alacritty.desktop << EOF
[Desktop Entry]
Type=Application
TryExec=alacritty
Exec=alacritty
Icon=Alacritty
Terminal=false
Categories=System;TerminalEmulator;
Name=Alacritty
GenericName=Terminal
Comment=A fast, cross-platform, OpenGL terminal emulator
StartupNotify=true
StartupWMClass=Alacritty
Actions=New;
X-TerminalArgExec=-e
X-TerminalArgAppId=--class=
X-TerminalArgTitle=--title=
X-TerminalArgDir=--working-directory=
[Desktop Action New]
Name=New Terminal
Exec=alacritty
EOF
fi
# Update xdg-terminals.list to prioritize the proper terminal

View File

@@ -0,0 +1,3 @@
# Terminal emulator preference order for xdg-terminal-exec
# The first found and valid terminal will be used
com.mitchellh.ghostty.desktop

View File

@@ -4,7 +4,6 @@
1password-beta
1password-cli
aether
alacritty
asdcontrol
avahi
bash-completion
@@ -32,6 +31,7 @@ fd
ffmpegthumbnailer
fontconfig
fzf
ghostty
github-cli
gnome-calculator
gnome-keyring

3
migrations/1762768186.sh Normal file
View File

@@ -0,0 +1,3 @@
echo "Ensure config/uwsm/default uses generic terminal exec"
sed -i 's/export TERMINAL=.*/export TERMINAL=xdg-terminal-exec/' ~/.config/uwsm/default