Skip to content

rofi: add alternatePattern option#2193

Open
gibbz00 wants to merge 1 commit intonix-community:masterfrom
gibbz00:master
Open

rofi: add alternatePattern option#2193
gibbz00 wants to merge 1 commit intonix-community:masterfrom
gibbz00:master

Conversation

@gibbz00
Copy link
Copy Markdown

@gibbz00 gibbz00 commented Feb 8, 2026

@stylix-automation stylix-automation bot added topic: home-manager Home Manager target topic: modules /modules/ subsystem labels Feb 8, 2026
Copy link
Copy Markdown
Member

@trueNAHO trueNAHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you provide screenshots for the {before,after} * {dark,light} matrix of this PR?

The /modules/rofi/ module has no testbed. The closest thing might be /modules/wofi/testbeds/wofi.nix.

@gibbz00
Copy link
Copy Markdown
Author

gibbz00 commented Feb 14, 2026

Could you provide screenshots for the {before,after} * {dark,light} matrix of this PR?

Sure 😊 With ayu-{dark,light}:

Dark Alternating

dark

Dark

dark_alternating

Light Alternating

light_alternating

Light

light

The /modules/rofi/ module has no testbed. The closest thing might be /modules/wofi/testbeds/wofi.nix.

Apologies, misunderstood it as "I've run the test and make sure they still work."

Copy link
Copy Markdown
Member

@trueNAHO trueNAHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve the nix build .#checks.x86_64-linux.pre-commit CI failure. For reference, you can just run nix fmt.

mkLiteral "rgba ( ${r}, ${g}, ${b}, ${opacity'} % )";
mkRgb = mkRgba "100";
rofiOpacity = toString (builtins.ceil (opacity.popups * 100));
mkAlternate = alternate: fallback: if cfg.alternatePattern then alternate else fallback;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming and swapping the function arguments as follows:

Suggested change
mkAlternate = alternate: fallback: if cfg.alternatePattern then alternate else fallback;
mkAlternate = base: alternate: if cfg.alternatePattern then alternate else base;

Do not forget to swap the argument order for all callers.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for why that is better? My reasoning was:

"If alternate; use this color, otherwise fall back to this"

mkAlternate (mkLiteral "@foreground") normal-foreground

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for why that is better? My reasoning was:

"If alternate; use this color, otherwise fall back to this"

Ideally, implementation details do not leak. The alternate: fallback: argument order reads nicely when the implementation reads as alternate: fallback: if isAlternate then alternate else fallback, but would be contrived for alternate: fallback: if isNotAlternate then fallback then alternate. My base: alternate: argument order establishes the base case first and then the exception. The fact that the exception is enabled by default is an implementation detail. This interpretation is obviously reversed when considering the alternate state as the base case.

Both interpretations are fine, although I prefer the base: alternate: order, but the fallback term incorrectly implies faulty behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tend to agree with NAHO here, but it's only a slight preference and would be fine merging either way.

@0xda157 0xda157 requested a review from trueNAHO April 6, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: home-manager Home Manager target topic: modules /modules/ subsystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants