Rofi Menus and Scripts
Rofi provides all the interactive menus in Config-Sway, from application launching to theme switching. All menus are styled consistently and integrated with the theme system.
Directory Structure
~/.config/rofi/
├── scripts/ # Executable menu scripts
│ ├── selector-app.sh
│ ├── power-menu.sh
│ ├── theme-switcher.sh
│ ├── wallpaper-switcher.sh
│ └── menu-iconos.sh
├── styles/ # Theme-specific styling
│ ├── _core/ # Core theme files
│ │ ├── palette.rasi # Color definitions
│ │ ├── selector-app.rasi
│ │ ├── power-menu.rasi
│ │ ├── theme-switcher.rasi
│ │ └── wallpaper-switcher.rasi
│ ├── selector-app.rasi
│ ├── power-menu.rasi
│ ├── theme-switcher.rasi
│ └── wallpaper-switcher.rasi
└── images/ # Icons and backgrounds
├── arch-linux.png
└── arch-linux-2.webp
Rofi Scripts
Application Selector (Super + D)
Script: selector-app.sh ~/.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
Features:
Shows all desktop applications (.desktop files)
Displays application icons
Background image overlay (if available)
Fuzzy search enabled
Keybinding: Super + DType partial application names to quickly filter. For example, “fire” will show Firefox.
Theme Switcher (Super + A)
Script: theme-switcher.sh The theme switcher is the most complex script, handling theme application across all components. ~/.config/rofi/scripts/theme-switcher.sh
TEMAS_DIR = " $HOME /.config/themes"
ROFI_THEME = " $HOME /.config/rofi/styles/_core/theme-switcher.rasi"
What it does:
Lists available themes from ~/.config/themes/
Shows theme previews using wallpaper images as icons
Applies selected theme to:
Kitty terminal colors
Waybar colors and styles
Sway window decorations
Rofi color palette
System wallpaper
Reloads all components automatically
Theme Detection: for theme_dir in " $TEMAS_DIR "/* ; do
[ -d " $theme_dir " ] || continue
theme_name = "$( basename " $theme_dir ")"
preview = ""
for ext in jpg png webp ; do
if [ -f " $theme_dir /wallpaper. $ext " ]; then
preview = " $theme_dir /wallpaper. $ext "
break
fi
done
printf '%s\0icon\x1f%s\n' " $theme_name " " $preview " >> " $OPCIONES "
done
Component Updates: # Kitty
if [ -d " $ELEGIDO /kitty" ]; then
backup_dir " $HOME /.config/kitty"
copy_dir_contents " $ELEGIDO /kitty" " $HOME /.config/kitty"
fi
# Waybar (adapted for Sway)
if [ -f " $ELEGIDO /waybar/config.jsonc" ]; then
sed \
-e 's#hyprland/workspaces#sway/workspaces#g' \
-e 's#hyprland/window#sway/window#g' \
" $ELEGIDO /waybar/config.jsonc" > " $HOME /.config/waybar/config-sway.jsonc"
fi
# Sway theme
if [ -f " $ELEGIDO /sway/theme.conf" ]; then
cp -a " $ELEGIDO /sway/theme.conf" " $HOME /.config/sway/theme.conf"
fi
# Wallpaper
for ext in jpg png webp ; do
if [ -f " $ELEGIDO /wallpaper. $ext " ]; then
WALL = " $ELEGIDO /wallpaper. $ext "
break
fi
done
if [ -n " $WALL " ]; then
printf '%s\n' " $WALL " > " $SWAY_WALL_FILE "
killall swaybg 2> /dev/null || true
swaybg -i " $WALL " -m fill &
fi
# Reload components
killall waybar 2> /dev/null || true
waybar -c " $HOME /.config/waybar/config-sway.jsonc" & disown
swaymsg reload
Auto-generating Rofi Colors: If a theme doesn’t include a rofi palette, colors are extracted from Sway theme: bg = "$( awk '$1=="set" && $2=="$bg"{print $3; exit}' " $ELEGIDO /sway/theme.conf")"
fg = "$( awk '$1=="set" && $2=="$fg"{print $3; exit}' " $ELEGIDO /sway/theme.conf")"
active = "$( awk '$1=="set" && $2=="$active"{print $3; exit}' " $ELEGIDO /sway/theme.conf")"
cat > " $rofi_palette " << EOF
* {
font: "JetBrains Mono Nerd Font 14";
background: $bg ;
background-alt: $inactive ;
foreground: $fg ;
selected: $active ;
active: $active ;
urgent: $active ;
}
EOF
Keybinding: Super + AThe script creates .bak-<timestamp> backups before modifying configurations. Backups are stored alongside the original files.
Wallpaper Switcher (Super + W)
Similar to theme switcher, but only changes the wallpaper without modifying other theme components. Keybinding: Super + W
Rofi Styling
Color Palette
~/.config/rofi/styles/_core/palette.rasi
/* Paleta de colores (se actualiza al cambiar de tema) */
* {
background: #1e1e2e;
background-alt: #242438;
foreground: #89b3fa;
selected: #89b3fa;
active: #40392e;
urgent: #312b26;
}
This file is automatically updated by the theme switcher. All menu styles import this palette.
Each menu has two style files:
styles/_core/<menu>.rasi - Core layout and structure
styles/<menu>.rasi - Imports core + customizations
The _core/ directory contains the actual styling logic. Top-level .rasi files simply import from _core/ and can add overrides.
Available Themes
Config-Sway includes 6 pre-configured themes:
Theme Name Style Wallpaper Anime Catppuccin-inspired dark theme Anime artwork Batman Dark gray and black Batman logo Hacker Matrix-style green on black Hacker aesthetic Mode-Dark Pure dark mode Minimal dark Superman Red and blue accents Superman emblem Windows10 Windows-inspired Windows 10 default
Theme Structure
Each theme directory contains:
~/.config/themes/<ThemeName>/
├── kitty/
│ └── kitty.conf # Terminal colors
├── waybar/
│ ├── colors.css # Waybar color variables
│ ├── style.css # Waybar styling
│ └── config.jsonc # Waybar layout (optional)
├── sway/
│ └── theme.conf # Window borders, gaps, colors
├── rofi-style/
│ └── _core/
│ └── palette.rasi # Rofi colors (optional)
└── wallpaper.{jpg,png,webp}
Create your own theme by copying an existing theme directory and modifying the files. Make sure to include a wallpaper.jpg/png/webp file!
Basic Rofi Script Template
#!/usr/bin/env bash
set -euo pipefail
# Define theme
THEME = " $HOME /.config/rofi/styles/_core/your-menu.rasi"
# Create menu options
option1 = "Option 1"
option2 = "Option 2"
option3 = "Option 3"
# Display menu
chosen = "$( echo -e " $option1 \n $option2 \n $option3 " | rofi -dmenu -theme " $THEME ")"
# Handle selection
case " $chosen " in
" $option1 " )
# Action for option 1
;;
" $option2 " )
# Action for option 2
;;
" $option3 " )
# Action for option 3
;;
*)
exit 0
;;
esac
option1 = " Option 1" # Nerd Font icon
option2 = " Option 2"
option3 = " Option 3"
Using Images as Icons
printf '%s\0icon\x1f%s\n' "Item Name" "/path/to/icon.png"
Rofi Configuration Tips
Custom keybindings in Rofi
Edit ~/.config/rofi/config.rasi to add custom keybindings: configuration {
kb-mode-next: "Shift+Right,Control+Tab,Alt+l";
kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab,Alt+h";
kb-row-up: "Up,Control+k";
kb-row-down: "Down,Control+j";
}
In your menu’s .rasi file: window {
width: 600px;
height: 400px;
}
Or use percentages: window {
width: 50%;
height: 60%;
}
In palette.rasi or individual menu styles: * {
font: "JetBrains Mono Nerd Font 16";
}
Troubleshooting
Possible causes:
Missing Nerd Fonts
-show-icons flag not set
GTK icon theme not installed
Solution: sudo pacman -S nerd-fonts ttf-font-awesome
Ensure script uses: rofi -show drun -show-icons
Theme colors not applying
Verify palette.rasi exists:
cat ~/.config/rofi/styles/_core/palette.rasi
Check for syntax errors:
rofi -dump-config > /tmp/rofi-test.rasi
Manually update palette by running theme switcher again
Ensure script is executable:
chmod +x ~/.config/rofi/scripts/your-script.sh
Check for errors:
bash -x ~/.config/rofi/scripts/your-script.sh
Verify shebang is correct: #!/usr/bin/env bash
Sway Keybindings See all Rofi menu keybindings in Sway config
Theme System Understand how themes affect Rofi styling
Scripts Other utility scripts used by the system