Skip to main content
Config-Sway includes several Rofi-based menu scripts that provide a beautiful, user-friendly interface for common tasks. These scripts are located in ~/.config/rofi/scripts/ and integrate seamlessly with the Sway window manager.

Available Menus

selector-app.sh

Application launcher with icon support. Location: ~/.config/rofi/scripts/selector-app.sh

Features

  • Displays installed applications with icons
  • Searches applications by name
  • Custom theme with background image
  • Fast application launching

Usage

Bind to a keyboard shortcut in Sway config:
bindsym $mod+d exec ~/.config/rofi/scripts/selector-app.sh
#!/usr/bin/env bash
set -euo pipefail

CORE_THEME="$HOME/.config/rofi/styles/_core/selector-app.rasi"
IMG="$HOME/.config/rofi/images/arch-linux.png"

if [ -f "$IMG" ]; then
  rofi -show drun -show-icons -theme "$CORE_THEME" \
    -theme-str "imagebox { background-image: url(\"$IMG\", height); }"
else
  rofi -show drun -show-icons -theme "$CORE_THEME"
fi

power-menu.sh

Power management menu for system operations. Location: ~/.config/rofi/scripts/power-menu.sh

Features

  • Shutdown, reboot, suspend, lock, and logout options
  • Shows last login time and system uptime
  • Custom background image
  • Safe with confirmation dialogs

Usage

bindsym $mod+Shift+e exec ~/.config/rofi/scripts/power-menu.sh
  • Shutdown (systemctl poweroff) - Power off the system
  • Reboot (systemctl reboot) - Restart the system
  • Suspend (systemctl suspend) - Suspend to RAM
  • Lock (swaylock) - Lock the screen
  • Logout (swaymsg exit) - Exit Sway session
  • Cancel - Close the menu
#!/usr/bin/env bash
set -euo pipefail

theme="$HOME/.config/rofi/styles/_core/power-menu.rasi"
bg="$HOME/.config/rofi/images/arch-linux-2.webp"

# Get system info
lastlogin="$(last "$USER" 2>/dev/null | head -n1 | tr -s ' ' | cut -d' ' -f5,6,7)"
uptime="$(uptime -p 2>/dev/null | sed -e 's/^up //g')"
host="$(hostname || uname -n)"

# Menu icons
apagar=' '
reiniciar='󰦛 '
bloquear='󱅞'
suspender='󰽥'
cerrar_seccion='󰍂 '
cancelar=' '

# Display menu
chosen="$(echo -e "$cancelar\n$apagar\n$reiniciar\n$suspender\n$cerrar_seccion\n$bloquear" | \
  rofi -dmenu -p "$USER@$host" \
  -mesg " Desde: $lastlogin, Tiempo encendido: $uptime" \
  -theme "$theme")"

# Execute choice
case "$chosen" in
  "$apagar") systemctl poweroff ;;
  "$reiniciar") systemctl reboot ;;
  "$bloquear") swaylock -f ;;
  "$suspender")
    mpc -q pause 2>/dev/null || true
    amixer set Master mute 2>/dev/null || true
    systemctl suspend
    ;;
  "$cerrar_seccion") swaymsg exit ;;
  *) exit 0 ;;
esac
The power menu requires systemctl, swaylock, and optionally mpc and amixer for full functionality.

Emoji and icon picker. Location: ~/.config/rofi/scripts/menu-iconos.sh

Features

  • 1200+ emojis organized by category
  • Searchable by name (in Spanish)
  • Copies emoji to clipboard
  • Auto-types emoji at cursor position
  • Works with Wayland via wl-copy and wtype

Usage

bindsym $mod+period exec ~/.config/rofi/scripts/menu-iconos.sh

Categories

  • Faces and expressions
  • Hand gestures
  • People and body parts
  • Animals and nature
  • Food and drink
  • Activities and sports
  • Travel and places
  • Objects and symbols
  • Flags
# Open emoji picker
~/.config/rofi/scripts/menu-iconos.sh

# Type to search: "feliz" -> shows 😀 😁 😃 😄 etc.
# Select emoji -> automatically typed and copied

theme-switcher.sh

System-wide theme switcher. Location: ~/.config/rofi/scripts/theme-switcher.sh

Features

  • Switches themes for Kitty, Waybar, Rofi, and Sway
  • Visual preview of themes with wallpaper thumbnails
  • Automatic configuration backup
  • Applies wallpaper with swaybg
  • Restarts Waybar and reloads Sway

Usage

bindsym $mod+t exec ~/.config/rofi/scripts/theme-switcher.sh

Theme Structure

Themes are stored in ~/.config/themes/ with this structure:
~/.config/themes/
├── theme-name/
│   ├── kitty/
│   │   └── current-theme.conf
│   ├── waybar/
│   │   ├── colors.css
│   │   ├── style.css
│   │   └── config.jsonc
│   ├── sway/
│   │   └── theme.conf
│   ├── rofi-style/
│   │   └── _core/
│   │       └── palette.rasi
│   └── wallpaper.jpg|png|webp
1

Browse Themes

The script scans ~/.config/themes/ for available themes and displays them with wallpaper previews
2

Select Theme

Choose a theme from the Rofi menu
3

Backup Configs

Automatically backs up your current configuration with timestamp
4

Apply Theme

Copies theme files to active config directories and applies changes
5

Reload

Restarts Waybar and reloads Sway to apply the new theme
#!/usr/bin/env bash
# 1. Scan themes directory
# 2. Show themes with wallpaper preview
# 3. User selects theme
# 4. Backup current configs
# 5. Copy kitty, waybar, sway, rofi configs
# 6. Apply wallpaper with swaybg
# 7. Restart waybar
# 8. Reload sway
The script automatically converts Waybar configs from Hyprland to Sway format by replacing module names.

wallpaper-switcher.sh

Wallpaper browser and switcher. Location: ~/.config/rofi/scripts/wallpaper-switcher.sh

Features

  • Visual wallpaper browser with thumbnails
  • Searches wallpapers in ~/.config/wallpapers/
  • Applies wallpaper instantly with swaybg
  • Saves wallpaper choice for persistence
  • Notification with preview

Usage

bindsym $mod+w exec ~/.config/rofi/scripts/wallpaper-switcher.sh
#!/usr/bin/env bash
set -euo pipefail

FONDOS_DIR="$HOME/.config/wallpapers"
THEME_PATH="$HOME/.config/rofi/styles/_core/wallpaper-switcher.rasi"
SWAY_WALL_FILE="$HOME/.config/sway/wallpaper"

# Find wallpapers
for img in "$FONDOS_DIR"/*; do
  name="$(basename "$img")"
  printf '%s\0icon\x1f%s\n' "$name" "$img"
done | rofi -i -dmenu -show-icons -p "> " -theme "$THEME_PATH"

# Apply selected wallpaper
WALL="$FONDOS_DIR/$FONDO"
echo "$WALL" > "$SWAY_WALL_FILE"
killall swaybg 2>/dev/null || true
swaybg -i "$WALL" -m fill >/dev/null 2>&1 &

Configuration

Rofi Theme Customization

All Rofi menus use themes from ~/.config/rofi/styles/_core/:
  • selector-app.rasi - Application launcher theme
  • power-menu.rasi - Power menu theme
  • menu-iconos.rasi - Emoji picker theme
  • theme-switcher.rasi - Theme browser theme
  • wallpaper-switcher.rasi - Wallpaper browser theme
  • palette.rasi - Color palette (auto-generated or custom)
Edit these files to customize appearance:
/* ~/.config/rofi/styles/_core/palette.rasi */
* {
    font: "JetBrains Mono Nerd Font 12";
    background: #1e1e2e;
    foreground: #89b3fa;
    selected: #89b3fa;
}

Sway Keybindings

Recommended keybindings for ~/.config/sway/config:
# Rofi menus
bindsym $mod+d exec ~/.config/rofi/scripts/selector-app.sh
bindsym $mod+Shift+e exec ~/.config/rofi/scripts/power-menu.sh
bindsym $mod+period exec ~/.config/rofi/scripts/menu-iconos.sh
bindsym $mod+t exec ~/.config/rofi/scripts/theme-switcher.sh
bindsym $mod+w exec ~/.config/rofi/scripts/wallpaper-switcher.sh

Troubleshooting

Rofi Not Launching

Verify Rofi is installed:
which rofi
rofi -version

Icons Not Showing

Ensure an icon theme is installed:
# Install icon theme (Arch)
sudo pacman -S papirus-icon-theme

# Update icon cache
gtk-update-icon-cache

Wallpaper Not Applying

Check swaybg is running:
ps aux | grep swaybg
Verify wallpaper path:
cat ~/.config/sway/wallpaper

Theme Switcher Errors

Ensure theme directory exists:
ls -la ~/.config/themes/
Check for required files in theme:
find ~/.config/themes/your-theme -type f

Emoji Picker Not Working

Install Wayland clipboard tools:
# Arch
sudo pacman -S wl-clipboard wtype

# Debian/Ubuntu  
sudo apt install wl-clipboard wtype

Creating Custom Rofi Scripts

You can create your own Rofi menus following this template:
#!/usr/bin/env bash
set -euo pipefail

# Define options
OPTIONS="Option 1\nOption 2\nOption 3"

# Show menu
CHOSEN="$(echo -e "$OPTIONS" | rofi -dmenu -p "Select:" -theme ~/.config/rofi/styles/_core/your-theme.rasi)"

# Handle selection
case "$CHOSEN" in
  "Option 1") 
    # Your action here
    ;;
  "Option 2")
    # Your action here
    ;;
  *)
    exit 0
    ;;
esac
For more Rofi customization options, see the Rofi documentation.

Integration with Other Tools

The Rofi scripts integrate with:
  • Sway - Window manager control
  • Waybar - Status bar theming
  • Kitty - Terminal theming
  • swaybg - Wallpaper management
  • swaylock - Screen locking
  • systemctl - System power management
  • wl-clipboard - Wayland clipboard
  • wtype - Text input simulation
Ensure these tools are installed for full functionality.

Build docs developers (and LLMs) love