dotfiles/root/usr/local/bin/sway-dbus.sh
jay 45e1e6f235 feat(config): add ghostty terminal and refactor neovim configuration
- Add ghostty terminal configuration with custom themes and settings
- Add multiple color themes (ayu-dark, catppuccin variants, moonfly)
- Configure ghostty appearance: font, opacity, keybindings
- Refactor nvim basic setup to use modern vim.opt API
- Modernize LSP configuration with LspAttach autocmd
- Update nvim-tree configuration for latest API
- Simplify codecompanion plugin setup
- Pin nvim-treesitter to main branch
- Improve sway-dbus script with XDG runtime checks
2026-05-12 11:14:13 +08:00

40 lines
972 B
Bash
Executable File

#!/usr/bin/env sh
set -eu
export XDG_CURRENT_DESKTOP=sway # xdg-desktop-portal
export XDG_SESSION_DESKTOP=sway # systemd
export XDG_SESSION_TYPE=wayland # xdg/systemd
if [ -d "$HOME/.config/environment.d" ]; then
for f in "$HOME"/.config/environment.d/*.conf; do
[ -f "$f" ] || continue
while IFS= read -r line || [ -n "$line" ]; do
# Skip empty lines and comments
case "$line" in
'' | '#'*) continue ;;
esac
# Export the variable
export "$line"
done <"$f"
done
fi
max_attempts=50
attempt=0
while [ ! -d "/run/user/$(id -u)" ]; do
if [ "$attempt" -ge "$max_attempts" ]; then
echo "Error: XDG_RUNTIME_DIR not available after $max_attempts attempts" >&2
exit 1
fi
sleep 0.2
attempt=$((attempt + 1))
done
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
dbus-run-session sway "$@"
# this teardown makes it easier to switch between compositors
unset DISPLAY SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE