# Danielfm Workstation Sway Role

This role installs and configures the Sway Wayland compositor and related utilities for workstations. It provides:

- Sway window manager (i3-compatible Wayland compositor)
- Status bar, notifications, and system utilities
- Application launchers and terminal emulators
- Screenshot and screen management tools
- Theme customization and fonts

## Requirements

- A Debian 13 (Trixie) or Fedora 42+ Linux system
- Root privileges for package installation
- Wayland-compatible graphics drivers

## Role Variables

Available variables are listed below, along with default values.

**Sway theme configuration:**
```yaml
sway_theme_name: catppuccin-mocha
```

Specifies which theme to use for Sway. The theme is selected by creating a symlink from `~/.config/themes/current` to `~/.config/themes/<theme_name>`. Theme directories should exist in `~/.config/themes/`.

**GTK theme configuration:**
```yaml
sway_gtk_theme: Yaru-blue
sway_cursor_theme: Adwaita
sway_cursor_size: 24
sway_icon_theme: Yaru-blue-dark
sway_color_scheme: prefer-dark
```

Configures GTK application appearance using gsettings. These settings are applied automatically when Sway starts:
- `sway_gtk_theme`: GTK theme name for application styling
- `sway_cursor_theme`: Cursor theme name
- `sway_cursor_size`: Cursor size
- `sway_icon_theme`: Icon theme name
- `sway_color_scheme`: Default color scheme preference (prefer-dark, prefer-light, or default)

**Switching Color Schemes:**

The `sway-configure-gtk` script is installed to `~/.local/bin/` and can be used to dynamically switch between color schemes:

```bash
# Switch to dark theme
sway-configure-gtk prefer-dark

# Switch to light theme
sway-configure-gtk prefer-light

# Use system default
sway-configure-gtk default

# Use configured default
sway-configure-gtk
```

This allows you to quickly toggle between dark and light themes without reconfiguring the entire system.

The script automatically adjusts the icon theme based on the selected color scheme:
- When switching to `prefer-dark`, the script adds a `-dark` suffix to the icon theme name (e.g., `Yaru-blue` becomes `Yaru-blue-dark`)
- When switching to `prefer-light` or `default`, the script removes the `-dark` suffix from the icon theme name (e.g., `Yaru-blue-dark` becomes `Yaru-blue`)
- The suffix is not duplicated if it already exists

## Dependencies

None.

## Example Playbook

```yaml
- hosts: localhost
  connection: local
  roles:
    - danielfm.workstation.sway
```

## What This Role Configures

**Core Window Manager:**
- Sway (i3-compatible Wayland compositor)
- Swaylock (screen locker)
- Swayidle (idle management daemon)
- Swaybg (wallpaper utility)

**Desktop Components:**
- Waybar (status bar)
- Mako (notification daemon)
- Mate Polkit (authentication agent)

**Application Launchers:**
- Rofi (application launcher)
- Bemenu (dynamic menu)

**Terminal:**
- Foot (fast, lightweight Wayland terminal)

**Utilities:**
- Grimshot (screenshot utility)
- Swappy (screenshot editor)
- Brightnessctl (backlight control)
- Fastfetch (system information tool)
- Nwg-look (GTK theme switcher)
- Nwg-displays (display configuration)
- Xarchiver (archive manager)

**Wayland Support:**
- XDG Desktop Portal for wlroots
- XDG Terminal Exec
- Qt5 Wayland integration

**Appearance:**
- Sway wallpapers/backgrounds
- Papirus icon theme
- Roboto and Noto fonts

**Platform Support:**
- Debian 13 (Trixie): Uses apt package manager
- Fedora 42+: Uses dnf package manager with Wayland-specific packages

## Important Notes

- This role installs packages system-wide and requires root privileges
- Package names are adapted for each distribution
- Debian uses `sway-backgrounds` while Fedora uses `sway-wallpapers`
- Debian uses `mako-notifier` while Fedora uses `mako`
- Fedora uses `rofi-wayland` instead of `rofi` for native Wayland support
- All installed packages follow the naming conventions of their respective distributions
- Sway requires a Wayland-compatible graphics stack to function properly

## License

MIT

## Author Information

This role was created by Daniel Martins.
