Skip to main content
Config-Sway includes several utility scripts to automate common tasks and enhance your Sway experience. These scripts are located in ~/.config/scripts/ and handle autostarting applications, layout management, and wallpaper configuration.

Available Scripts

autostart.sh

Automatically launches applications in specific workspaces when Sway starts. Location: ~/.config/scripts/autostart.sh

Features

  • Launches Firefox in workspace 1
  • Opens VSCode in workspace 2
  • Starts Kitty terminal in workspace 3
  • Includes error handling and notifications

Usage

Add to your Sway config to run on startup:

How It Works

1

Delay Startup

Waits 2 seconds for Sway to fully initialize
2

Check Dependencies

Verifies swaymsg is available
3

Launch Applications

Opens each application in its designated workspace with 1-second delays between launches

mode-hacker.sh

Creates a “hacker” layout with a terminal, clock, and audio visualizer. Location: ~/.config/scripts/mode-hacker.sh

Features

  • Creates a three-pane layout
  • Left pane: Full-height Kitty terminal
  • Right top: TTY-clock display
  • Right bottom: Cava audio visualizer

Usage

Bind to a keyboard shortcut in your Sway config:

Layout Description

Customization

You can modify the clock appearance by changing the tty-clock parameters:
  • -c: Center the clock
  • -C 4: Set color (0-7 for different colors)
  • -t: Display time only (no date)
  • -D: Display date only (no time)

setwallpaper.sh

Sets or restores the wallpaper using swaybg. Location: ~/.config/scripts/setwallpaper.sh

Features

  • Reads wallpaper path from config file
  • Falls back to default wallpaper if not found
  • Uses solid color as last resort
  • Automatically kills existing swaybg process

Usage

Run manually or add to Sway config:

How It Works

1

Read Config

Reads wallpaper path from ~/.config/sway/wallpaper
2

Check File

Verifies the wallpaper file exists
3

Apply Wallpaper

Kills existing swaybg and launches with new wallpaper
4

Fallback

Uses default wallpaper or solid color if configured wallpaper not found

Wallpaper Modes

swaybg supports several scaling modes:
  • fill: Scale to fill the screen (default)
  • fit: Scale to fit within screen
  • stretch: Stretch to fill screen
  • center: Center image without scaling
  • tile: Tile image across screen
Modify the script to use a different mode:

Integration with Sway Config

Add all scripts to your ~/.config/sway/config:

Troubleshooting

Script Not Executing

Ensure scripts have execute permissions:

Applications Not Launching

Check if the applications are installed:

Wallpaper Not Loading

Verify swaybg is installed:
Check the wallpaper path:

Creating Custom Scripts

You can create your own scripts following the same patterns:
Always use error handling and notifications to help debug issues.