Files
arthur-os/bin/omarchy-default-terminal
T
David Heinemeier HanssonandGitHub 95d8125e59 Set default terminal, browser, editor explicitly (#5651)
* Set default terminal, browser, editor explicitly

* Consistent glyphs and setup

* Tweaks

* Always there

* Proper order

* Don't make a browser the default just because it's getting installed
2026-05-07 16:11:48 +02:00

37 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Set the default terminal used by xdg-terminal-exec
# omarchy:args=[alacritty|foot|ghostty|kitty]
# omarchy:examples=omarchy default terminal ghostty | omarchy default terminal kitty
if (($# == 0)); then
desktop_id=$(grep -vE '^($|#)' ~/.config/xdg-terminals.list 2>/dev/null | head -n 1)
case "$desktop_id" in
Alacritty.desktop) echo "alacritty" ;;
foot.desktop) echo "foot" ;;
com.mitchellh.ghostty.desktop) echo "ghostty" ;;
kitty.desktop) echo "kitty" ;;
*) echo "$desktop_id" ;;
esac
exit 0
fi
case "$1" in
alacritty) desktop_id="Alacritty.desktop"; name="Alacritty"; glyph="" ;;
foot) desktop_id="foot.desktop"; name="Foot"; glyph="" ;;
ghostty) desktop_id="com.mitchellh.ghostty.desktop"; name="Ghostty"; glyph="" ;;
kitty) desktop_id="kitty.desktop"; name="Kitty"; glyph="" ;;
*)
echo "Usage: omarchy-default-terminal <alacritty|foot|ghostty|kitty>"
exit 1
;;
esac
cat >~/.config/xdg-terminals.list <<EOF
# Terminal emulator preference order for xdg-terminal-exec
# The first found and valid terminal will be used
$desktop_id
EOF
notify-send -u low "$glyph $name is now the default terminal"