Skip to content

Feature Request: Decouple "Print Selection" behavior from Even/Odd Button IDs #323

@kr4bat

Description

@kr4bat

I have confirmed in version 14.2 that yad --list strictly ties the output behavior to the even/odd nature of the button's exit code:

Even IDs (0, 2, 4...): Print the selected row to stdout.

Odd IDs (1, 3, 5...): Suppress output (acting like "Cancel").

The Issue: While this aligns with standard OK/Cancel conventions, it becomes a hidden "gotcha" for complex scripts. Users often assign IDs based on their script's logic flow (e.g., "3 = Add New", "5 = Delete") without realizing that using an odd number will silently prevent them from reading the currently selected row.

Proposal: It would be very helpful to make this behavior configurable per button, rather than implicitly tied to the number.

Suggestion: Extend the button syntax to allow an optional flag to force printing or suppression.

Current: --button="Label:ID"

Proposed: --button="Label:ID:FLAGS" (or similar)

Example: --button="Add:3:print" -> Returns exit code 3 but does print the selection. --button="Details:2:silent" -> Returns exit code 2 but does not print the selection.

Reproduction (v14.2):
Bash

Even ID (4) prints output:

echo "Row1" | yad --list --column=Data --button="Test:4"

Output: Row1|

Odd ID (3) prints nothing:

echo "Row1" | yad --list --column=Data --button="Test:3"

Output: (empty)

Thank you for maintaining YAD!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions