Skip to content

[REQUEST] Allow optional imports #2078

@agorgl

Description

@agorgl

Before opening a feature request

  • I checked the next branch to see if the feature has already been implemented
  • I searched existing reports to see if it is already requested.

What is the user problem or growth opportunity you want to see solved?

It would be nice if rofi had some functionality for optional imports.
This would allow for dynamic configuration to play nicely with static (fallback) configuration.

Lets say you have some program dynamically generating extra configuration for rofi.
Currently if you have your main rofi configuration just @import it, it will work, but it would fail in cases this extra (optional) configuration is missing.

Example snippet:

//
// ~/.config/rofi/config.rasi
//

// Default configuration copied for example purposes
configuration {

    // Timeout from user input.
    timeout {
        // The delay after inactivity to execute action.
        delay: 0;
        // The action to execute once the delay expires.
        action: "kb-cancel";
    }

    // File browser mode.
    filebrowser {
        sorting-method:    "name";
        directories-first: true;
    }
}

// Default theme gets imported here
@theme "default"

// Optional overrides file gets imported here
@import? "overrides"

In this example, having some kind of optional import directive (i'm suggesting an @import? directive for this) would allow for the override.rasi to be loaded if it exists, else just continue/fallback to the previously defined configuration.

How do you know that this problem exists today? Why is this important?

It allows rofi to be more flexible when configuring it with dynamically generated sources/imports.

Who will benefit from it?

Everybody

Rofi version (rofi -v)

1.7.7

Configuration

.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions