Skip to content

Conditions

Raffi supports conditional visibility for launcher entries. Use conditions to:

  • Show entries only in specific desktop environments
  • Display entries only when certain binaries are installed
  • Conditionally show entries based on environment variables

Multiple conditions can be specified per entry. When multiple conditions are present, they are AND-ed together — all conditions must pass for the entry to be shown.

Shows the entry only if an environment variable is set (to any value).

ifenvset string

Environment variable name. Entry is shown only if this variable is set.

launchers:
rbw-pass:
binary: rofi-rbw
args:
[
"--selector wofi --clipboarder wl-copy --action copy-password --typer xdotool",
]
description: "Password Manager"
icon: password-manager
ifenvset: WAYLAND_DISPLAY

This entry appears only when WAYLAND_DISPLAY is set (i.e., in Wayland sessions).

launchers:
cliphistory:
binary: clipman
args: ["pick", "-t", "wofi"]
description: "Clipboard history"
icon: accessories-clipboard
ifenvset: SWAYSOCK

Shows the entry only if an environment variable is not set.

ifenvnotset string

Environment variable name. Entry is shown only if this variable is not set.

launchers:
x11-only:
binary: xdotool
description: "X11 Tool"
ifenvnotset: WAYLAND_DISPLAY

Shows the entry only if an environment variable equals a specific value.

ifenveq array

Array with exactly two elements: [VARIABLE_NAME, EXPECTED_VALUE].

Entry is shown only if $VARIABLE_NAME == EXPECTED_VALUE.

launchers:
keyboard-setting:
binary: gnome-control-center
args: [keyboard]
description: "Keyboard setting"
icon: preferences-desktop-keyboard-shortcuts
ifenveq: [DESKTOP_SESSION, GNOME]
launchers:
snap-window-around:
binary: wmctrl-resize-and-center
args: [rotate]
description: "Snap window around"
icon: wmaround
ifenveq: [XDG_SESSION_TYPE, x11]
launchers:
gnome-shutdown:
binary: gnome-session-quit
args: [--power-off]
description: "Shutdown / Poweroff"
icon: gnome-shutdown
ifenveq: [DESKTOP_SESSION, GNOME]
reboot:
binary: gnome-session-quit
args: [--reboot]
description: "Reboot"
icon: gnome-session-reboot
ifenveq: [DESKTOP_SESSION, GNOME]

Shows the entry only if a specific binary or file exists.

ifexist string

Binary name. Entry is shown only if the binary exists in PATH.

launchers:
wally:
binary: jumpapp
args: ["-X", "wally"]
description: "Wally"
icon: wally
ifexist: wally

Shown only if wally is installed in PATH.

launchers:
evolution-mail:
binary: jumpapp
args: ["-t", "Evolution", "-X", "evolution"]
description: "Evolution Mail"
icon: evolution-mail
ifexist: evolution
signal:
binary: jumpapp
args: ["-X", "signal", "signal-desktop"]
description: "Signal"
icon: signal-desktop
ifexist: signal-desktop
launchers:
custom-app:
binary: ~/bin/myapp
description: "My Application"
icon: myapp
ifexist: ~/bin/myapp

Conditions work with all other entry fields:

launchers:
my-script:
script: |
echo "Running on Wayland"
env | grep WAYLAND
description: "Wayland Info"
icon: "info"
ifenvset: WAYLAND_DISPLAY
launchers:
optional-tool:
binary: special-tool
description: "Special Tool"
ifexist: special-tool
disabled: true

From the example configuration:

# GNOME-specific shutdown
launchers:
gnome-shutdown:
binary: gnome-session-quit
args: [--power-off]
description: "Shutdown / Poweroff"
icon: gnome-shutdown
ifenveq: [DESKTOP_SESSION, GNOME]
# Sway-specific shutdown
shutdown:
binary: poweroff
description: "Shutdown / Poweroff"
icon: gnome-shutdown
ifenvset: SWAYSOCK
# X11-only entry
launchers:
red-hat-mail:
binary: xdo-focus-a-tab
args: ["chromium", "Red Hat Mail", "https://mail.google.com/a/redhat.com"]
description: "Red Hat GMail"
icon: gmail
ifenveq: [XDG_SESSION_TYPE, x11]
# Wayland-only entry
screenshot-clipboard:
binary: sway-screenshot
args: [selection-clipboard]
description: "Screenshot to clipboard"
icon: screenshoticon
ifenvset: SWAYSOCK
launchers:
emoji-picker:
binary: splatmoji
args: [copy]
description: "Emoji Picker"
icon: emoji
ifexist: splatmoji
bpytop:
binary: kitty-ctrl
args: ["jump", "bpytop"]
description: "BpyTOP"
icon: bashtop
ifexist: bpytop
start-kind:
binary: kitty-ctrl
args: ["jump", "-t", "Kind", "startkind"]
description: "Start Kind"
icon: kind-started
ifexist: kind

Raffi evaluates conditions on startup:

  1. ifenveq: Checks if variable exists and equals expected value
  2. ifenvset: Checks if variable exists (any value)
  3. ifenvnotset: Checks if variable does not exist
  4. ifexist: Checks if binary is in PATH or file exists

If any condition fails, the entry is hidden.

Even without conditions, Raffi automatically hides entries if:

  • binary doesn’t exist in PATH (for non-script entries)
  • Script interpreter doesn’t exist in PATH (for script entries)
# Automatically hidden if firefox is not installed
launchers:
firefox:
binary: firefox
description: "Firefox"
icon: firefox

Multiple conditions can be specified on a single entry. When present, they are AND-ed together — all conditions must pass for the entry to be shown.

# Entry shown only on GNOME Wayland sessions
launchers:
gnome-wayland-tool:
binary: my-tool
description: "Tool (GNOME on Wayland)"
ifenveq: [DESKTOP_SESSION, GNOME]
ifenvset: WAYLAND_DISPLAY