#!/bin/bash # # Designed for Fedora Workstation # # Installs and configures sway and related tools to provide a richer # "desktop environment" style session. Relies on systemd for running # services as much as possible. set -euo pipefail script_path="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" if [ ! "$(pwd)" = "$script_path" ]; then echo "expects to be run from the root sway-de directory" exit 1 fi if ! command -v dnf > /dev/null !! [ ! -f /etc/fedora-release ]; then echo "doesn't seem to be fedora workstation" exit 1 fi # give the option to skip installing packages since dnf can be slow skip_packages="" while [[ $# -gt 0 ]]; do case $1 in --skip-packages) skip_packages=1 shift ;; *) shift ;; esac done if [ -z "$skip_packages" ]; then # install rpmfusion if it's not already installed repos_installed=$(dnf --cacheonly repolist | tail -n+2 | cut -f1 -d' ' | grep -Exc 'rpmfusion-free|rpmfusion-nonfree') if [ "$repos_installed" -lt "2" ]; then sudo dnf install \ "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" \ "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" fi # install packages sudo dnf install \ sway waybar wob wofi foot lxpolkit mako cascadia-mono-pl-fonts \ udiskie libappindicator-gtk3 duplicity python3-b2sdk pass passmenu \ brightnessctl vlc unzip vim wget git zsh stow dnf-automatic fi # make sure stow is installed. # it should be at this point, so if it's not, die with a message # to re-run without skipping the package install step. STOWCMD="" if command -v stow > /dev/null; then STOWCMD="stow" fi if [ -z "$STOWCMD" ]; then echo "requires 'stow'. run without '--skip-packages' to install." exit 1 fi # use stow to install config files $STOWCMD \ --dir "$(pwd)" \ --target "$HOME" \ foot lxpolkit mako sway swaylock udiskie waybar wob wofi # enable new systemd units and start them if sway is running sway_active=$(systemctl --user is-active sway-session.target) for unit in lxpolkit.service mako.service udiskie.service wob.service wob.socket; do if [ "active" = "$sway_active" ]; then systemctl --user enable --now "$(basename "$unit")" else systemctl --user enable "$(basename "$unit")" fi done # enable dnf automatic updates sudo systemctl enable --now dnf-automatic-install.timer