nix/bin/open-mail

30 lines
911 B
Bash
Executable file

#!/bin/bash
# Open neomutt in Ghostty, or focus existing window
if [[ "$(uname)" == "Darwin" ]]; then
if aerospace list-windows --all | grep -q 'Mail.*Ghostty\|Ghostty.*Mail'; then
aerospace workspace 8
else
open -ga Ghostty
sleep 0.2
aerospace workspace 8
open -na Ghostty --args --title="Mail" -e ~/dotfiles/bin/path-shim neomutt
fi
else
# Linux (i3/sway)
if command -v swaymsg &>/dev/null; then
if swaymsg -t get_tree | grep -q '"name": "Mail"'; then
swaymsg workspace 8
else
swaymsg workspace 8
ghostty --title="Mail" -e neomutt &
fi
elif command -v i3-msg &>/dev/null; then
if i3-msg -t get_tree | grep -q '"name": "Mail"'; then
i3-msg workspace 8
else
i3-msg workspace 8
ghostty --title="Mail" -e neomutt &
fi
fi
fi