Skip to content

[FEATURE] Add String Case Methods in Expressions #956

Open
@bbb651

Description

Description of the requested feature

Add the following string case related functions to the expression language:

  • lower(string) -> string
  • upper(string) -> string
    I don't other conversions (uppercase first letter, snake case, camel case, etc) are that common and can be done with regex.
    Potentially also useful:
  • strip(string) -> string - (remove whitespace from either side of a string) maybe the default string widget and label should automatically strip their text?

Proposed configuration syntax

I'm assigning css classes based on the battery status from EWW_BATTERY.BAT0.status, which returns the status as a string starting with a capital letter, which isn't the convention for css classes. It would look like this:

(defwidget battery []
  (box :class "battery ${lower(EWW_BATTERY.BAT0.status)}"
  ...)
)

Additional context

All these operations are already possible with regex, but I feel like they're common enough to warrant dedicated methods.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions