3 changed files with 128 additions and 10 deletions
@ -0,0 +1,113 @@ |
|||||||
|
#!/bin/env bash |
||||||
|
#---------------------------------------------------------------- |
||||||
|
# init-sway.sh — Install everything needed to run the sway config |
||||||
|
# from ~/.config/sway on Ubuntu 26.04 (resolute). |
||||||
|
# |
||||||
|
# Covers: compositor stack, bar/launcher/notifications, screenshot, |
||||||
|
# clipboard, color temperature, audio (PipeWire), portals, fonts, |
||||||
|
# wallpaper, helper-script dependencies, plus the applications |
||||||
|
# referenced by keybindings and workspace assignments. |
||||||
|
#---------------------------------------------------------------- |
||||||
|
set -euo pipefail |
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" |
||||||
|
|
||||||
|
echo "[1/8] Updating apt..." |
||||||
|
sudo apt update -y |
||||||
|
|
||||||
|
echo "[2/8] Installing sway core stack and helper-script dependencies..." |
||||||
|
sudo apt install -y \ |
||||||
|
sway \ |
||||||
|
swayidle \ |
||||||
|
swaylock \ |
||||||
|
swaybg \ |
||||||
|
waybar \ |
||||||
|
mako-notifier \ |
||||||
|
fuzzel \ |
||||||
|
wofi \ |
||||||
|
kitty \ |
||||||
|
grim \ |
||||||
|
slurp \ |
||||||
|
wl-clipboard \ |
||||||
|
cliphist \ |
||||||
|
brightnessctl \ |
||||||
|
gammastep \ |
||||||
|
playerctl \ |
||||||
|
translate-shell \ |
||||||
|
libnotify-bin \ |
||||||
|
jq \ |
||||||
|
osmo \ |
||||||
|
network-manager-applet \ |
||||||
|
policykit-1-gnome \ |
||||||
|
xdg-desktop-portal \ |
||||||
|
xdg-desktop-portal-wlr \ |
||||||
|
xdg-desktop-portal-gtk \ |
||||||
|
dbus-user-session \ |
||||||
|
fontconfig \ |
||||||
|
fonts-noto-core |
||||||
|
|
||||||
|
# Qt/Java apps referenced in window assignments run via XWayland by default; |
||||||
|
# qt6-wayland makes Qt apps native Wayland clients. Optional. |
||||||
|
sudo apt install -y qt6-wayland || true |
||||||
|
|
||||||
|
echo "[3/8] Installing PipeWire audio stack (volctl uses wpctl)..." |
||||||
|
sudo apt install -y pipewire-audio pipewire-pulse wireplumber |
||||||
|
|
||||||
|
echo "[4/8] Installing applications referenced by keybindings/workspace assignments..." |
||||||
|
# firefox/thunderbird on Ubuntu 24.04+ are snap-transitioning deb packages, |
||||||
|
# but they still work; missing ones here must not abort the script. |
||||||
|
sudo apt install -y \ |
||||||
|
firefox \ |
||||||
|
thunar \ |
||||||
|
thunderbird \ |
||||||
|
telegram-desktop \ |
||||||
|
mpv \ |
||||||
|
virt-manager \ |
||||||
|
|| true |
||||||
|
|
||||||
|
if command -v snap >/dev/null 2>&1; then |
||||||
|
sudo snap install spotify || true |
||||||
|
fi |
||||||
|
|
||||||
|
echo "[5/8] Installing Sway wallpaper (not shipped in Ubuntu's sway package)..." |
||||||
|
sudo mkdir -p /usr/share/backgrounds/sway |
||||||
|
sudo curl -fL -o /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png \ |
||||||
|
https://raw.githubusercontent.com/swaywm/sway/master/assets/Sway_Wallpaper_Blue_1920x1080.png |
||||||
|
|
||||||
|
echo "[6/8] Installing Source Sans 3 font (not packaged in Ubuntu)..." |
||||||
|
mkdir -p "$HOME/.local/share/fonts/SourceSans3" |
||||||
|
if curl -fL -o /tmp/SourceSans3.zip \ |
||||||
|
https://github.com/adobe-fonts/source-sans/releases/download/3.052R/SourceSans3_FontsOnly.zip; then |
||||||
|
unzip -o -q /tmp/SourceSans3.zip -d "$HOME/.local/share/fonts/SourceSans3" |
||||||
|
rm -f /tmp/SourceSans3.zip |
||||||
|
else |
||||||
|
# Fallback: variable font from the Google Fonts repository |
||||||
|
curl -fL -o "$HOME/.local/share/fonts/SourceSans3/SourceSans3[wght].ttf" \ |
||||||
|
"https://github.com/google/fonts/raw/main/ofl/sourcesans3/SourceSans3%5Bwght%5D.ttf" || \ |
||||||
|
echo " -> WARNING: failed to download Source Sans 3; sway bar will fall back to another font" |
||||||
|
fi |
||||||
|
fc-cache -f >/dev/null 2>&1 |
||||||
|
|
||||||
|
echo "[7/8] Enabling services and device group membership..." |
||||||
|
# Audio (socket-activated user services; enabling is idempotent) |
||||||
|
systemctl --user enable --now pipewire pipewire-pulse wireplumber 2>/dev/null || true |
||||||
|
# NetworkManager (already default on desktop installs; needed by nm-applet) |
||||||
|
sudo systemctl enable --now NetworkManager 2>/dev/null || true |
||||||
|
# Device access for sway started from a TTY / display manager |
||||||
|
sudo usermod -aG video,input,render "$USER" 2>/dev/null || true |
||||||
|
|
||||||
|
echo "[8/8] Installing swayr window switcher (Alt+Tab, cargo-based)..." |
||||||
|
if command -v cargo >/dev/null 2>&1; then |
||||||
|
cargo install swayr || echo " -> WARNING: cargo install swayr failed" |
||||||
|
else |
||||||
|
echo " -> cargo not found. Run init-cargo-tools.sh first, then: cargo install swayr" |
||||||
|
fi |
||||||
|
|
||||||
|
cat <<'EOF' |
||||||
|
|
||||||
|
Done. Next steps: |
||||||
|
1. Log out and back in (group membership takes effect on new login). |
||||||
|
2. Start sway: pick "Sway" in the login manager, or run `sway` from a TTY. |
||||||
|
3. Verify audio with `wpctl status` and notifications with `notify-send test`. |
||||||
|
|
||||||
|
EOF |
||||||
Loading…
Reference in new issue