SwayBG+ is a powerful, feature-rich background manager specifically designed for Sway window manager. It provides both GUI and CLI interfaces for managing backgrounds across multiple monitors with advanced positioning, scaling, and persistence features.
- Multiple Background Modes: Stretched, Fill, Fit, Center, Tile
- Visual Image Positioning: Drag and drop image positioning with real-time preview
- Corner Resize Controls: Visual resize handles for precise image scaling
- Multi-Monitor Support: Seamless background management across multiple displays
- Real-Time Preview: See exactly how your background will look before applying
- Visual Monitor Layout: Drag and drop monitor positioning
- Inline Editing: Double-click to edit resolution, position, and scale
- Real Resolution Detection: Automatically detects available resolutions for each monitor
- Live Configuration: Apply changes immediately or save to config file
- ๐ Screen Orientation Support: Full support for vertical monitors and rotated displays
- Transform Support: Normal, 90ยฐ, 180ยฐ, 270ยฐ rotations plus flipped variants
- Visual Indicators: GUI shows effective resolution and orientation status
- CLI Control: Set orientations via command line with
--orientation
flag - Smart Background Handling: Automatically adjusts backgrounds for rotated monitors
- Portrait Monitor Support: Perfect for vertical coding displays and reading monitors
- Automatic Persistence: Backgrounds survive reboots and sway restarts
- Startup Integration: Automatically adds restoration script to sway config
- Configuration Backup: Automatic backup of sway config before changes
- Smart Detection: Automatically detects and restores previous backgrounds
- Intuitive GUI: Clean, modern interface with visual controls
- Powerful CLI: Full command-line interface for automation and scripting
- Smart Workflows: Simplified button layout eliminates confusion
- Real-Time Feedback: Live status updates and error handling
# Clone the repository
git clone https://github.com/yourusername/swaybgplus.git
cd swaybgplus
# Install dependencies
pip install -r requirements.txt
# Install the package
python setup.py install
# Or install in development mode
pip install -e .
Required:
- Python 3.6+
- Sway window manager
- swaybg (background setter)
- python-pillow (image processing)
For GUI (optional):
- python-gobject
- gtk3
Arch Linux:
sudo pacman -S sway swaybg python python-pillow python-gobject gtk3
Ubuntu/Debian:
sudo apt install sway swaybg python3 python3-pil python3-gi python3-gi-cairo gir1.2-gtk-3.0
Fedora:
sudo dnf install sway swaybg python3 python3-pillow python3-gobject gtk3-devel
# Launch the graphical interface
python3 swaybgplus_gui.py
Workflow:
- Load Image โ Click "๐ Load Image" to select your background
- Position & Scale โ Drag image to move, drag corners to resize
- Choose Mode โ Select background mode (Stretched, Fill, Fit, Center, Tile)
- Save Configuration โ Click "๐พ Save" to save monitor configuration
- Reset if Needed โ Click "๐ Reset" to reset image position and scale
# Set stretched background across all monitors
python3 swaybgplus_cli.py image.jpg --mode stretched
# Set fitted background with custom positioning
python3 swaybgplus_cli.py image.jpg --mode fill --offset-x 100 --offset-y 50 --scale 1.2
# Set vertical orientation for a monitor
python3 swaybgplus_cli.py --orientation DP-1:90
# Set background with rotated monitors
python3 swaybgplus_cli.py wallpaper.jpg --mode stretched --orientation DP-1:90
# Multiple monitor orientations
python3 swaybgplus_cli.py --orientation DP-1:90 --orientation HDMI-A-1:270
# Restore saved background configuration
python3 swaybgplus_cli.py --restore
# List current outputs (now shows transforms)
python3 swaybgplus_cli.py --list-outputs
# Clean up old background files
python3 swaybgplus_cli.py --cleanup
Mode | Description | Use Case |
---|---|---|
Stretched | Single image stretched across all monitors | Panoramic wallpapers, unified desktop |
Fill | Image scaled to fill each monitor (may crop) | Photos, maintaining aspect ratio |
Fit | Image scaled to fit each monitor (may letterbox) | Logos, preserving full image |
Center | Image centered on each monitor at original size | Icons, small graphics |
Tile | Image repeated across each monitor | Patterns, textures |
Resolution dropdown is empty:
- Ensure monitor is connected and active
- Check
swaymsg -t get_outputs
for available modes
GUI won't start:
- Install GTK dependencies:
sudo pacman -S python-gobject gtk3
- Check Python version: requires Python 3.6+
# Check current outputs
swaymsg -t get_outputs
# List running swaybg processes
ps aux | grep swaybg
# Check saved configuration
cat ~/.config/sway/backgrounds/current_config.json
# Test CLI restore
python3 swaybgplus_cli.py --restore
- Python 3.6+
- Sway window manager
- swaybg (background setter)
- Python packages:
Pillow
(image processing)PyGObject
(GTK GUI)
- System packages:
gtk3
python-gobject
This project is licensed under the Ancillary License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
.. coming soon .. Please report bugs and feature requests through the GitHub issue tracker.
Transform | Description | Use Case |
---|---|---|
normal |
No rotation | Standard landscape monitors |
90 |
90ยฐ clockwise rotation | Portrait mode (vertical) |
180 |
180ยฐ rotation | Upside down |
270 |
270ยฐ clockwise rotation | Portrait mode (other direction) |
flipped |
Horizontal flip | Mirrored display |
flipped-90 |
90ยฐ rotation + horizontal flip | Portrait + mirrored |
flipped-180 |
180ยฐ rotation + horizontal flip | Upside down + mirrored |
flipped-270 |
270ยฐ rotation + horizontal flip | Portrait + mirrored (other way) |
The GUI includes a new Transform column in the output configuration table:
- Double-click the Transform column for any monitor
- Select from dropdown: normal, 90, 180, 270, etc.
- Apply changes to activate the new orientation
- Visual feedback shows effective resolution and orientation indicator
# Set a single monitor to portrait mode
swaybgplus_cli.py --orientation DP-1:90
# Set multiple monitor orientations
swaybgplus_cli.py --orientation DP-1:90 --orientation HDMI-A-1:180
# Combine with background setting
swaybgplus_cli.py wallpaper.jpg --mode stretched --orientation DP-1:90
# Orientation-only mode (no background change)
swaybgplus_cli.py --orientation DP-1:270
SwayBG+ intelligently handles screen orientations by:
- Calculating Effective Resolution: For 90ยฐ/270ยฐ rotations, width and height are swapped
- Adjusting Background Layouts: Background images are created using the effective dimensions
- Visual Preview: The GUI shows monitors with their actual rotated dimensions
- Sway Integration: Uses
swaymsg output
commands to apply transformations
# Step 1: Set monitor to portrait orientation
swaybgplus_cli.py --orientation DP-2:90
# Step 2: Apply background that works with the new layout
swaybgplus_cli.py wallpaper.jpg --mode stretched
# Alternative: Do both in one command
swaybgplus_cli.py wallpaper.jpg --mode stretched --orientation DP-2:90
SwayBG+ - Making multi-monitor background management simple and powerful! ๐จโจ