Conditions
Overview
Section titled “Overview”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.
Condition Types
Section titled “Condition Types”ifenvset
Section titled “ifenvset”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.
Example: Wayland-Only Entry
Section titled “Example: Wayland-Only Entry”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_DISPLAYThis entry appears only when WAYLAND_DISPLAY is set (i.e., in Wayland sessions).
Example: Sway-Specific Entry
Section titled “Example: Sway-Specific Entry”launchers: cliphistory: binary: clipman args: ["pick", "-t", "wofi"] description: "Clipboard history" icon: accessories-clipboard ifenvset: SWAYSOCKifenvnotset
Section titled “ifenvnotset”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.
Example
Section titled “Example”launchers: x11-only: binary: xdotool description: "X11 Tool" ifenvnotset: WAYLAND_DISPLAYifenveq
Section titled “ifenveq”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.
Example: GNOME-Only Entry
Section titled “Example: GNOME-Only Entry”launchers: keyboard-setting: binary: gnome-control-center args: [keyboard] description: "Keyboard setting" icon: preferences-desktop-keyboard-shortcuts ifenveq: [DESKTOP_SESSION, GNOME]Example: X11-Only Entry
Section titled “Example: X11-Only Entry”launchers: snap-window-around: binary: wmctrl-resize-and-center args: [rotate] description: "Snap window around" icon: wmaround ifenveq: [XDG_SESSION_TYPE, x11]Example: Desktop Environment Check
Section titled “Example: Desktop Environment Check”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]ifexist
Section titled “ifexist”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.
Example: Binary Existence
Section titled “Example: Binary Existence”launchers: wally: binary: jumpapp args: ["-X", "wally"] description: "Wally" icon: wally ifexist: wallyShown only if wally is installed in PATH.
Example: Multiple Entries for Same App
Section titled “Example: Multiple Entries for Same App”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-desktopExample: File Path Check
Section titled “Example: File Path Check”launchers: custom-app: binary: ~/bin/myapp description: "My Application" icon: myapp ifexist: ~/bin/myappCombining with Other Fields
Section titled “Combining with Other Fields”Conditions work with all other entry fields:
Script with Condition
Section titled “Script with Condition”launchers: my-script: script: | echo "Running on Wayland" env | grep WAYLAND description: "Wayland Info" icon: "info" ifenvset: WAYLAND_DISPLAYDisabled Entry with Condition
Section titled “Disabled Entry with Condition”launchers: optional-tool: binary: special-tool description: "Special Tool" ifexist: special-tool disabled: trueReal-World Examples
Section titled “Real-World Examples”From the example configuration:
Environment-Specific System Commands
Section titled “Environment-Specific System Commands”# GNOME-specific shutdownlaunchers: 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: SWAYSOCKSession Type Detection
Section titled “Session Type Detection”# X11-only entrylaunchers: 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: SWAYSOCKOptional Tools
Section titled “Optional Tools”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: kindValidation Logic
Section titled “Validation Logic”Raffi evaluates conditions on startup:
- ifenveq: Checks if variable exists and equals expected value
- ifenvset: Checks if variable exists (any value)
- ifenvnotset: Checks if variable does not exist
- ifexist: Checks if binary is in PATH or file exists
If any condition fails, the entry is hidden.
Automatic Binary Check
Section titled “Automatic Binary Check”Even without conditions, Raffi automatically hides entries if:
binarydoesn’t exist in PATH (for non-script entries)- Script interpreter doesn’t exist in PATH (for script entries)
# Automatically hidden if firefox is not installedlaunchers: firefox: binary: firefox description: "Firefox" icon: firefoxMultiple Conditions
Section titled “Multiple Conditions”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 sessionslaunchers: gnome-wayland-tool: binary: my-tool description: "Tool (GNOME on Wayland)" ifenveq: [DESKTOP_SESSION, GNOME] ifenvset: WAYLAND_DISPLAY