[PR #949] [MERGED] feat!: support glob patterns for keyboard layout icons #1058

Closed
opened 2026-05-22 21:55:27 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/949
Author: @postsolar
Created: 4/27/2025
Status: Merged
Merged: 7/20/2025
Merged by: @JakeStanger

Base: masterHead: kb-icon-globs


📝 Commits (10+)

  • 402234f Simplistic globbing for matching keyboard layout icons
  • 4cd90d4 Merge branch 'JakeStanger:master' into kb-icon-globs
  • 05882d8 Use IndexMap instead of HashMap for keyboard layout icons map
  • db6cb9e Enable feature serde for indexmap
  • 29ada32 Document wildcard matching for keyboard layouts
  • d1bbf5b Enable indexmap2 feature flag for schemars
  • 537a2a8 Add missing period
  • b674d9b Merge branch 'JakeStanger:master' into kb-icon-globs
  • 437d0f8 Merge branch 'master' into kb-icon-globs
  • bd6960d Merge branch 'master' into kb-icon-globs

📊 Changes

4 files changed (+21 additions, -8 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 Cargo.toml (+3 -2)
📝 docs/modules/Keyboard.md (+1 -1)
📝 src/modules/keyboard.rs (+16 -5)

📄 Description

The keyboard module now uses glob pattern matching instead of exact string matching when looking up the layout icon from the user-provided map. This allows users to define more flexible rules for displaying icons based on layout names, for example, using * to match variations of a layout (en_*).

This was implemented using the wildmatch crate.

My usecase is that

    icons.layout_map = {
      "English (Colemak-DH ISO)" = "🇺🇸";
      "Estonian"                 = "🇪🇪";
      "Russian (GOST 14289-88)"  = "🇷🇺";
    };

this looks kinda ugly and hard to manage. I'd prefer to just have "English *" instead.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/JakeStanger/ironbar/pull/949 **Author:** [@postsolar](https://github.com/postsolar) **Created:** 4/27/2025 **Status:** ✅ Merged **Merged:** 7/20/2025 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `kb-icon-globs` --- ### 📝 Commits (10+) - [`402234f`](https://github.com/JakeStanger/ironbar/commit/402234f8b967da0c611480d629bc72de9e3a3067) Simplistic globbing for matching keyboard layout icons - [`4cd90d4`](https://github.com/JakeStanger/ironbar/commit/4cd90d4baf5da5868d10b60f500596fd34eae60f) Merge branch 'JakeStanger:master' into kb-icon-globs - [`05882d8`](https://github.com/JakeStanger/ironbar/commit/05882d83f18f0791ea8151c368cc39e2c164eb81) Use `IndexMap` instead of `HashMap` for keyboard layout icons map - [`db6cb9e`](https://github.com/JakeStanger/ironbar/commit/db6cb9e6835fa183e3e6dd2892e50ec16b386aa6) Enable feature `serde` for `indexmap` - [`29ada32`](https://github.com/JakeStanger/ironbar/commit/29ada32e5bec2e6f7e4eea38a03762c3fb789fc1) Document wildcard matching for keyboard layouts - [`d1bbf5b`](https://github.com/JakeStanger/ironbar/commit/d1bbf5b753d07787a287abea034bdeade25bec14) Enable `indexmap2` feature flag for `schemars` - [`537a2a8`](https://github.com/JakeStanger/ironbar/commit/537a2a88e99c32791c49bd47194516da77c4b741) Add missing period - [`b674d9b`](https://github.com/JakeStanger/ironbar/commit/b674d9b44bedc67b189ef04a74577240dc885309) Merge branch 'JakeStanger:master' into kb-icon-globs - [`437d0f8`](https://github.com/JakeStanger/ironbar/commit/437d0f8ede4109d1d266b4e0625a121ac3f02e45) Merge branch 'master' into kb-icon-globs - [`bd6960d`](https://github.com/JakeStanger/ironbar/commit/bd6960d89d896666f1e2dec2c7c8a53b2163c6ce) Merge branch 'master' into kb-icon-globs ### 📊 Changes **4 files changed** (+21 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `Cargo.toml` (+3 -2) 📝 `docs/modules/Keyboard.md` (+1 -1) 📝 `src/modules/keyboard.rs` (+16 -5) </details> ### 📄 Description The keyboard module now uses glob pattern matching instead of exact string matching when looking up the layout icon from the user-provided map. This allows users to define more flexible rules for displaying icons based on layout names, for example, using `*` to match variations of a layout (`en_*`). This was implemented using the `wildmatch` crate. My usecase is that ```nix icons.layout_map = { "English (Colemak-DH ISO)" = "🇺🇸"; "Estonian" = "🇪🇪"; "Russian (GOST 14289-88)" = "🇷🇺"; }; ``` this looks kinda ugly and hard to manage. I'd prefer to just have `"English *"` instead. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-22 21:55:27 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#1058
No description provided.