Sway Integration
Raffi integrates seamlessly with the Sway window manager, allowing you to launch applications with a simple keybinding.
Configuration
Section titled “Configuration”The simplest binding lets Raffi spawn the selected command itself:
set $super Mod4bindsym $super+Space exec raffiIf you want Sway to be the parent process of the launched application (so it is owned by the
compositor rather than by Raffi), use print-only mode and hand the command to swaymsg:
set $menu raffi -pset $super Mod4bindsym $super+Space exec cmd=$($menu) && [ -n "$cmd" ] && swaymsg exec -- "$cmd"How It Works
Section titled “How It Works”raffi -pruns Raffi in print-only mode, which prints the selected command instead of executing itcmd=$(...)captures that output; Sway runs the whole binding throughsh -c[ -n "$cmd" ]skipsswaymsgwhen nothing was selected — without this guardswaymsgis called with no command and fails (see Troubleshooting)swaymsg exec -- "$cmd"passes the command as a single quoted argument, which preserves arguments containing spaces as well as multi-linescriptentries$super+Spacebinds the launcher to Super (Windows/Command key) + Space
Customization
Section titled “Customization”Using a Different Keybinding
Section titled “Using a Different Keybinding”You can change the keybinding to any combination you prefer:
# Use Super+D insteadbindsym $super+d exec cmd=$($menu) && [ -n "$cmd" ] && swaymsg exec -- "$cmd"
# Use Alt+Spacebindsym Mod1+Space exec cmd=$($menu) && [ -n "$cmd" ] && swaymsg exec -- "$cmd"Additional Raffi Options
Section titled “Additional Raffi Options”You can pass additional flags to Raffi in the $menu variable:
# Disable icons for faster startupset $menu raffi -p -I
# Use a custom config fileset $menu raffi -p -c ~/.config/raffi/custom.yaml
# Use the native UI instead of Fuzzelset $menu raffi -p -u nativeTesting
Section titled “Testing”After adding the configuration:
- Reload your Sway config:
swaymsg reload - Press
Super+Spaceto launch Raffi - Select an application and press Enter to launch it
Troubleshooting
Section titled “Troubleshooting”Launcher doesn’t appear
Section titled “Launcher doesn’t appear”- Ensure Raffi is installed and in your
$PATH - If using Fuzzel mode (default), verify Fuzzel is installed
- Check Sway logs:
journalctl --user -u sway
Invalid exec command (expected at least 1 argument, got 0)
Section titled “Invalid exec command (expected at least 1 argument, got 0)”This error comes from swaymsg, not from Raffi: it means swaymsg exec was called without a
command because Raffi printed nothing. Common causes:
-
No guard on an empty selection.
raffi -p | xargs swaymsg exec --runsswaymsgeven when its input is empty. Use the[ -n "$cmd" ]form shown above. -
You cancelled the menu. Pressing
Escapeor selecting nothing exits without printing, which is normal. -
You selected an addon entry. Emoji, calculator, web search, file browser and text snippet entries perform their action directly in the native UI, so there is no command to print.
-
Raffi is not in Sway’s
PATH. Sway’sexecruns commands throughsh -c, which does not read~/.bashrcor~/.zshrc. Acargo installed binary in~/.cargo/bintherefore works in a terminal but not from a keybinding. Test with an absolute path:set $menu /home/yourname/.cargo/bin/raffi -pOr export the directory in Sway’s environment, for example via
systemctl --user import-environment PATHor your login shell profile.
Applications don’t launch
Section titled “Applications don’t launch”- Test the command manually:
cmd=$(raffi -p) && [ -n "$cmd" ] && swaymsg exec -- "$cmd" - Verify
swaymsgis working:swaymsg -t get_version - Capture a debug log from the keybinding:
set $menu raffi -p --debug-file /tmp/raffi.log