Skip to content

Fine-grained control bar #295

Open
Open

Description

@egmontkob

The control bars of alsamixer are quite coarse. They jump by whole character cells. Often a notable amount of increase or decrease (pressing the Up or Down arrow) isn't reflected visually.

I'd like to ask for an opion for more fine-grained looking control bars.

If the terminal's / locale's claimed charset, as reported by nl_langinfo(CODESET), is "UTF-8" (as it should be pretty much everywhere nowadays), you could use the Unicode characters U+2581 to U+2588 for this purpose. They jump by eighths of a cell's hight.

Their foreground color would be the desired bar color (red/white/green) and their background would be the default (or black for -B). For consistency, this mode should probably replace the current checkerboard (ACS_CKBOARD) characters by the full block U+2588 and only set its foreground, but maybe this doesn't matter.

There are several terminal emulators out there (at least VTE-based ones such as GNOME Terminal and many others; Konsole; and presumably much more) that don't take these glyphs from the font but rather draw them manually to perfectly align them at cell boundaries. In these terminals the bar would look perfectly. In other terminals there might be some ugly gaps at cell boundaries (subject to the selected font), but some people might still prefer this tiny visual glitch over the current coarseness of the bar (again: this would be an option, not a forced new behavior).

Thanks for considering this feature request!

Activity

  1. egmontkob commented on Mar 2, 2025

    @egmontkob
    Author

    Here's a quick proof of concept.

    The interesting bits are done, to preview the feature. No config option yet (only the new behavior is available), no check for utf-8, no documentation.

    Not sure if it works correctly with custom colors. The changes in colors.c are quite ugly: I happen to need two colors that were defined previously, and calling get_color_pair() again with the same colors wouldn't allocate a new COLOR_PAIR, so the COLOR_PAIR(x) indices had to be modified. I don't know how this business interferes with custom color definitions from the config file; maybe it forces two different color roles to be identical... needs investigation.

    alsamixer-smooth-PoC.patch.txt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions