Skip to content

⭐ 5. Fields

SmileLulz edited this page Sep 1, 2026 · 1 revision

🧩 --field <field>:<mode>

Filds options can only be used with --provider.

It customizes how SmileMenu displays each item from a provider script's list output.

📌 Fields

Field What it controls
name Display-name of the item
icon Image path or icon name
description Secondary text below the name

📌 Modes

Mode Effect
<column> Use the N‑th tab‑separated column (1‑based) from the output
file If the value is a file path, it extracts the basename (e.g., /path/to/file.png -> file.png)
text Use the raw value as‑is
none Force the field to be empty

💡 Examples

  • --field name:file --field icon:file
    • For a provider that outputs file paths, show the filename and use the full path as icon.
  • --field name:2 --field description:3
    • For tab‑separated output, use the 2nd column as name and 3rd as description.
  • No --field at all
    • The name becomes the raw line, icon and description is empty.

💡 Example 1 (Wallpaper provider)

Provider script:

#!/usr/bin/env bash

WALLPAPER_DIR="$HOME/.wallpapers"

case "$1" in

list)
    find "$WALLPAPER_DIR" \
        -maxdepth 1 \
        -type f \
        \( -iname "*.png" -o -iname "*.jpg" \) \
        -printf "%p\n"
;;

run)
    awww img "$2" --transition-type any --transition-step 128 --transition-fps 75

    echo "Selected: $2"
;;

esac

Run in with fields:

smilemenu --provider /path/to/your/wallpaper-provider.sh \
    --field name:file \
    --field icon:file \
    --field description:text

This will do:

  • Name = file name instead of full path
  • Icon = full image path
  • Description = raw text (full path in this case)

💡 Example 2 (Column based provider)

#!/bin/bash

case $1 in
    list) echo -e "Firefox\tOpen Firefox\tfirefox\nSteam\tLaunch Steam\tsteam";;

    run) command=$(echo "$2" | cut -f3); exec "$command";;
esac

This outputs two lines (two items). Each line has its contents separated with tabs:

Firefox    Open Firefox    firefox
Steam    Launch Steam    steam

Run it with:

smilemenu --provider /path/to/this_script.sh --field name:1 --field description:2

This will do:

  • Name = first column (Firefox)
  • Deskcription = second column (Open Firefox)
  • When selected, get the third column as command and execute it (firefox)

Clone this wiki locally